Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws_codebuild_project environment_variables do not support using references #6538

Closed
cryptiklemur opened this issue Nov 21, 2018 · 2 comments
Labels
service/codebuild Issues and PRs that pertain to the codebuild service.

Comments

@cryptiklemur
Copy link

cryptiklemur commented Nov 21, 2018

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

Terraform v0.11.10

  • provider.aws v1.46.0
  • provider.github v1.3.0
  • provider.random v2.0.0
  • provider.template v1.0.0
  • provider.vault v1.3.1

Affected Resource(s)

  • aws_codebuild_project

Terraform Configuration Files

resource "aws_codebuild_project" "default" {
  count        = "${var.enabled == "true" ? 1 : 0}"
  name         = "${module.label.id}"
  service_role = "${aws_iam_role.default.arn}"

  artifacts {
    type = "${var.artifact_type}"
  }

  # The cache as a list with a map object inside.
  cache = ["${local.cache}"]

  environment {
    compute_type    = "${var.build_compute_type}"
    image           = "${var.build_image}"
    type            = "LINUX_CONTAINER"
    privileged_mode = "${var.privileged_mode}"

    environment_variable = [{
        "name" = "foo"
        "value" = "${data.vault_generic_secret.build_secrets.data["FOO"]}"
    }]
  }

  source {
    buildspec = "${var.buildspec}"
    type      = "${var.source_type}"
    location  = "${var.source_location}"
  }

  tags = "${module.label.tags}"
}

Debug Output

https://gist.github.com/aequasi/4d8af4a8afbd67889b90c0345f394d56

Panic Output

Expected Behavior

the environment variable "foo" is set to the value from the data accessor (or even a module output, as this fails as well)

Actual Behavior

Error: aws_codebuild_project.default: "environment.0.environment_variable.0.name": required field is not set

Error: aws_codebuild_project.default: "environment.0.environment_variable.0.value": required field is not set

Steps to Reproduce

  1. terraform apply

Important Factoids

Code snippet from above came from this project:
https://github.com/cloudposse/terraform-aws-codebuild

References

@bflad bflad added the service/codebuild Issues and PRs that pertain to the codebuild service. label Nov 21, 2018
@cryptiklemur
Copy link
Author

Will be resolved with: hashicorp/terraform#7034

@ghost
Copy link

ghost commented Apr 2, 2020

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!

@ghost ghost locked and limited conversation to collaborators Apr 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
service/codebuild Issues and PRs that pertain to the codebuild service.
Projects
None yet
Development

No branches or pull requests

2 participants