Skip to content

aws_codepipeline Commands #42997

@ruben-caceiro-digiwest

Description

@ruben-caceiro-digiwest

Terraform and AWS Provider Version

Terraform v1.12.1
on darwin_arm64
+ provider registry.terraform.io/hashicorp/aws v5.100.0
+ provider registry.terraform.io/hashicorp/http v3.5.0
+ provider registry.terraform.io/hashicorp/random v3.7.2
+ provider registry.terraform.io/hashicorp/tls v4.1.0
+ provider registry.terraform.io/zitadel/zitadel v2.2.0

Affected Resource(s) or Data Source(s)

aws_codepipeline

Expected Behavior

I am trying to create a stage with provider Commands and what I am excepting is the creation of it.

Actual Behavior

The actual behavior is an error that informs that the commands is empty.
Be aware that this commands is different from the commands that you have in rules already.

Relevant Error/Panic Output

 updating CodePipeline Pipeline (frontend-web-content-manager): operation error CodePipeline: UpdatePipeline, https response error StatusCode: 400, RequestID: c2364b80-2522-4556-ac74-95ca2c9a1336, InvalidActionDeclarationException: Action frontend-web-content-manager-cleanup must have a non-empty commands field

Sample Terraform Configuration

Click to expand configuration
resource "aws_codepipeline" "this" {
  for_each       = var.frontends
  execution_mode = "QUEUED"
  name           = each.key
  pipeline_type  = "V2"
  role_arn       = aws_iam_role.role_codepipeline[each.key].arn

  artifact_store {
    location = aws_s3_bucket.this[each.key].bucket
    type     = "S3"
  }

  stage {
    name = "CleanUp"

    dynamic "action" {
      for_each = var.frontends[each.key].urls
      content {
        category = "Compute"
        name     = "${each.key}-cleanup"
        owner    = "AWS"
        provider = "Commands"
        version  = "1"

        configuration = {
          "Commands"        = "aws cloudfront create-invalidation --distribution-id ${aws_cloudfront_distribution.this[action.key].id} --paths '/*'"
          "ComputeType"     = "BUILD_GENERAL1_SMALL"
          "EnvironmentType" = "ARM_CONTAINER"
          "Subnets" = join(",", local.subnets_private.*.id),
          "VpcId"           = var.vpc.id
        }
      }
    }
  }
}

Steps to Reproduce

  1. Apply the new configuration

Debug Logging

Click to expand log output

GenAI / LLM Assisted Development

n/a

Important Facts and References

No response

Would you like to implement a fix?

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAddresses a defect in current functionality.service/codepipelineIssues and PRs that pertain to the codepipeline service.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions