Terraform无法更新Cognito用户池

4
我正在尝试使用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 Provider)是哪个?我们能看看你的Terraform代码吗? - Jaime S
@JaimeS 嗨!谢谢你的回答。我已经更新了我的问题,包括我使用的版本和我的 Terraform 配置。 - Olivier Castro-Perrier
你解决了这个问题吗? - mufasa
1
嗨,不,我没有。 - Olivier Castro-Perrier
1个回答

1

1
尽管此链接可能回答了问题,但最好在此处包含答案的必要部分并提供该链接以供参考。如果链接页面更改,仅包含链接的答案可能会变得无效。 -【通过审核】 - Flair

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接