Skip to content

Commit c71d0a6

Browse files
authored
feat: Enable configuration of Docker labels (#303)
* feat: Add docker_labels Allow the user to define a list of Docker labels without providing the entire task definition. * fix(ci): Update `cloudposse/dynamic-subnets/aws` to the most recent version AWS provider v6 deprecated `vpc = true` for the EIP resource * fix(ci): Ensure unique S3 bucket names 1. Bucket names now include a timestamp (10 digits) to ensure they're always unique (previously it was a random number between 0 and 999, which increased the risk of a name collision) 2. `rand.Seed` is deprecated, so it was removed. As of Go 1.20, there is no reason to call Seed with a random value
1 parent f22aa23 commit c71d0a6

File tree

9 files changed

+17
-10
lines changed

9 files changed

+17
-10
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@
1212
# Build Harness
1313
.build-harness
1414
build-harness/
15+
16+
# Atmos
17+
.atmos

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ module "default_backend_web_app" {
246246
| <a name="input_deployment_minimum_healthy_percent"></a> [deployment\_minimum\_healthy\_percent](#input\_deployment\_minimum\_healthy\_percent) | The lower limit (as a percentage of `desired_count`) of the number of tasks that must remain running and healthy in a service during a deployment | `number` | `100` | no |
247247
| <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 |
248248
| <a name="input_desired_count"></a> [desired\_count](#input\_desired\_count) | The desired number of tasks to start with. Set this to 0 if using DAEMON Service type. (FARGATE does not suppoert DAEMON Service type) | `number` | `1` | no |
249+
| <a name="input_docker_labels"></a> [docker\_labels](#input\_docker\_labels) | Map of Docker labels to assign to the container | `map(string)` | `null` | no |
249250
| <a name="input_ecr_enabled"></a> [ecr\_enabled](#input\_ecr\_enabled) | A boolean to enable/disable AWS ECR | `bool` | `true` | no |
250251
| <a name="input_ecr_image_tag_mutability"></a> [ecr\_image\_tag\_mutability](#input\_ecr\_image\_tag\_mutability) | The tag mutability setting for the ecr repository. Must be one of: `MUTABLE` or `IMMUTABLE` | `string` | `"IMMUTABLE"` | no |
251252
| <a name="input_ecr_scan_images_on_push"></a> [ecr\_scan\_images\_on\_push](#input\_ecr\_scan\_images\_on\_push) | Indicates whether images are scanned after being pushed to the repository (true) or not (false) | `bool` | `false` | no |

examples/complete/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module "vpc" {
1818

1919
module "subnets" {
2020
source = "cloudposse/dynamic-subnets/aws"
21-
version = "2.3.0"
21+
version = "2.4.2"
2222
availability_zones = var.availability_zones
2323
vpc_id = module.vpc.vpc_id
2424
igw_id = [module.vpc.igw_id]

examples/with_cognito_authentication/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ locals {
2020

2121
module "subnets" {
2222
source = "cloudposse/dynamic-subnets/aws"
23-
version = "2.3.0"
23+
version = "2.4.2"
2424
availability_zones = local.availability_zones
2525
vpc_id = module.vpc.vpc_id
2626
igw_id = [module.vpc.igw_id]

examples/with_google_oidc_authentication/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ locals {
2020

2121
module "subnets" {
2222
source = "cloudposse/dynamic-subnets/aws"
23-
version = "2.3.0"
23+
version = "2.4.2"
2424
availability_zones = local.availability_zones
2525
vpc_id = module.vpc.vpc_id
2626
igw_id = [module.vpc.igw_id]

examples/without_authentication/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ locals {
2020

2121
module "subnets" {
2222
source = "cloudposse/dynamic-subnets/aws"
23-
version = "2.3.0"
23+
version = "2.4.2"
2424
availability_zones = local.availability_zones
2525
vpc_id = module.vpc.vpc_id
2626
igw_id = [module.vpc.igw_id]

main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ module "container_definition" {
8181
container_memory = var.container_memory
8282
container_memory_reservation = var.container_memory_reservation
8383
container_cpu = var.container_cpu
84+
docker_labels = var.docker_labels
8485
start_timeout = var.container_start_timeout
8586
stop_timeout = var.container_stop_timeout
8687
healthcheck = var.healthcheck

test/src/examples_complete_test.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@ package test
22

33
import (
44
"encoding/json"
5+
"fmt"
56
"testing"
6-
7-
"math/rand"
8-
"strconv"
97
"time"
108

119
"github.com/gruntwork-io/terratest/modules/terraform"
@@ -16,9 +14,7 @@ import (
1614
func TestExamplesComplete(t *testing.T) {
1715
t.Parallel()
1816

19-
rand.Seed(time.Now().UnixNano())
20-
21-
attributes := []string{strconv.Itoa(rand.Intn(1000))}
17+
attributes := []string{fmt.Sprintf("%d", time.Now().Unix())}
2218

2319
// We need to create the ALB first because terraform does not wwait for it to be in the ready state before creating ECS target group
2420
terraformOptions := &terraform.Options{

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ variable "container_memory" {
9696
default = 512
9797
}
9898

99+
variable "docker_labels" {
100+
type = map(string)
101+
description = "Map of Docker labels to assign to the container"
102+
default = null
103+
}
104+
99105
variable "container_start_timeout" {
100106
type = number
101107
description = "Time duration (in seconds) to wait before giving up on resolving dependencies for a container"

0 commit comments

Comments
 (0)