Skip to content

Commit 9e10c7c

Browse files
authored
add environment_variables parameter (#7)
1 parent 9fc7641 commit 9e10c7c

File tree

4 files changed

+43
-17
lines changed

4 files changed

+43
-17
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ It's 100% Open Source and licensed under the [APACHE2](LICENSE).
1919

2020

2121

22+
23+
24+
25+
26+
2227
## Usage
2328

2429
```hcl
@@ -69,6 +74,7 @@ Available targets:
6974
| delimiter | Delimiter to be used between `name`, `namespace`, `stage`, etc. | string | `-` | no |
7075
| ecs_cluster_name | ECS Cluster Name | string | - | yes |
7176
| enabled | Enable `CodePipeline` creation | string | `true` | no |
77+
| environment_variables | A list of maps, that contain both the key 'name' and the key 'value' to be used as additional environment variables for the build. | list | `<list>` | no |
7278
| github_oauth_token | GitHub Oauth Token with permissions to access private repositories | string | - | yes |
7379
| image_repo_name | ECR repository name to store the Docker image built by this module. Used as CodeBuild ENV variable when building Docker images. [For more info](http://docs.aws.amazon.com/codebuild/latest/userguide/sample-docker.html) | string | `UNSET` | no |
7480
| image_tag | Docker image tag in the ECR repository, e.g. 'latest'. Used as CodeBuild ENV variable when building Docker images. [For more info](http://docs.aws.amazon.com/codebuild/latest/userguide/sample-docker.html) | string | `latest` | no |
@@ -177,6 +183,13 @@ See [LICENSE](LICENSE) for full details.
177183
under the License.
178184

179185

186+
187+
188+
189+
190+
191+
192+
180193
## Trademarks
181194

182195
All other trademarks referenced herein are the property of their respective owners.

docs/terraform.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
| delimiter | Delimiter to be used between `name`, `namespace`, `stage`, etc. | string | `-` | no |
1414
| ecs_cluster_name | ECS Cluster Name | string | - | yes |
1515
| enabled | Enable `CodePipeline` creation | string | `true` | no |
16+
| environment_variables | A list of maps, that contain both the key 'name' and the key 'value' to be used as additional environment variables for the build. | list | `<list>` | no |
1617
| github_oauth_token | GitHub Oauth Token with permissions to access private repositories | string | - | yes |
1718
| image_repo_name | ECR repository name to store the Docker image built by this module. Used as CodeBuild ENV variable when building Docker images. [For more info](http://docs.aws.amazon.com/codebuild/latest/userguide/sample-docker.html) | string | `UNSET` | no |
1819
| image_tag | Docker image tag in the ECR repository, e.g. 'latest'. Used as CodeBuild ENV variable when building Docker images. [For more info](http://docs.aws.amazon.com/codebuild/latest/userguide/sample-docker.html) | string | `latest` | no |

main.tf

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -163,23 +163,24 @@ data "aws_iam_policy_document" "codebuild" {
163163
}
164164

165165
module "build" {
166-
source = "git::https://github.com/cloudposse/terraform-aws-codebuild.git?ref=tags/0.7.2"
167-
namespace = "${var.namespace}"
168-
name = "${var.name}"
169-
stage = "${var.stage}"
170-
build_image = "${var.build_image}"
171-
build_compute_type = "${var.build_compute_type}"
172-
buildspec = "${var.buildspec}"
173-
delimiter = "${var.delimiter}"
174-
attributes = "${concat(var.attributes, list("build"))}"
175-
tags = "${var.tags}"
176-
privileged_mode = "${var.privileged_mode}"
177-
aws_region = "${signum(length(var.aws_region)) == 1 ? var.aws_region : data.aws_region.default.name}"
178-
aws_account_id = "${signum(length(var.aws_account_id)) == 1 ? var.aws_account_id : data.aws_caller_identity.default.account_id}"
179-
image_repo_name = "${var.image_repo_name}"
180-
image_tag = "${var.image_tag}"
181-
github_token = "${var.github_oauth_token}"
182-
enabled = "${var.enabled}"
166+
source = "git::https://github.com/cloudposse/terraform-aws-codebuild.git?ref=tags/0.7.2"
167+
namespace = "${var.namespace}"
168+
name = "${var.name}"
169+
stage = "${var.stage}"
170+
build_image = "${var.build_image}"
171+
build_compute_type = "${var.build_compute_type}"
172+
buildspec = "${var.buildspec}"
173+
delimiter = "${var.delimiter}"
174+
attributes = "${concat(var.attributes, list("build"))}"
175+
tags = "${var.tags}"
176+
privileged_mode = "${var.privileged_mode}"
177+
aws_region = "${signum(length(var.aws_region)) == 1 ? var.aws_region : data.aws_region.default.name}"
178+
aws_account_id = "${signum(length(var.aws_account_id)) == 1 ? var.aws_account_id : data.aws_caller_identity.default.account_id}"
179+
image_repo_name = "${var.image_repo_name}"
180+
image_tag = "${var.image_tag}"
181+
github_token = "${var.github_oauth_token}"
182+
enabled = "${var.enabled}"
183+
environment_variables = "${var.environment_variables}"
183184
}
184185

185186
resource "aws_iam_role_policy_attachment" "codebuild_s3" {

variables.tf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,14 @@ variable "image_tag" {
113113
default = "latest"
114114
description = "Docker image tag in the ECR repository, e.g. 'latest'. Used as CodeBuild ENV variable when building Docker images. [For more info](http://docs.aws.amazon.com/codebuild/latest/userguide/sample-docker.html)"
115115
}
116+
117+
variable "environment_variables" {
118+
type = "list"
119+
120+
default = [{
121+
"name" = "NO_ADDITIONAL_BUILD_VARS"
122+
"value" = "TRUE"
123+
}]
124+
125+
description = "A list of maps, that contain both the key 'name' and the key 'value' to be used as additional environment variables for the build."
126+
}

0 commit comments

Comments
 (0)