Skip to content

Commit 92cc9af

Browse files
authored
Add badge URL (#31)
* Add badge URL * add badge_enabled * Default false
1 parent a761530 commit 92cc9af

File tree

5 files changed

+16
-2
lines changed

5 files changed

+16
-2
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ Available targets:
112112
lint Lint terraform code
113113
114114
```
115-
116115
## Inputs
117116

118117
| Name | Description | Type | Default | Required |
@@ -121,6 +120,7 @@ Available targets:
121120
| attributes | Additional attributes (e.g. `policy` or `role`) | list | `<list>` | no |
122121
| aws_account_id | (Optional) AWS Account ID. 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 |
123122
| 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 |
123+
| badge_enabled | Generates a publicly-accessible URL for the projects build badge. Available as badge_url attribute when enabled. | string | `false` | no |
124124
| build_compute_type | Instance type of the build instance | string | `BUILD_GENERAL1_SMALL` | no |
125125
| 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 |
126126
| 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 |
@@ -146,6 +146,7 @@ Available targets:
146146

147147
| Name | Description |
148148
|------|-------------|
149+
| badge_url | The URL of the build badge when badge_enabled is enabled |
149150
| cache_bucket_name | Cache S3 bucket name |
150151
| project_id | Project ID |
151152
| project_name | Project name |

docs/terraform.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
## Inputs
32

43
| Name | Description | Type | Default | Required |
@@ -7,6 +6,7 @@
76
| attributes | Additional attributes (e.g. `policy` or `role`) | list | `<list>` | no |
87
| aws_account_id | (Optional) AWS Account ID. 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 |
98
| 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 |
9+
| badge_enabled | Generates a publicly-accessible URL for the projects build badge. Available as badge_url attribute when enabled. | string | `false` | 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 |
1212
| 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 |
@@ -32,6 +32,7 @@
3232

3333
| Name | Description |
3434
|------|-------------|
35+
| badge_url | The URL of the build badge when badge_enabled is enabled |
3536
| cache_bucket_name | Cache S3 bucket name |
3637
| project_id | Project ID |
3738
| project_name | Project name |

main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ resource "aws_codebuild_project" "default" {
161161
count = "${var.enabled == "true" ? 1 : 0}"
162162
name = "${module.label.id}"
163163
service_role = "${aws_iam_role.default.arn}"
164+
badge_enabled = "${var.badge_enabled}"
164165
build_timeout = "${var.build_timeout}"
165166

166167
artifacts {

outputs.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,8 @@ output "cache_bucket_name" {
1717
description = "Cache S3 bucket name"
1818
value = "${var.enabled == "true" && var.cache_enabled == "true" ? join("", aws_s3_bucket.cache_bucket.*.bucket) : "UNSET" }"
1919
}
20+
21+
output "badge_url" {
22+
description = "The URL of the build badge when badge_enabled is enabled"
23+
value = "${join("", aws_codebuild_project.default.*.badge_url)}"
24+
}

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ variable "cache_bucket_suffix_enabled" {
5151
description = "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"
5252
}
5353

54+
variable "badge_enabled" {
55+
type = "string"
56+
default = "false"
57+
description = "Generates a publicly-accessible URL for the projects build badge. Available as badge_url attribute when enabled."
58+
}
59+
5460
variable "build_image" {
5561
type = "string"
5662
default = "aws/codebuild/docker:1.12.1"

0 commit comments

Comments
 (0)