Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: upgrade module to support Terraform 0.12.x #24

Merged
merged 3 commits into from
Mar 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ jobs:
- go/save-cache
- run:
command: |
wget --quiet https://releases.hashicorp.com/terraform/0.11.14/terraform_0.11.14_linux_amd64.zip
sudo unzip terraform_0.11.14_linux_amd64.zip -d /usr/local/bin
wget --quiet https://releases.hashicorp.com/terraform/0.12.23/terraform_0.12.23_linux_amd64.zip
sudo unzip terraform_0.12.23_linux_amd64.zip -d /usr/local/bin
name: Install Terraform
- go/test
release:
Expand Down
99 changes: 53 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,55 +102,62 @@ Invoking the commands defined below creates an ECS task definition with the foll
By default, this module creates a task definition with a single container definition. To create a task definition with multiple container definitions, refer to the documentation of the [`merge`](modules/merge) module.

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Providers

| Name | Version |
|------|---------|
| aws | n/a |
| template | n/a |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| command | The command that is passed to the container | list | `[]` | no |
| cpu | The number of cpu units reserved for the container | string | `"0"` | no |
| disableNetworking | When this parameter is true, networking is disabled within the container | string | `"false"` | no |
| dnsSearchDomains | A list of DNS search domains that are presented to the container | list | `[]` | no |
| dnsServers | A list of DNS servers that are presented to the container | list | `[]` | no |
| dockerLabels | A key/value map of labels to add to the container | map | `{}` | no |
| dockerSecurityOptions | A list of strings to provide custom labels for SELinux and AppArmor multi-level security systems | list | `[]` | no |
| entryPoint | The entry point that is passed to the container | list | `[]` | no |
| environment | The environment variables to pass to a container | list | `[]` | no |
| essential | If the essential parameter of a container is marked as true, and that container fails or stops for any reason, all other containers that are part of the task are stopped | string | `"true"` | no |
| execution\_role\_arn | The Amazon Resource Name (ARN) of the task execution role that the Amazon ECS container agent and the Docker daemon can assume | string | `""` | no |
| extraHosts | A list of hostnames and IP address mappings to append to the /etc/hosts file on the container | list | `[]` | no |
| family | You must specify a family for a task definition, which allows you to track multiple versions of the same task definition | string | n/a | yes |
| healthCheck | The health check command and associated configuration parameters for the container | map | `{}` | no |
| hostname | The hostname to use for your container | string | `""` | no |
| image | The image used to start a container | string | `""` | no |
| interactive | When this parameter is true, this allows you to deploy containerized applications that require stdin or a tty to be allocated | string | `"false"` | no |
| ipc\_mode | The IPC resource namespace to use for the containers in the task | string | `"host"` | no |
| links | The link parameter allows containers to communicate with each other without the need for port mappings | list | `[]` | no |
| linuxParameters | Linux-specific modifications that are applied to the container, such as Linux KernelCapabilities | map | `{}` | no |
| logConfiguration | The log configuration specification for the container | map | `{}` | no |
| memory | The hard limit (in MiB) of memory to present to the container | string | `"0"` | no |
| memoryReservation | The soft limit (in MiB) of memory to reserve for the container | string | `"0"` | no |
| mountPoints | The mount points for data volumes in your container | list | `[]` | no |
| name | The name of a container | string | `""` | no |
| network\_mode | The Docker networking mode to use for the containers in the task | string | `"bridge"` | no |
| pid\_mode | The process namespace to use for the containers in the task | string | `"host"` | no |
| placement\_constraints | An array of placement constraint objects to use for the task | list | `[]` | no |
| portMappings | The list of port mappings for the container | list | `[]` | no |
| privileged | When this parameter is true, the container is given elevated privileges on the host container instance (similar to the root user) | string | `"false"` | no |
| pseudoTerminal | When this parameter is true, a TTY is allocated | string | `"false"` | no |
| readonlyRootFilesystem | When this parameter is true, the container is given read-only access to its root file system | string | `"false"` | no |
| register\_task\_definition | Registers a new task definition from the supplied family and containerDefinitions | string | `"true"` | no |
| repositoryCredentials | The private repository authentication credentials to use | map | `{}` | no |
| requires\_compatibilities | The launch type required by the task | list | `[]` | no |
| resourceRequirements | The type and amount of a resource to assign to a container | list | `[]` | no |
| secrets | The secrets to pass to the container | list | `[]` | no |
| systemControls | A list of namespaced kernel parameters to set in the container | list | `[]` | no |
| tags | The metadata that you apply to the task definition to help you categorize and organize them | map | `{}` | no |
| task\_role\_arn | The short name or full Amazon Resource Name (ARN) of the IAM role that containers in this task can assume | string | `""` | no |
| ulimits | A list of ulimits to set in the container | list | `[]` | no |
| user | The user name to use inside the container | string | `""` | no |
| volumes | A list of volume definitions in JSON format that containers in your task may use | list | `[]` | no |
| volumesFrom | Data volumes to mount from another container | list | `[]` | no |
| workingDirectory | The working directory in which to run commands inside the container | string | `""` | no |
|------|-------------|------|---------|:-----:|
| command | The command that is passed to the container | `list(string)` | `[]` | no |
| cpu | The number of cpu units reserved for the container | `number` | `0` | no |
| disableNetworking | When this parameter is true, networking is disabled within the container | `bool` | `false` | no |
| dnsSearchDomains | A list of DNS search domains that are presented to the container | `list(string)` | `[]` | no |
| dnsServers | A list of DNS servers that are presented to the container | `list(string)` | `[]` | no |
| dockerLabels | A key/value map of labels to add to the container | `map(string)` | `{}` | no |
| dockerSecurityOptions | A list of strings to provide custom labels for SELinux and AppArmor multi-level security systems | `list(string)` | `[]` | no |
| entryPoint | The entry point that is passed to the container | `list(string)` | `[]` | no |
| environment | The environment variables to pass to a container | `list(map(string))` | `[]` | no |
| essential | If the essential parameter of a container is marked as true, and that container fails or stops for any reason, all other containers that are part of the task are stopped | `bool` | `true` | no |
| execution\_role\_arn | The Amazon Resource Name (ARN) of the task execution role that the Amazon ECS container agent and the Docker daemon can assume | `string` | `""` | no |
| extraHosts | A list of hostnames and IP address mappings to append to the /etc/hosts file on the container | `list(string)` | `[]` | no |
| family | You must specify a family for a task definition, which allows you to track multiple versions of the same task definition | `any` | n/a | yes |
| healthCheck | The health check command and associated configuration parameters for the container | `any` | `{}` | no |
| hostname | The hostname to use for your container | `string` | `""` | no |
| image | The image used to start a container | `string` | `""` | no |
| interactive | When this parameter is true, this allows you to deploy containerized applications that require stdin or a tty to be allocated | `bool` | `false` | no |
| ipc\_mode | The IPC resource namespace to use for the containers in the task | `string` | `"host"` | no |
| links | The link parameter allows containers to communicate with each other without the need for port mappings | `list(string)` | `[]` | no |
| linuxParameters | Linux-specific modifications that are applied to the container, such as Linux KernelCapabilities | `any` | `{}` | no |
| logConfiguration | The log configuration specification for the container | `map(string)` | `{}` | no |
| memory | The hard limit (in MiB) of memory to present to the container | `number` | `0` | no |
| memoryReservation | The soft limit (in MiB) of memory to reserve for the container | `number` | `0` | no |
| mountPoints | The mount points for data volumes in your container | `list(any)` | `[]` | no |
| name | The name of a container | `string` | `""` | no |
| network\_mode | The Docker networking mode to use for the containers in the task | `string` | `"bridge"` | no |
| pid\_mode | The process namespace to use for the containers in the task | `string` | `"host"` | no |
| placement\_constraints | An array of placement constraint objects to use for the task | `list(string)` | `[]` | no |
| portMappings | The list of port mappings for the container | `list(any)` | `[]` | no |
| privileged | When this parameter is true, the container is given elevated privileges on the host container instance (similar to the root user) | `bool` | `false` | no |
| pseudoTerminal | When this parameter is true, a TTY is allocated | `bool` | `false` | no |
| readonlyRootFilesystem | When this parameter is true, the container is given read-only access to its root file system | `bool` | `false` | no |
| register\_task\_definition | Registers a new task definition from the supplied family and containerDefinitions | `bool` | `true` | no |
| repositoryCredentials | The private repository authentication credentials to use | `map(string)` | `{}` | no |
| requires\_compatibilities | The launch type required by the task | `list(string)` | `[]` | no |
| resourceRequirements | The type and amount of a resource to assign to a container | `list(string)` | `[]` | no |
| secrets | The secrets to pass to the container | `list(string)` | `[]` | no |
| systemControls | A list of namespaced kernel parameters to set in the container | `list(string)` | `[]` | no |
| tags | The metadata that you apply to the task definition to help you categorize and organize them | `map(string)` | `{}` | no |
| task\_role\_arn | The short name or full Amazon Resource Name (ARN) of the IAM role that containers in this task can assume | `string` | `""` | no |
| ulimits | A list of ulimits to set in the container | `list(any)` | `[]` | no |
| user | The user name to use inside the container | `string` | `""` | no |
| volumes | A list of volume definitions in JSON format that containers in your task may use | `list(any)` | `[]` | no |
| volumesFrom | Data volumes to mount from another container | `list(string)` | `[]` | no |
| workingDirectory | The working directory in which to run commands inside the container | `string` | `""` | no |

## Outputs

Expand Down
9 changes: 6 additions & 3 deletions examples/ecs_update_service.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
#
# $ terraform taint null_resource.update-service

provider "aws" {}
provider "aws" {
region = "us-east-1"
version = "~> 2.0"
}

module "mongo-task-definition" {
source = "github.com/mongodb/terraform-aws-ecs-task-definition"
Expand All @@ -28,12 +31,12 @@ module "mongo-task-definition" {
resource "aws_ecs_service" "mongo" {
cluster = "mongo"
name = "mongo"
task_definition = "${module.mongo-task-definition.arn}"
task_definition = module.mongo-task-definition.arn
}

resource "null_resource" "update-service" {
triggers = {
arn = "${module.mongo-task-definition.arn}"
arn = module.mongo-task-definition.arn
}

provisioner "local-exec" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ module "merged" {
source = "../../modules/merge"

container_definitions = [
"${module.mongodb.container_definitions}",
"${module.redis.container_definitions}",
module.mongodb.container_definitions,
module.redis.container_definitions,
]
}

resource "aws_ecs_task_definition" "ecs_task_definition" {
container_definitions = "${module.merged.container_definitions}"
container_definitions = module.merged.container_definitions
family = "app"
}
Loading