Skip to content

Commit a761530

Browse files
Stretch96aknysh
authored andcommitted
Feature/build timeout (#30)
* (Feature) Build Timeout * Adds the `build_timeout` variable - How long in minutes, from 5 to 480 (8 hours), for AWS CodeBuild to wait until timing out any related build that does not get marked as completed. * Defaults to 60 as per terraform docs - https://www.terraform.io/docs/providers/aws/r/codebuild_project.html#build_timeout * (Chore) Generate README * Adds `build_timeout` documentation
1 parent 1ad718e commit a761530

File tree

5 files changed

+15
-4
lines changed

5 files changed

+15
-4
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ module "build" {
5454
# https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-available.html
5555
build_image = "aws/codebuild/docker:1.12.1"
5656
build_compute_type = "BUILD_GENERAL1_SMALL"
57+
build_timeout = "60"
5758
5859
# These attributes are optional, used as ENV variables when building Docker images and pushing them to ECR
5960
# For more info:
@@ -122,6 +123,7 @@ Available targets:
122123
| aws_region | (Optional) AWS Region, e.g. us-east-1. Used as CodeBuild ENV variable when building Docker images. For more info: http://docs.aws.amazon.com/codebuild/latest/userguide/sample-docker.html | string | `` | no |
123124
| build_compute_type | Instance type of the build instance | string | `BUILD_GENERAL1_SMALL` | no |
124125
| build_image | Docker image for build environment, e.g. 'aws/codebuild/docker:1.12.1' or 'aws/codebuild/eb-nodejs-6.10.0-amazonlinux-64:4.0.0'. For more info: http://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref.html | string | `aws/codebuild/docker:1.12.1` | no |
126+
| build_timeout | How long in minutes, from 5 to 480 (8 hours), for AWS CodeBuild to wait until timing out any related build that does not get marked as completed. | string | `60` | no |
125127
| buildspec | Optional buildspec declaration to use for building the project | string | `` | no |
126128
| cache_bucket_suffix_enabled | The cache bucket generates a random 13 character string to generate a unique bucket name. If set to false it uses terraform-null-label's id value | string | `true` | no |
127129
| cache_enabled | If cache_enabled is true, create an S3 bucket for storing codebuild cache inside | string | `true` | no |
@@ -229,7 +231,7 @@ In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow.
229231

230232
## Copyright
231233

232-
Copyright © 2017-2018 [Cloud Posse, LLC](https://cpco.io/copyright)
234+
Copyright © 2017-2019 [Cloud Posse, LLC](https://cpco.io/copyright)
233235

234236

235237

README.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ usage: |-
6666
# https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-available.html
6767
build_image = "aws/codebuild/docker:1.12.1"
6868
build_compute_type = "BUILD_GENERAL1_SMALL"
69+
build_timeout = "60"
6970
7071
# These attributes are optional, used as ENV variables when building Docker images and pushing them to ECR
7172
# For more info:

docs/terraform.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
| aws_region | (Optional) AWS Region, e.g. us-east-1. Used as CodeBuild ENV variable when building Docker images. For more info: http://docs.aws.amazon.com/codebuild/latest/userguide/sample-docker.html | string | `` | no |
1010
| build_compute_type | Instance type of the build instance | string | `BUILD_GENERAL1_SMALL` | no |
1111
| build_image | Docker image for build environment, e.g. 'aws/codebuild/docker:1.12.1' or 'aws/codebuild/eb-nodejs-6.10.0-amazonlinux-64:4.0.0'. For more info: http://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref.html | string | `aws/codebuild/docker:1.12.1` | no |
12+
| build_timeout | How long in minutes, from 5 to 480 (8 hours), for AWS CodeBuild to wait until timing out any related build that does not get marked as completed. | string | `60` | no |
1213
| buildspec | Optional buildspec declaration to use for building the project | string | `` | no |
1314
| cache_bucket_suffix_enabled | The cache bucket generates a random 13 character string to generate a unique bucket name. If set to false it uses terraform-null-label's id value | string | `true` | no |
1415
| cache_enabled | If cache_enabled is true, create an S3 bucket for storing codebuild cache inside | string | `true` | no |

main.tf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,10 @@ resource "aws_iam_role_policy_attachment" "default_cache_bucket" {
158158
}
159159

160160
resource "aws_codebuild_project" "default" {
161-
count = "${var.enabled == "true" ? 1 : 0}"
162-
name = "${module.label.id}"
163-
service_role = "${aws_iam_role.default.arn}"
161+
count = "${var.enabled == "true" ? 1 : 0}"
162+
name = "${module.label.id}"
163+
service_role = "${aws_iam_role.default.arn}"
164+
build_timeout = "${var.build_timeout}"
164165

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

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ variable "build_compute_type" {
6363
description = "Instance type of the build instance"
6464
}
6565

66+
variable "build_timeout" {
67+
type = "string"
68+
default = "60"
69+
description = "How long in minutes, from 5 to 480 (8 hours), for AWS CodeBuild to wait until timing out any related build that does not get marked as completed."
70+
}
71+
6672
variable "buildspec" {
6773
type = "string"
6874
default = ""

0 commit comments

Comments
 (0)