hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.8k stars 9.15k forks source link

[Bug]: Updating YAML content of the 'buildspec' argument for the 'aws_codebuild_project' resource does not update the buildspec document in AWS #39824

Open clarkhathawayaltview opened 3 hours ago

clarkhathawayaltview commented 3 hours ago

Terraform Core Version

1.9.7

AWS Provider Version

5.72.0

Affected Resource(s)

aws_codebuild_project

Expected Behavior

When using the built-in yamlencode function to provide the YAML document for the CodeBuild project buildspec, updating the content of this document in the configuration should update the buildspec in AWS after a standard plan & apply.

Actual Behavior

The YAML document for the buildspec in AWS is not updated after a standard plan & apply.

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

variable codebuild-service-role-arn {
  type = string
}

variable codeartifact-repository {
  type = string
}

variable codeartifact-domain {
  type = string
}

variable codeartifact-domain-owner {
  type = string
}

variable codebuild-environment-image-uri {
  type = string
}

resource aws_codebuild_project _ {
  name = "..."
  service_role = var.codebuild-service-role-arn

  source {
    buildspec = yamlencode({
      version = "0.2"

      phases = {
        build = {
          commands = [
            "command1",
            "command2"
          ]
        }
      }
    })
    type = "BITBUCKET"
    location = "..."
  }

  environment {
    compute_type = "BUILD_GENERAL1_SMALL"
    image        = var.codebuild-environment-image-uri
    image_pull_credentials_type = "SERVICE_ROLE"
    type         = "LINUX_CONTAINER"
  }

  artifacts {
    type = "NO_ARTIFACTS"
  }
}

Steps to Reproduce

  1. Replace the redacted content of the configuration file above with usable values
  2. Create the resource with a standard plan & apply
  3. Change the commands field of the buildspec, perhaps adding or removing commands but any change here will suffice.
  4. Run another standard plan & apply
  5. Observe that the YAML document in AWS remains unchanged for this resource

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

github-actions[bot] commented 3 hours ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue