【发布时间】:2018-06-22 23:04:05
【问题描述】:
我在 terraform 文件中配置了 AWS CodePipeline,如下所示:
resource {
name = "Cool Pipeline"
...
stage {
name = "Source"
...
action {
name = "Source"
...
configuration {
Owner = "Me"
Repo = "<git-repo-uri>"
Branch = develop
OAuthToken = "b3287d649a28374e9283c749cc283ad74"
}
}
}
lifecycle {
ignore_changes = "OAuthToken"
}
}
忽略令牌的原因是 AWS API 没有向 terraform 显示该令牌,而是 AWS API 使用 aws codepipeline get-pipeline <name> 输出它:
"pipeline": {
"stages": {
"name": "Source",
"actions": {
"configuration": {
"OAuthToken": "****"
}
}
}
}
结果是,当我执行terraform plan时,它显示它想要更新该令牌,如下所示:
module.modulename.aws_codepipeline.codepipeline
stage.0.action.0.configuration.%: "3" => "4"
stage.0.action.0.configuration.OAuthToken: "" => "b3287d649a28374e9283c749cc283ad74"
我的问题是,我怎样才能让ignore_changes 生效?我试过这个没有任何成功:
ignore_changes = ["OAuthToken"]
ignore_changes = ["oauthtoken"]
ignore_changes = ["stage.action.configuration.OAuthToken"]
我在谷歌上搜索到的所有示例都显示了如何在同一块级别上忽略。
(令牌是这个文本是假的。)
【问题讨论】:
标签: amazon-web-services terraform aws-codepipeline