I am trying to set up an AWS CodeBuild project in Terraform:
resource "aws_codebuild_project" "example" {
name = "test-project"
description = "test_codebuild_project"
build_timeout = "5"
service_role = "${aws_iam_role.example.arn}"
artifacts {
type = "S3"
location = "${aws_s3_bucket.example.bucket}"
name = "example.zip"
packaging = "ZIP"
path = "dev/api/${var.app_version}"
}
This example works fine, but it will only ever save the build artifact example.zip
to the folder set when terraform apply
was run, since ${var.app_version}
doesn't change on subsequent runs of this build.
How do I achieve something that, for example, takes a version number from the package.json
file in the repo and uses that for ${var.app_version}
?