【发布时间】:2022-01-13 05:40:54
【问题描述】:
下面是我创建 Cognito 用户池的 terraform 代码。
resource "aws_cognito_user_pool" "sample_application" {
name = "sampletest-pool"
schema {
name = "email"
attribute_data_type = "String"
required = true
string_attribute_constraints {
}
}
schema {
name = "name"
attribute_data_type = "String"
required = true
string_attribute_constraints {
min_length = 1
max_length = 50
}
}
schema {
name = "family_name"
attribute_data_type = "String"
required = true
string_attribute_constraints {
min_length = 1
max_length = 50
}
}
schema {
name = "phone_number"
developer_only_attribute = true
attribute_data_type = "Number"
required = true
number_attribute_constraints {}
}
}
当我给 terraform apply 时,我会显示以下错误。
╷ │ 错误:创建 Cognito 用户池时出错: InvalidParameterException:您不能更改 AttributeDataType 或设置 标准模式属性 phone_number 的 developerOnlyAttribute │ │ 使用 aws_cognito_user_pool.sample_application,│ 在 cognito.tf 行 1、在资源“aws_cognito_user_pool”“sample_application”中:│1: 资源 "aws_cognito_user_pool" "sample_application" { │ ╵
我知道我犯了一个小错误,但找不到它,官方文档根本没有这个用例的任何示例。 官方文档: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cognito_user_pool
【问题讨论】:
-
错误是关于
aws_cognito_user_pool.toggle_application。这不是您在问题中提供的资源。 -
@Marcin 刚刚更新了错误信息。
toggle是我工作场所的内部应用程序名称。不想让它暴露在这里。这就是为什么在 terraform 代码中更改它但忘记在错误中更改它的原因。希望这能消除混乱
标签: amazon-web-services terraform amazon-cognito terraform-provider-aws