amazon-web-services - AWS CloudFormation - 忽略属性更改 - `ignore_changes` 来自 Terraform 等效项?

标签 amazon-web-services aws-cloudformation

假设我创建了

    CognitoUserPoolIdentityProviderGoogle:
      Type: AWS::Cognito::UserPoolIdentityProvider
      Properties:
        ProviderName: Google
        AttributeMapping:
          email: emailAddress
        ProviderDetails:
          client_id: xxxx
          client_secret: yyyy
          authorize_scopes: profile email openid phone
        ProviderType: Google
        UserPoolId:
          Ref: CognitoUserPoolUserPool

后来有人手动将 client_idclient_secret 更新为 11112222。重新运行 CloudFormation 将导致覆盖手动更改并将值恢复为 xxxxyyyy

我该如何避免这种情况? AWS::Cognito::UserPoolIdentityProvider 只是一个示例 - 这可以是任何资源。

我正在寻找的基本上是 ignore_changes 的功能在地形中

最佳答案

CFN 中不存在“忽略更改”。在 CFN 无法控制的情况下手动修改 CFN 管理的任何资源是一种不好的做法。手动更改可能会导致很多问题,您正在描述其中之一。

您所观察到的内容的技术术语是 stack drift 。管理它的方法很少。但当您怀疑它时,您要做的第一件事就是运行 drift detection在任何更新之前在您的堆栈上。

由于在您的情况下漂移并没有那么糟糕,因此您有两个选择:

  • 手动更新 CFN 模板以匹配手动更改,并更新堆栈
  • 手动将资源修改回其原始状态,然后通过 CFN 应用所有更新。

关于amazon-web-services - AWS CloudFormation - 忽略属性更改 - `ignore_changes` 来自 Terraform 等效项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64858871/

相关文章:

amazon-web-services - AWS CloudFormation ApiGatewayV2 需要目标属性

amazon-web-services - 有没有办法从 CloudFormation 中删除其痕迹?

amazon-web-services - Fn::Sub 与 Bash 参数替换

amazon-web-services - 将公共(public) api 网关限制为特定 IP

java - DynamoDB AmazonServiceException : The provided key element does not match the schema

amazon-web-services - 如何在 AWS LightSail Linux 实例上打开端口 25

json - 在 CloudFormation 模板文件中设置现有 S3 存储桶的生命周期配置

amazon-web-services - 如何正确格式化此 YAML 片段?

javascript - 使用公共(public) ACM 在 AWS 上部署 Expressjs

amazon-web-services - 通过 IP 限制对 S3 存储桶的访问而不影响 IAM 凭证