【发布时间】:2021-11-20 02:46:47
【问题描述】:
我正在尝试使用 Terraform 部署 AWS Cognito 用户池。
第一次部署时一切正常,但是当我尝试第二次运行terraform apply-all 而不修改我的配置中的任何内容时,我得到:
Error: error updating Cognito User Pool (us-east-1_XXX): cannot modify or remove schema items
需要帮助!
我正在使用 Terraform 0.13.0 版和 Terragrunt 0.25.0。
这里是 terraform 配置资源,我使用 s3 作为后端。
terraform {
required_providers {
aws = {
version = ">= 3.0"
source = "hashicorp/aws"
}
}
}
provider "aws" {
region = var.region
profile = var.aws_profile
}
resource "aws_cognito_user_pool" "pool" {
name = "my-user-pool"
mfa_configuration = "OFF"
username_attributes = ["email"]
password_policy {
minimum_length = 8
}
schema {
name = "name"
attribute_data_type = "String"
developer_only_attribute = false
mutable = true
required = true
string_attribute_constraints {
max_length = 256
}
}
schema {
name = "family_name"
attribute_data_type = "String"
developer_only_attribute = false
mutable = true
required = true
string_attribute_constraints {
max_length = 256
}
}
schema {
name = "phone_number"
attribute_data_type = "String"
developer_only_attribute = false
mutable = true // false for "sub"
required = true // true for "sub"
string_attribute_constraints {
max_length = 256
}
}
account_recovery_setting {
recovery_mechanism {
name = "verified_email"
priority = 1
}
}
auto_verified_attributes = [
"email"
]
user_pool_add_ons {
advanced_security_mode = "OFF"
}
}
谢谢
【问题讨论】:
-
您好,您使用的是哪个版本的 terraform(和 aws 提供程序)?我们可以看看你的 terraform 代码吗?
-
@JaimeS 嗨!感谢您的回答。我用我使用的版本和我的 terraform 配置更新了我的问题。
-
你解决过这个问题吗?
-
嗨,不,我没有
标签: amazon-web-services terraform terraform-provider-aws terragrunt