Tag groups aren't supported in aws_codedeploy_deployment_group
. This will allow you do intersections of tags.
IIRC this should do it for you - https://www.terraform.io/docs/providers/aws/r/codedeploy_deployment_group.html#ec2_tag_filter
@rmenn the ec2_tag_filter places the tags into a single tag group (from my experiments) and according to code deploy that means it will deploy to things matching ANY of the tags.
So in the above example it would make a single tag group with env=dev, role=rails and match all my instances matching dev and all the instances matching rails. Rather than just instances matching dev and rails.
FYI, for the work around, I created the tag groups manually and Terraform ignores them, which is fine
This is also affecting my workflow. Seems to be a pretty big oversight for the CodeDeploy resource. Any chance we can get an ETA on a fix?
Bumping this issue. As we're currently just using Terraform for our CodeDeploy configuration and the associated servers, this is a big deal. We can workaround it by changing our tag scheme, but we would much rather have the flexibility of using tag groups.
Current workaround I'm using is to use the local-exec
provisioner and the aws-cli to create these tag sets:
provisioner "local-exec" {
command = <<EOF
aws deploy update-deployment-group \
--application-name ${aws_codedeploy_deployment_group.main.app_name} \
--current-deployment-group-name ${aws_codedeploy_deployment_group.main.deployment_group_name} \
--ec-2-tag-set '{
"ec2TagSetList": [
[
{
"Key": "Name",
"Value": "${var.app_name}",
"Type": "KEY_AND_VALUE"
}
],
[
{
"Key": "Environment",
"Value": "${var.environment}",
"Type": "KEY_AND_VALUE"
}
]
]
}'
EOF
}
The ec2_tag_set
argument has been added to the aws_codedeploy_deployment_group
attribute via #4324 and will release with v1.17.0 of the AWS provider, likely in a week.
This has been released in version 1.17.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.
I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.
If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!
Most helpful comment
The
ec2_tag_set
argument has been added to theaws_codedeploy_deployment_group
attribute via #4324 and will release with v1.17.0 of the AWS provider, likely in a week.