amazon-web-services - Terraform aws_codepipeline 未能满足约束
问题描述
我正在使用 terraform 创建 AWS CodePipeline 资源:
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
时,2分钟后aws_codepipeline.codepipeline: Still creating.
返回
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
}
}
解决方案
您的“部署”操作没有所需的“配置”属性。
CodeDeploy 操作需要两个配置参数:
- 应用名称
- 部署组
请将它们添加到此操作中。
推荐阅读
- prolog - 问题:如何实现 A=a/1, B = b/3, C=A+B 导致 C = a/1 + b/3?
- javascript - 除了单击按钮外,如何在 jQuery 中触发模糊?
- android - 完整的 Google 登录示例 FrontEnd & BackEnd With Code in android studio
- python - 使用 Python-OGR 将 OSM 数据加载到 PostgreSQL
- c# - 将替代记录设置为真,如果它的偶数计数,否则离开最后一条记录
- php - 如何在 PHP 中拆分一些数字和数学运算符?
- python - 在python中的列表中查找连续的子序列
- bluetooth - 如何将浮点值从一个蓝牙模块发送到另一个(HC 05)
- yocto - 有没有办法为 Yocto 的 swupdate 层中的图像创建哈希(sha256)?
- python - 如何使用字符串定义函数名