英文:
aws terraform, how to create feature flag instead of type freeform appconfig flag
问题
以下是您的appconfig代码的翻译部分:
resource "aws_appconfig_application" "feature_flag_app" {
  name        = "FFApplication"
  description = "AppConfig Application for Lambda"
}
resource "aws_appconfig_environment" "feature_flag_app" {
  name           = "FFEnvironment"
  application_id = aws_appconfig_application.feature_flag_app.id
  description    = "AppConfig Environment for Lambda"
}
resource "aws_appconfig_configuration_profile" "feature_flag_app" {
  name           = "FFConfigurationProfile"
  application_id = aws_appconfig_application.feature_flag_app.id
  location_uri   = "hosted" # Replace with your SSM document ARN or another supported location
  description    = "AppConfig Configuration Profile for Lambda"
}
resource "aws_appconfig_hosted_configuration_version" "feature_flag_app" {
  application_id           = aws_appconfig_application.feature_flag_app.id
  configuration_profile_id = aws_appconfig_configuration_profile.feature_flag_app.configuration_profile_id
  description              = "Example Feature Flag Configuration Version"
  content_type             = "application/json"
#
  content = jsonencode({
    flags : {
      simpleflag : {
        name : "simpleflag",
        _deprecation : {
          "status" : "planned"
        }
      }
    },
    values : {
      dbaccess : {
        enabled : "true",
      }
    },
    version : "1"
  })
}
由Terraform创建的相应标志的类型是freeform,不确定您是否漏掉了什么。您尝试创建类型为feature flag的appconfig feature flag,但您得到的是类型为freeform的feature flag。
英文:
Following is my appconfig code
resource "aws_appconfig_application" "feature_flag_app" {
  name        = "FFApplication"
  description = "AppConfig Application for Lambda"
}
resource "aws_appconfig_environment" "feature_flag_app" {
  name           = "FFEnvironment"
  application_id = aws_appconfig_application.feature_flag_app.id
  description    = "AppConfig Environment for Lambda"
}
resource "aws_appconfig_configuration_profile" "feature_flag_app" {
  name           = "FFConfigurationProfile"
  application_id = aws_appconfig_application.feature_flag_app.id
  location_uri   = "hosted" # Replace with your SSM document ARN or another supported location
  description    = "AppConfig Configuration Profile for Lambda"
}
resource "aws_appconfig_hosted_configuration_version" "feature_flag_app" {
  application_id           = aws_appconfig_application.feature_flag_app.id
  configuration_profile_id = aws_appconfig_configuration_profile.feature_flag_app.configuration_profile_id
  description              = "Example Feature Flag Configuration Version"
  content_type             = "application/json"
#
  content = jsonencode({
    flags : {
      simpleflag : {
        name : "simpleflag",
        _deprecation : {
          "status" : "planned"
        }
      }
    },
    values : {
      dbaccess : {
        enabled : "true",
      }
    },
    version : "1"
  })
}
The corresponding flag created by terraform is of type freeform, not sure what I am missing.
I tried to create appconfig feature flag of type feature flag, I am getting a feature flag of type freeform
答案1
得分: 2
You need to fix the other resource, aws_appconfig_configuration_profile to set it to be of type AWS.AppConfig.FeatureFlags:
resource "aws_appconfig_configuration_profile" "feature_flag_app" {
  name           = "FFConfigurationProfile"
  application_id = aws_appconfig_application.feature_flag_app.id
  location_uri   = "hosted" # Replace with your SSM document ARN or another supported location
  description    = "AppConfig Configuration Profile for Lambda"
  type           = "AWS.AppConfig.FeatureFlags"
}
Without the type argument it is by default AWS.Freeform:
type- (Optional) Type of configurations contained in the profile. Valid values:AWS.AppConfig.FeatureFlagsandAWS.Freeform. Default:AWS.Freeform.
英文:
You need to fix the other resource, aws_appconfig_configuration_profile to set it to be of type AWS.AppConfig.FeatureFlags:
resource "aws_appconfig_configuration_profile" "feature_flag_app" {
  name           = "FFConfigurationProfile"
  application_id = aws_appconfig_application.feature_flag_app.id
  location_uri   = "hosted" # Replace with your SSM document ARN or another supported location
  description    = "AppConfig Configuration Profile for Lambda"
  type           = "AWS.AppConfig.FeatureFlags"
}
Without the type argument it is by default AWS.Freeform:
> type - (Optional) Type of configurations contained in the profile. Valid values: AWS.AppConfig.FeatureFlags and AWS.Freeform. Default: AWS.Freeform.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论