Skip to content

Commit cdbd219

Browse files
gui-donGuillaume DONVALcloudpossebotnitrocodeSweetOps
authored
Add description and concurrent_build_limit to aws_codebuild_project (#89)
* feat: allows user to input a description for the codebuild project * feat: allows user to input a description for the codebuild project * feat: allows user to input a concurrent_build_limit for the codebuild project * Auto Format * fix: integer is number for Terraform * Auto Format * Update variables.tf Co-authored-by: Vladimir <[email protected]> * Auto Format * Update variables.tf * Auto Format Co-authored-by: Guillaume DONVAL <[email protected]> Co-authored-by: cloudpossebot <[email protected]> Co-authored-by: nitrocode <[email protected]> Co-authored-by: Vladimir <[email protected]>
1 parent e1a8e03 commit cdbd219

File tree

5 files changed

+26
-6
lines changed

5 files changed

+26
-6
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,10 @@ Available targets:
218218
| <a name="input_cache_bucket_suffix_enabled"></a> [cache\_bucket\_suffix\_enabled](#input\_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. It only works when cache\_type is 'S3 | `bool` | `true` | no |
219219
| <a name="input_cache_expiration_days"></a> [cache\_expiration\_days](#input\_cache\_expiration\_days) | How many days should the build cache be kept. It only works when cache\_type is 'S3' | `number` | `7` | no |
220220
| <a name="input_cache_type"></a> [cache\_type](#input\_cache\_type) | The type of storage that will be used for the AWS CodeBuild project cache. Valid values: NO\_CACHE, LOCAL, and S3. Defaults to NO\_CACHE. If cache\_type is S3, it will create an S3 bucket for storing codebuild cache inside | `string` | `"NO_CACHE"` | no |
221+
| <a name="input_concurrent_build_limit"></a> [concurrent\_build\_limit](#input\_concurrent\_build\_limit) | Specify a maximum number of concurrent builds for the project. The value specified must be greater than 0 and less than the account concurrent running builds limit. | `number` | `null` | no |
221222
| <a name="input_context"></a> [context](#input\_context) | Single object for setting entire context at once.<br>See description of individual variables for details.<br>Leave string and numeric variables as `null` to use default value.<br>Individual variable settings (non-null) override settings in context object,<br>except for attributes, tags, and additional\_tag\_map, which are merged. | `any` | <pre>{<br> "additional_tag_map": {},<br> "attributes": [],<br> "delimiter": null,<br> "descriptor_formats": {},<br> "enabled": true,<br> "environment": null,<br> "id_length_limit": null,<br> "label_key_case": null,<br> "label_order": [],<br> "label_value_case": null,<br> "labels_as_tags": [<br> "unset"<br> ],<br> "name": null,<br> "namespace": null,<br> "regex_replace_chars": null,<br> "stage": null,<br> "tags": {},<br> "tenant": null<br>}</pre> | no |
222223
| <a name="input_delimiter"></a> [delimiter](#input\_delimiter) | Delimiter to be used between ID elements.<br>Defaults to `-` (hyphen). Set to `""` to use no delimiter at all. | `string` | `null` | no |
224+
| <a name="input_description"></a> [description](#input\_description) | Short description of the CodeBuild project | `string` | `"Managed by Terraform"` | no |
223225
| <a name="input_descriptor_formats"></a> [descriptor\_formats](#input\_descriptor\_formats) | Describe additional descriptors to be output in the `descriptors` output map.<br>Map of maps. Keys are names of descriptors. Values are maps of the form<br>`{<br> format = string<br> labels = list(string)<br>}`<br>(Type is `any` so the map values can later be enhanced to provide additional options.)<br>`format` is a Terraform format string to be passed to the `format()` function.<br>`labels` is a list of labels, in order, to pass to `format()` function.<br>Label values will be normalized before being passed to `format()` so they will be<br>identical to how they appear in `id`.<br>Default is `{}` (`descriptors` output will be empty). | `any` | `{}` | no |
224226
| <a name="input_enabled"></a> [enabled](#input\_enabled) | Set to false to prevent the module from creating any resources | `bool` | `null` | no |
225227
| <a name="input_encryption_enabled"></a> [encryption\_enabled](#input\_encryption\_enabled) | When set to 'true' the resource will have AES256 encryption enabled by default | `bool` | `false` | no |

docs/terraform.md

+2
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,10 @@
6262
| <a name="input_cache_bucket_suffix_enabled"></a> [cache\_bucket\_suffix\_enabled](#input\_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. It only works when cache\_type is 'S3 | `bool` | `true` | no |
6363
| <a name="input_cache_expiration_days"></a> [cache\_expiration\_days](#input\_cache\_expiration\_days) | How many days should the build cache be kept. It only works when cache\_type is 'S3' | `number` | `7` | no |
6464
| <a name="input_cache_type"></a> [cache\_type](#input\_cache\_type) | The type of storage that will be used for the AWS CodeBuild project cache. Valid values: NO\_CACHE, LOCAL, and S3. Defaults to NO\_CACHE. If cache\_type is S3, it will create an S3 bucket for storing codebuild cache inside | `string` | `"NO_CACHE"` | no |
65+
| <a name="input_concurrent_build_limit"></a> [concurrent\_build\_limit](#input\_concurrent\_build\_limit) | Specify a maximum number of concurrent builds for the project. The value specified must be greater than 0 and less than the account concurrent running builds limit. | `number` | `null` | no |
6566
| <a name="input_context"></a> [context](#input\_context) | Single object for setting entire context at once.<br>See description of individual variables for details.<br>Leave string and numeric variables as `null` to use default value.<br>Individual variable settings (non-null) override settings in context object,<br>except for attributes, tags, and additional\_tag\_map, which are merged. | `any` | <pre>{<br> "additional_tag_map": {},<br> "attributes": [],<br> "delimiter": null,<br> "descriptor_formats": {},<br> "enabled": true,<br> "environment": null,<br> "id_length_limit": null,<br> "label_key_case": null,<br> "label_order": [],<br> "label_value_case": null,<br> "labels_as_tags": [<br> "unset"<br> ],<br> "name": null,<br> "namespace": null,<br> "regex_replace_chars": null,<br> "stage": null,<br> "tags": {},<br> "tenant": null<br>}</pre> | no |
6667
| <a name="input_delimiter"></a> [delimiter](#input\_delimiter) | Delimiter to be used between ID elements.<br>Defaults to `-` (hyphen). Set to `""` to use no delimiter at all. | `string` | `null` | no |
68+
| <a name="input_description"></a> [description](#input\_description) | Short description of the CodeBuild project | `string` | `"Managed by Terraform"` | no |
6769
| <a name="input_descriptor_formats"></a> [descriptor\_formats](#input\_descriptor\_formats) | Describe additional descriptors to be output in the `descriptors` output map.<br>Map of maps. Keys are names of descriptors. Values are maps of the form<br>`{<br> format = string<br> labels = list(string)<br>}`<br>(Type is `any` so the map values can later be enhanced to provide additional options.)<br>`format` is a Terraform format string to be passed to the `format()` function.<br>`labels` is a list of labels, in order, to pass to `format()` function.<br>Label values will be normalized before being passed to `format()` so they will be<br>identical to how they appear in `id`.<br>Default is `{}` (`descriptors` output will be empty). | `any` | `{}` | no |
6870
| <a name="input_enabled"></a> [enabled](#input\_enabled) | Set to false to prevent the module from creating any resources | `bool` | `null` | no |
6971
| <a name="input_encryption_enabled"></a> [encryption\_enabled](#input\_encryption\_enabled) | When set to 'true' the resource will have AES256 encryption enabled by default | `bool` | `false` | no |

examples/complete/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ provider "aws" {
44

55
module "codebuild" {
66
source = "../../"
7+
description = "This is my awesome CodeBuild project"
8+
concurrent_build_limit = 10
79
cache_bucket_suffix_enabled = var.cache_bucket_suffix_enabled
810
environment_variables = var.environment_variables
911
cache_expiration_days = var.cache_expiration_days

main.tf

+8-6
Original file line numberDiff line numberDiff line change
@@ -290,12 +290,14 @@ resource "aws_codebuild_source_credential" "authorization" {
290290
}
291291

292292
resource "aws_codebuild_project" "default" {
293-
count = module.this.enabled ? 1 : 0
294-
name = module.this.id
295-
service_role = join("", aws_iam_role.default.*.arn)
296-
badge_enabled = var.badge_enabled
297-
build_timeout = var.build_timeout
298-
source_version = var.source_version != "" ? var.source_version : null
293+
count = module.this.enabled ? 1 : 0
294+
name = module.this.id
295+
description = var.description
296+
concurrent_build_limit = var.concurrent_build_limit
297+
service_role = join("", aws_iam_role.default.*.arn)
298+
badge_enabled = var.badge_enabled
299+
build_timeout = var.build_timeout
300+
source_version = var.source_version != "" ? var.source_version : null
299301
tags = {
300302
for name, value in module.this.tags :
301303
name => value

variables.tf

+12
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,18 @@ variable "environment_variables" {
1616
description = "A list of maps, that contain the keys 'name', 'value', and 'type' to be used as additional environment variables for the build. Valid types are 'PLAINTEXT', 'PARAMETER_STORE', or 'SECRETS_MANAGER'"
1717
}
1818

19+
variable "description" {
20+
type = string
21+
default = "Managed by Terraform"
22+
description = "Short description of the CodeBuild project"
23+
}
24+
25+
variable "concurrent_build_limit" {
26+
type = number
27+
default = null
28+
description = "Specify a maximum number of concurrent builds for the project. The value specified must be greater than 0 and less than the account concurrent running builds limit."
29+
}
30+
1931
variable "cache_expiration_days" {
2032
default = 7
2133
description = "How many days should the build cache be kept. It only works when cache_type is 'S3'"

0 commit comments

Comments
 (0)