当前位置: 首页 > 知识库问答 >
问题:

Terraform aws_codepipeline未能满足约束

井修雅
2023-03-14

我正在创建一个AWS CodePipeline资源与terraform:

resource "aws_codepipeline" "codepipeline" {
  name     = "codepipeline-tst"
  role_arn = "${aws_iam_role.codepipeline_role.arn}"

  artifact_store {
    location = "codepipeline-eu-east-1-<ACC_NUM>"
    type     = "S3"
  }

  stage {
    name = "Source"

    action {
      name             = "Source"
      category         = "Source"
      owner            = "ThirdParty"
      provider         = "GitHub"
      version          = "1"
      output_artifacts = ["artifact"]

      configuration = {
        Owner  = "MyOwner"
        Repo   = "MyRepo"
        Branch = "master"
        OAuthToken = ""
      }
    }
  }

  stage {
    name = "Deploy"

    action {
      name            = "Deploy"
      category        = "Deploy"
      owner           = "AWS"
      provider        = "CodeDeploy"
      input_artifacts = ["artifact"]
      version         = "1"
    }
  }
}

运行terraform apply时,在aws_codepipeline.codepipeline.2分钟后:仍在创建。它返回

Error: Error creating CodePipeline: ValidationException: 1 validation error detected: Value at 'pipeline.stages.1.member.actions.1.member.configuration' failed to satisfy constraint: Map value must satisfy constraint: [Member must have length less than or equal to 1000, Member must have length greater than or equal to 1]

编辑:

新的部署阶段是:

stage {
    name = "Deploy"

    action {
      name            = "Deploy"
      category        = "Deploy"
      owner           = "AWS"
      provider        = "CodeDeploy"
      input_artifacts = ["artifact"]
      version         = "1"
      configuration = {
        ApplicationName  = "my-app"
        DeploymentGroupName  = "bar"
      }
    }
  }

我有这个应用程序创建使用:

resource "aws_codedeploy_app" "my-app" {
  compute_platform = "Server"
  name             = "my-app"
}

组使用:

resource "aws_codedeploy_deployment_group" "my_group-2" {
  app_name               = "my-app"
  deployment_group_name  = "bar"
  service_role_arn       = "arn..."

  ec2_tag_filter {
    key   = "aws:autoscaling:groupName"
    type  = "KEY_AND_VALUE"
    value = "MyContainerService"
  }

  auto_rollback_configuration {
    enabled = false
  }
}

共有1个答案

萧心远
2023-03-14

"部署"操作没有所需的"配置"属性。

CodeDeploy操作需要两个配置参数

  1. 应用名称
  2. 部署组

请将它们添加到此操作中。

 类似资料:
  • 我正在使用Eclipse for Java和AWS工具包。我运行以下代码: 我在控制台视图中看到: […{Name:Name,AttributeDataType:String,DeveloperOnlyAttribute:false,Mutable:true,Required:false,StringAttributeConstraints:{MinLength:0,MaxLength:2048}

  • 我正在尝试在AWS中应用身份池策略。我正在使用awc cli设置策略,但标题中经常出现以下例外情况: 调用AttachPrincipalPolicy操作时发生错误(InvalidRequestException):检测到1个验证错误:“policyName”处的值“DeviceShadowPolicy”未能满足约束:成员必须满足正则表达式模式:[\w=,。@-] 这是我使用的命令: 我不明白为什么

  • 我正在通过Sagemaker将模型部署到AWS上: 我将JSON模式设置如下: 并部署为: 我得到的错误如下: ClientError:调用CreateModel操作时发生错误(ValidationException):检测到1个验证错误:值“{SAGEMAKER_SPARKML_SCHEMA={”输入“:[{”类型“:“double”,“名称“:“V1”},{”类型“:“V2”},{”类型“:“

  • 嗨大家好, 我正在使用AWS S3 SDK 2.2.8将图像上载到S3。我已经在S3控制台中创建了Bucket。 我使用以下代码段上传文件。 我遇到了以下异常: com.amazonaws.AmazonServiceException:检测到1个验证错误:“accountId”处的值“XXXX-XXXX-XXXX”未能满足约束:成员必须满足正则表达式模式:\d(服务:AmazonCongnitoI

  • 我正在尝试使用AWS CDK创建AWS用户池客户端。我正在使用python代码进行此操作。下面是我的代码- 我已经尝试了不同的选项,作为"TOKEN","令牌","代码","代码","代码"。它仍然不起作用。对于上面的代码,我得到下面的错误- 我不知道这里出了什么问题。我引用此链接是为了:https://docs.aws.amazon.com/AWSCloudFormation/latest/Us

  • 我打算访问zip文件的s3存储桶。 当我使用下面的代码时,它可以访问存储桶,因为它使用存储桶的根目录。 “S3Bucket”:{“Ref”:“HandlerCodeS3Bucket”}, 当我想访问同一个bucket的layers文件夹时,我使用HandlerCodeS3BucketLayer参数。 但它显示以下错误。