From 69fd843ac15d96c8e74867da19920a3ee3b2d7da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Sodr=C3=A9?= Date: Tue, 20 Jul 2021 22:22:37 -0400 Subject: [PATCH 1/2] Remove manual S3 copy stage --- main.tf | 38 -------------------------------------- outputs.tf | 1 - variables.tf | 6 ------ 3 files changed, 45 deletions(-) diff --git a/main.tf b/main.tf index 3e32093..5d421f7 100644 --- a/main.tf +++ b/main.tf @@ -9,37 +9,6 @@ module "volume_label" { label_order = ["name"] } -module "copy_from_s3" { - source = "git::https://github.com/cloudposse/terraform-aws-ecs-container-definition.git?ref=tags/0.57.0" - container_name = "copy_from_s3" - container_image = var.awscli_image - essential = false - - user = var.user - - entrypoint = [ - "/bin/sh" - ] - command = [ - "-c", - join(";", [ - "set -e", - "aws s3 sync s3://${var.bucket_id}/${local.key_prefix}/${module.volume_label.id}/ /srv/data", - "chown -R ${var.user} /srv/data", - ]) - ] - - mount_points = [ - { - containerPath = "/srv/data" - sourceVolume = module.volume_label.id - readOnly = false - } - ] - - log_configuration = var.log_configuration -} - # TODO: Implement a health check # TODO: Support multiple volumes module "mobius3" { @@ -48,13 +17,6 @@ module "mobius3" { container_image = var.mobius3_image essential = true - container_depends_on = [ - { - containerName = module.copy_from_s3.json_map_object["name"] - condition = "SUCCESS" - }, - ] - user = var.user command = [ diff --git a/outputs.tf b/outputs.tf index 3dc9b63..65a8afb 100644 --- a/outputs.tf +++ b/outputs.tf @@ -13,7 +13,6 @@ output "container_depends_on_list" { output "json_map_objects" { value = [ - module.copy_from_s3.json_map_object, module.mobius3.json_map_object ] } diff --git a/variables.tf b/variables.tf index df8fb50..d685497 100644 --- a/variables.tf +++ b/variables.tf @@ -20,12 +20,6 @@ variable "user" { default = "0:0" } -variable "awscli_image" { - description = "The AWSCLI Compatible Image" - type = string - default = "docker.io/amazon/aws-cli:2.0.52" -} - variable "mobius3_image" { description = "The Mobius3 Image for S3<->FS synchronization" type = string From 11259f8dc61087f74e536b7effef664ba1eeff9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Sodr=C3=A9?= Date: Tue, 20 Jul 2021 22:29:23 -0400 Subject: [PATCH 2/2] Update documentation --- README.md | 47 ++++++++++++++++++++++++++--------------------- docs/terraform.md | 41 ++++++++++++++++++++++++----------------- 2 files changed, 50 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index 5fc2a54..91a049a 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ + # terraform-aws-mobius3 [![Latest Release](https://img.shields.io/github/release/zeroae/terraform-aws-mobius3.svg)](https://github.com/zeroae/terraform-aws-mobius3/releases/latest) @@ -29,7 +30,6 @@ The `terraform-aws-mobius3` module creates the a container definition that syncs an ECS task volumes to S3. - --- This project is part of our comprehensive ["SweetOps"](https://cpco.io/sweetops) approach towards DevOps. @@ -60,7 +60,6 @@ We literally have [*hundreds of terraform modules*][terraform_modules] that are - ## Security & Compliance [](https://bridgecrew.io/) Security scanning is graciously provided by Bridgecrew. Bridgecrew is the leading fully hosted, cloud-native solution providing continuous Terraform security and compliance. @@ -133,36 +132,43 @@ Available targets: | Name | Version | |------|---------| -| terraform | >= 0.12.0, < 0.14.0 | -| local | ~> 1.2 | -| random | ~> 2.2 | +| [terraform](#requirement\_terraform) | >= 0.13 | ## Providers -No provider. +No providers. + +## Modules + +| Name | Source | Version | +|------|--------|---------| +| [mobius3](#module\_mobius3) | git::https://github.com/cloudposse/terraform-aws-ecs-container-definition.git | tags/0.57.0 | +| [volume\_label](#module\_volume\_label) | git::https://github.com/cloudposse/terraform-null-label.git | tags/0.24.1 | + +## Resources + +No resources. ## Inputs | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| -| awscli\_image | The AWSCLI Compatible Image | `string` | `"docker.io/amazon/aws-cli:2.0.52"` | no | -| bucket\_id | Bucket Name (aka ID) | `any` | n/a | yes | -| bucket\_key\_prefix | The key prefix to use for the bucket objects. | `any` | n/a | yes | -| bucket\_region | Bucket Region | `any` | n/a | yes | -| log\_configuration | Log configuration options to send to a custom log driver for the container. For more details, see https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_LogConfiguration.html | `any` | `null` | no | -| mobius3\_image | The Mobius3 Image for S3<->FS synchronization | `string` | `"ghcr.io/zeroae/terraform-aws-mobius3:0.0.34"` | no | -| user | The user that owns the volume. Can be any of these formats: uid, uid:gid. The default is (0:0). | `string` | `"0:0"` | no | -| volume\_name | The volume name. | `string` | `"data"` | no | +| [bucket\_id](#input\_bucket\_id) | Bucket Name (aka ID) | `any` | n/a | yes | +| [bucket\_key\_prefix](#input\_bucket\_key\_prefix) | The key prefix to use for the bucket objects. | `any` | n/a | yes | +| [bucket\_region](#input\_bucket\_region) | Bucket Region | `any` | n/a | yes | +| [log\_configuration](#input\_log\_configuration) | Log configuration options to send to a custom log driver for the container. For more details, see https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_LogConfiguration.html | `any` | `null` | no | +| [mobius3\_image](#input\_mobius3\_image) | The Mobius3 Image for S3<->FS synchronization | `string` | `"ghcr.io/zeroae/terraform-aws-mobius3:0.0.34"` | no | +| [user](#input\_user) | The user that owns the volume. Can be any of these formats: uid, uid:gid. The default is (0:0). | `string` | `"0:0"` | no | +| [volume\_name](#input\_volume\_name) | The volume name. | `string` | `"data"` | no | ## Outputs | Name | Description | |------|-------------| -| container\_depends\_on | n/a | -| container\_depends\_on\_list | n/a | -| json\_map\_objects | n/a | -| source\_volume | The volume name to use in container definition mount point | - +| [container\_depends\_on](#output\_container\_depends\_on) | n/a | +| [container\_depends\_on\_list](#output\_container\_depends\_on\_list) | n/a | +| [json\_map\_objects](#output\_json\_map\_objects) | n/a | +| [source\_volume](#output\_source\_volume) | The volume name to use in container definition mount point | @@ -174,6 +180,7 @@ Like this project? Please give it a ★ on [our GitHub](https://github.com/zeroa Are you using this project or any of our other projects? Consider [leaving a testimonial][testimonial]. =) + ## Related Projects Check out these related projects. @@ -182,8 +189,6 @@ Check out these related projects. - [terraform-null-label](https://github.com/cloudposse/terraform-null-label) - Terraform module designed to generate consistent names and tags for resources. Use terraform-null-label to implement a strict naming convention. - - ## References For additional context, refer to some of these links. diff --git a/docs/terraform.md b/docs/terraform.md index e76a311..995cfca 100644 --- a/docs/terraform.md +++ b/docs/terraform.md @@ -3,34 +3,41 @@ | Name | Version | |------|---------| -| terraform | >= 0.12.0, < 0.14.0 | -| local | ~> 1.2 | -| random | ~> 2.2 | +| [terraform](#requirement\_terraform) | >= 0.13 | ## Providers -No provider. +No providers. + +## Modules + +| Name | Source | Version | +|------|--------|---------| +| [mobius3](#module\_mobius3) | git::https://github.com/cloudposse/terraform-aws-ecs-container-definition.git | tags/0.57.0 | +| [volume\_label](#module\_volume\_label) | git::https://github.com/cloudposse/terraform-null-label.git | tags/0.24.1 | + +## Resources + +No resources. ## Inputs | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| -| awscli\_image | The AWSCLI Compatible Image | `string` | `"docker.io/amazon/aws-cli:2.0.52"` | no | -| bucket\_id | Bucket Name (aka ID) | `any` | n/a | yes | -| bucket\_key\_prefix | The key prefix to use for the bucket objects. | `any` | n/a | yes | -| bucket\_region | Bucket Region | `any` | n/a | yes | -| log\_configuration | Log configuration options to send to a custom log driver for the container. For more details, see https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_LogConfiguration.html | `any` | `null` | no | -| mobius3\_image | The Mobius3 Image for S3<->FS synchronization | `string` | `"ghcr.io/zeroae/terraform-aws-mobius3:0.0.34"` | no | -| user | The user that owns the volume. Can be any of these formats: uid, uid:gid. The default is (0:0). | `string` | `"0:0"` | no | -| volume\_name | The volume name. | `string` | `"data"` | no | +| [bucket\_id](#input\_bucket\_id) | Bucket Name (aka ID) | `any` | n/a | yes | +| [bucket\_key\_prefix](#input\_bucket\_key\_prefix) | The key prefix to use for the bucket objects. | `any` | n/a | yes | +| [bucket\_region](#input\_bucket\_region) | Bucket Region | `any` | n/a | yes | +| [log\_configuration](#input\_log\_configuration) | Log configuration options to send to a custom log driver for the container. For more details, see https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_LogConfiguration.html | `any` | `null` | no | +| [mobius3\_image](#input\_mobius3\_image) | The Mobius3 Image for S3<->FS synchronization | `string` | `"ghcr.io/zeroae/terraform-aws-mobius3:0.0.34"` | no | +| [user](#input\_user) | The user that owns the volume. Can be any of these formats: uid, uid:gid. The default is (0:0). | `string` | `"0:0"` | no | +| [volume\_name](#input\_volume\_name) | The volume name. | `string` | `"data"` | no | ## Outputs | Name | Description | |------|-------------| -| container\_depends\_on | n/a | -| container\_depends\_on\_list | n/a | -| json\_map\_objects | n/a | -| source\_volume | The volume name to use in container definition mount point | - +| [container\_depends\_on](#output\_container\_depends\_on) | n/a | +| [container\_depends\_on\_list](#output\_container\_depends\_on\_list) | n/a | +| [json\_map\_objects](#output\_json\_map\_objects) | n/a | +| [source\_volume](#output\_source\_volume) | The volume name to use in container definition mount point |