Skip to content

Commit 4dba2c8

Browse files
authored
Merge pull request #4 from zeroae/f/remove-awscli
Remove manual S3 copy stage
2 parents b64d377 + 11259f8 commit 4dba2c8

File tree

5 files changed

+50
-83
lines changed

5 files changed

+50
-83
lines changed

README.md

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
<!-- markdownlint-disable -->
23
# 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)
34
<!-- markdownlint-restore -->
@@ -29,7 +30,6 @@
2930

3031
The `terraform-aws-mobius3` module creates the a container definition that syncs an ECS task volumes to S3.
3132

32-
3333
---
3434

3535
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
6060

6161

6262

63-
6463
## Security & Compliance [<img src="https://cloudposse.com/wp-content/uploads/2020/11/bridgecrew.svg" width="250" align="right" />](https://bridgecrew.io/)
6564

6665
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:
133132

134133
| Name | Version |
135134
|------|---------|
136-
| terraform | >= 0.12.0, < 0.14.0 |
137-
| local | ~> 1.2 |
138-
| random | ~> 2.2 |
135+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13 |
139136

140137
## Providers
141138

142-
No provider.
139+
No providers.
140+
141+
## Modules
142+
143+
| Name | Source | Version |
144+
|------|--------|---------|
145+
| <a name="module_mobius3"></a> [mobius3](#module\_mobius3) | git::https://github.com/cloudposse/terraform-aws-ecs-container-definition.git | tags/0.57.0 |
146+
| <a name="module_volume_label"></a> [volume\_label](#module\_volume\_label) | git::https://github.com/cloudposse/terraform-null-label.git | tags/0.24.1 |
147+
148+
## Resources
149+
150+
No resources.
143151

144152
## Inputs
145153

146154
| Name | Description | Type | Default | Required |
147155
|------|-------------|------|---------|:--------:|
148-
| awscli\_image | The AWSCLI Compatible Image | `string` | `"docker.io/amazon/aws-cli:2.0.52"` | no |
149-
| bucket\_id | Bucket Name (aka ID) | `any` | n/a | yes |
150-
| bucket\_key\_prefix | The key prefix to use for the bucket objects. | `any` | n/a | yes |
151-
| bucket\_region | Bucket Region | `any` | n/a | yes |
152-
| 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 |
153-
| mobius3\_image | The Mobius3 Image for S3<->FS synchronization | `string` | `"ghcr.io/zeroae/terraform-aws-mobius3:0.0.34"` | no |
154-
| 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 |
155-
| volume\_name | The volume name. | `string` | `"data"` | no |
156+
| <a name="input_bucket_id"></a> [bucket\_id](#input\_bucket\_id) | Bucket Name (aka ID) | `any` | n/a | yes |
157+
| <a name="input_bucket_key_prefix"></a> [bucket\_key\_prefix](#input\_bucket\_key\_prefix) | The key prefix to use for the bucket objects. | `any` | n/a | yes |
158+
| <a name="input_bucket_region"></a> [bucket\_region](#input\_bucket\_region) | Bucket Region | `any` | n/a | yes |
159+
| <a name="input_log_configuration"></a> [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 |
160+
| <a name="input_mobius3_image"></a> [mobius3\_image](#input\_mobius3\_image) | The Mobius3 Image for S3<->FS synchronization | `string` | `"ghcr.io/zeroae/terraform-aws-mobius3:0.0.34"` | no |
161+
| <a name="input_user"></a> [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 |
162+
| <a name="input_volume_name"></a> [volume\_name](#input\_volume\_name) | The volume name. | `string` | `"data"` | no |
156163

157164
## Outputs
158165

159166
| Name | Description |
160167
|------|-------------|
161-
| container\_depends\_on | n/a |
162-
| container\_depends\_on\_list | n/a |
163-
| json\_map\_objects | n/a |
164-
| source\_volume | The volume name to use in container definition mount point |
165-
168+
| <a name="output_container_depends_on"></a> [container\_depends\_on](#output\_container\_depends\_on) | n/a |
169+
| <a name="output_container_depends_on_list"></a> [container\_depends\_on\_list](#output\_container\_depends\_on\_list) | n/a |
170+
| <a name="output_json_map_objects"></a> [json\_map\_objects](#output\_json\_map\_objects) | n/a |
171+
| <a name="output_source_volume"></a> [source\_volume](#output\_source\_volume) | The volume name to use in container definition mount point |
166172
<!-- markdownlint-restore -->
167173

168174

@@ -174,6 +180,7 @@ Like this project? Please give it a ★ on [our GitHub](https://github.com/zeroa
174180
Are you using this project or any of our other projects? Consider [leaving a testimonial][testimonial]. =)
175181

176182

183+
177184
## Related Projects
178185

179186
Check out these related projects.
@@ -182,8 +189,6 @@ Check out these related projects.
182189
- [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.
183190

184191

185-
186-
187192
## References
188193

189194
For additional context, refer to some of these links.

docs/terraform.md

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,41 @@
33

44
| Name | Version |
55
|------|---------|
6-
| terraform | >= 0.12.0, < 0.14.0 |
7-
| local | ~> 1.2 |
8-
| random | ~> 2.2 |
6+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13 |
97

108
## Providers
119

12-
No provider.
10+
No providers.
11+
12+
## Modules
13+
14+
| Name | Source | Version |
15+
|------|--------|---------|
16+
| <a name="module_mobius3"></a> [mobius3](#module\_mobius3) | git::https://github.com/cloudposse/terraform-aws-ecs-container-definition.git | tags/0.57.0 |
17+
| <a name="module_volume_label"></a> [volume\_label](#module\_volume\_label) | git::https://github.com/cloudposse/terraform-null-label.git | tags/0.24.1 |
18+
19+
## Resources
20+
21+
No resources.
1322

1423
## Inputs
1524

1625
| Name | Description | Type | Default | Required |
1726
|------|-------------|------|---------|:--------:|
18-
| awscli\_image | The AWSCLI Compatible Image | `string` | `"docker.io/amazon/aws-cli:2.0.52"` | no |
19-
| bucket\_id | Bucket Name (aka ID) | `any` | n/a | yes |
20-
| bucket\_key\_prefix | The key prefix to use for the bucket objects. | `any` | n/a | yes |
21-
| bucket\_region | Bucket Region | `any` | n/a | yes |
22-
| 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 |
23-
| mobius3\_image | The Mobius3 Image for S3<->FS synchronization | `string` | `"ghcr.io/zeroae/terraform-aws-mobius3:0.0.34"` | no |
24-
| 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 |
25-
| volume\_name | The volume name. | `string` | `"data"` | no |
27+
| <a name="input_bucket_id"></a> [bucket\_id](#input\_bucket\_id) | Bucket Name (aka ID) | `any` | n/a | yes |
28+
| <a name="input_bucket_key_prefix"></a> [bucket\_key\_prefix](#input\_bucket\_key\_prefix) | The key prefix to use for the bucket objects. | `any` | n/a | yes |
29+
| <a name="input_bucket_region"></a> [bucket\_region](#input\_bucket\_region) | Bucket Region | `any` | n/a | yes |
30+
| <a name="input_log_configuration"></a> [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 |
31+
| <a name="input_mobius3_image"></a> [mobius3\_image](#input\_mobius3\_image) | The Mobius3 Image for S3<->FS synchronization | `string` | `"ghcr.io/zeroae/terraform-aws-mobius3:0.0.34"` | no |
32+
| <a name="input_user"></a> [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 |
33+
| <a name="input_volume_name"></a> [volume\_name](#input\_volume\_name) | The volume name. | `string` | `"data"` | no |
2634

2735
## Outputs
2836

2937
| Name | Description |
3038
|------|-------------|
31-
| container\_depends\_on | n/a |
32-
| container\_depends\_on\_list | n/a |
33-
| json\_map\_objects | n/a |
34-
| source\_volume | The volume name to use in container definition mount point |
35-
39+
| <a name="output_container_depends_on"></a> [container\_depends\_on](#output\_container\_depends\_on) | n/a |
40+
| <a name="output_container_depends_on_list"></a> [container\_depends\_on\_list](#output\_container\_depends\_on\_list) | n/a |
41+
| <a name="output_json_map_objects"></a> [json\_map\_objects](#output\_json\_map\_objects) | n/a |
42+
| <a name="output_source_volume"></a> [source\_volume](#output\_source\_volume) | The volume name to use in container definition mount point |
3643
<!-- markdownlint-restore -->

main.tf

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -9,37 +9,6 @@ module "volume_label" {
99
label_order = ["name"]
1010
}
1111

12-
module "copy_from_s3" {
13-
source = "git::https://github.com/cloudposse/terraform-aws-ecs-container-definition.git?ref=tags/0.57.0"
14-
container_name = "copy_from_s3"
15-
container_image = var.awscli_image
16-
essential = false
17-
18-
user = var.user
19-
20-
entrypoint = [
21-
"/bin/sh"
22-
]
23-
command = [
24-
"-c",
25-
join(";", [
26-
"set -e",
27-
"aws s3 sync s3://${var.bucket_id}/${local.key_prefix}/${module.volume_label.id}/ /srv/data",
28-
"chown -R ${var.user} /srv/data",
29-
])
30-
]
31-
32-
mount_points = [
33-
{
34-
containerPath = "/srv/data"
35-
sourceVolume = module.volume_label.id
36-
readOnly = false
37-
}
38-
]
39-
40-
log_configuration = var.log_configuration
41-
}
42-
4312
# TODO: Implement a health check
4413
# TODO: Support multiple volumes
4514
module "mobius3" {
@@ -48,13 +17,6 @@ module "mobius3" {
4817
container_image = var.mobius3_image
4918
essential = true
5019

51-
container_depends_on = [
52-
{
53-
containerName = module.copy_from_s3.json_map_object["name"]
54-
condition = "SUCCESS"
55-
},
56-
]
57-
5820
user = var.user
5921

6022
command = [

outputs.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ output "container_depends_on_list" {
1313

1414
output "json_map_objects" {
1515
value = [
16-
module.copy_from_s3.json_map_object,
1716
module.mobius3.json_map_object
1817
]
1918
}

variables.tf

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,6 @@ variable "user" {
2020
default = "0:0"
2121
}
2222

23-
variable "awscli_image" {
24-
description = "The AWSCLI Compatible Image"
25-
type = string
26-
default = "docker.io/amazon/aws-cli:2.0.52"
27-
}
28-
2923
variable "mobius3_image" {
3024
description = "The Mobius3 Image for S3<->FS synchronization"
3125
type = string

0 commit comments

Comments
 (0)