Terraform 自定义属性销毁用户池 AWS
Terraform Custom Attribute Destroying User Pool AWS
我有一个不再使用的自定义属性,它会强制 terraform 每次都销毁用户池。有没有办法避免用户池被破坏?
我的地形:
resource "aws_cognito_user_pool" "my_pool" {
name = "${var.la} Pool"
alias_attributes = [
"email"
]
/* Auto-verify these fields */
auto_verified_attributes = [
"email"
]
...
schema {
attribute_data_type = "String"
name = "my_custom_attribute1"
required = "false"
mutable = "true"
}
}
地形规划给出以下结果:
schema.xxx.attribute_data_type: "String" => "" (forces new resource)
schema.xxx.developer_only_attribute: "false" => "false"
schema.xxx.mutable: "true" => "false" (forces new resource)
schema.xxx.name: "my_custom_attribute1" => "" (forces new resource)
schema.xxx.number_attribute_constraints.#: "0" => "0"
schema.xxx.required: "false" => "false"
schema.xxx.string_attribute_constraints.#: "1" => "0" (forces new resource)
schema.xxx.string_attribute_constraints.0.max_length: "" => ""
schema.xxx.string_attribute_constraints.0.min_length: "" => ""
我没有对这些进行更改,但每次我尝试计划时它都说有更改并且我需要销毁我的用户池(我不想这样做)。
我试过 运行 terraform 刷新,但似乎没有效果。
我发现了以下内容,但这些建议似乎无法解决我的问题:https://github.com/terraform-providers/terraform-provider-aws/issues/3891
我不认为这真的是一个错误。如何避免破坏我的 Cognito 用户池?
terraform 版本:0.11.5
aws 版本:0.17(也试过 0.15)
我最近遇到了同样的问题,似乎 Terraform 已更新 their documentation 以突出显示此问题:
NOTE: When defining an attribute_data_type of String or Number, the respective attribute constraints configuration block (e.g string_attribute_constraints or number_attribute_contraints) is required to prevent recreation of the Terraform resource. This requirement is true for both standard (e.g. name, email) and custom schema attributes.
简而言之,您可能需要向属性添加约束以阻止它每次都重新创建,例如:
string_attribute_constraints = { # This is required to stop user pool being recreated
max_length = 32
}
这可能会导致您的资源被更新(并因此被销毁)一次,但随后应该会按预期运行。一如既往,我建议先进行测试!
我有一个不再使用的自定义属性,它会强制 terraform 每次都销毁用户池。有没有办法避免用户池被破坏?
我的地形:
resource "aws_cognito_user_pool" "my_pool" {
name = "${var.la} Pool"
alias_attributes = [
"email"
]
/* Auto-verify these fields */
auto_verified_attributes = [
"email"
]
...
schema {
attribute_data_type = "String"
name = "my_custom_attribute1"
required = "false"
mutable = "true"
}
}
地形规划给出以下结果:
schema.xxx.attribute_data_type: "String" => "" (forces new resource)
schema.xxx.developer_only_attribute: "false" => "false"
schema.xxx.mutable: "true" => "false" (forces new resource)
schema.xxx.name: "my_custom_attribute1" => "" (forces new resource)
schema.xxx.number_attribute_constraints.#: "0" => "0"
schema.xxx.required: "false" => "false"
schema.xxx.string_attribute_constraints.#: "1" => "0" (forces new resource)
schema.xxx.string_attribute_constraints.0.max_length: "" => ""
schema.xxx.string_attribute_constraints.0.min_length: "" => ""
我没有对这些进行更改,但每次我尝试计划时它都说有更改并且我需要销毁我的用户池(我不想这样做)。
我试过 运行 terraform 刷新,但似乎没有效果。
我发现了以下内容,但这些建议似乎无法解决我的问题:https://github.com/terraform-providers/terraform-provider-aws/issues/3891
我不认为这真的是一个错误。如何避免破坏我的 Cognito 用户池?
terraform 版本:0.11.5 aws 版本:0.17(也试过 0.15)
我最近遇到了同样的问题,似乎 Terraform 已更新 their documentation 以突出显示此问题:
NOTE: When defining an attribute_data_type of String or Number, the respective attribute constraints configuration block (e.g string_attribute_constraints or number_attribute_contraints) is required to prevent recreation of the Terraform resource. This requirement is true for both standard (e.g. name, email) and custom schema attributes.
简而言之,您可能需要向属性添加约束以阻止它每次都重新创建,例如:
string_attribute_constraints = { # This is required to stop user pool being recreated
max_length = 32
}
这可能会导致您的资源被更新(并因此被销毁)一次,但随后应该会按预期运行。一如既往,我建议先进行测试!