Skip to content

Commit 1b6c589

Browse files
committed
feat: Add example for ECS Managed Instances
1 parent dd09227 commit 1b6c589

File tree

20 files changed

+894
-39
lines changed

20 files changed

+894
-39
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ No resources.
178178
| Name | Description | Type | Default | Required |
179179
|------|-------------|------|---------|:--------:|
180180
| <a name="input_autoscaling_capacity_providers"></a> [autoscaling\_capacity\_providers](#input\_autoscaling\_capacity\_providers) | [DEPRECATED - use `capacity_providers` instead] Map of autoscaling capacity provider definitions to create for the cluster | <pre>map(object({<br/> auto_scaling_group_arn = string<br/> managed_draining = optional(string, "ENABLED")<br/> managed_scaling = optional(object({<br/> instance_warmup_period = optional(number)<br/> maximum_scaling_step_size = optional(number)<br/> minimum_scaling_step_size = optional(number)<br/> status = optional(string)<br/> target_capacity = optional(number)<br/> }))<br/> managed_termination_protection = optional(string)<br/> name = optional(string) # Will fall back to use map key if not set<br/> tags = optional(map(string), {})<br/> }))</pre> | `null` | no |
181-
| <a name="input_capacity_providers"></a> [capacity\_providers](#input\_capacity\_providers) | Map of capacity provider definitions to create for the cluster | <pre>map(object({<br/> autoscaling_group_provider = optional(object({<br/> auto_scaling_group_arn = string<br/> managed_draining = optional(string, "ENABLED")<br/> managed_scaling = optional(object({<br/> instance_warmup_period = optional(number)<br/> maximum_scaling_step_size = optional(number)<br/> minimum_scaling_step_size = optional(number)<br/> status = optional(string)<br/> target_capacity = optional(number)<br/> }))<br/> managed_termination_protection = optional(string)<br/> }))<br/> managed_instances_provider = optional(object({<br/> infrastructure_role_arn = optional(string)<br/> instance_launch_template = object({<br/> ec2_instance_profile_arn = optional(string)<br/> instance_requirements = optional(object({<br/> accelerator_count = optional(object({<br/> max = optional(number)<br/> min = optional(number)<br/> }))<br/> accelerator_manufacturers = optional(list(string))<br/> accelerator_names = optional(list(string))<br/> accelerator_total_memory_mib = optional(object({<br/> max = optional(number)<br/> min = optional(number)<br/> }))<br/> accelerator_types = optional(list(string))<br/> allowed_instance_types = optional(list(string))<br/> bare_metal = optional(string)<br/> baseline_ebs_bandwidth_mbps = optional(object({<br/> max = optional(number)<br/> min = optional(number)<br/> }))<br/> burstable_performance = optional(string)<br/> cpu_manufacturers = optional(list(string))<br/> excluded_instance_types = optional(list(string))<br/> instance_generations = optional(list(string))<br/> local_storage = optional(string)<br/> local_storage_types = optional(list(string))<br/> max_spot_price_as_percentage_of_optimal_on_demand_price = optional(number)<br/> memory_gib_per_vcpu = optional(object({<br/> max = optional(number)<br/> min = optional(number)<br/> }))<br/> memory_mib = optional(object({<br/> max = optional(number)<br/> min = optional(number)<br/> }))<br/> network_bandwidth_gbps = optional(object({<br/> max = optional(number)<br/> min = optional(number)<br/> }))<br/> network_interface_count = optional(object({<br/> max = optional(number)<br/> min = optional(number)<br/> }))<br/> on_demand_max_price_percentage_over_lowest_price = optional(number)<br/> require_hibernate_support = optional(bool)<br/> spot_max_price_percentage_over_lowest_price = optional(number)<br/> total_local_storage_gb = optional(object({<br/> max = optional(number)<br/> min = optional(number)<br/> }))<br/> vcpu_count = optional(object({<br/> max = optional(number)<br/> min = optional(number)<br/> }))<br/> }))<br/> monitoring = optional(string)<br/> network_configuration = optional(object({<br/> security_groups = optional(list(string))<br/> subnets = list(string)<br/> }))<br/> storage_configuration = optional(object({<br/> storage_size_gib = number<br/> }))<br/> })<br/> propagate_tags = optional(string)<br/> }))<br/> name = optional(string) # Will fall back to use map key if not set<br/> tags = optional(map(string), {})<br/> }))</pre> | `null` | no |
181+
| <a name="input_capacity_providers"></a> [capacity\_providers](#input\_capacity\_providers) | Map of capacity provider definitions to create for the cluster | <pre>map(object({<br/> auto_scaling_group_provider = optional(object({<br/> auto_scaling_group_arn = string<br/> managed_draining = optional(string, "ENABLED")<br/> managed_scaling = optional(object({<br/> instance_warmup_period = optional(number)<br/> maximum_scaling_step_size = optional(number)<br/> minimum_scaling_step_size = optional(number)<br/> status = optional(string)<br/> target_capacity = optional(number)<br/> }))<br/> managed_termination_protection = optional(string)<br/> }))<br/> managed_instances_provider = optional(object({<br/> infrastructure_role_arn = optional(string)<br/> instance_launch_template = object({<br/> ec2_instance_profile_arn = optional(string)<br/> instance_requirements = optional(object({<br/> accelerator_count = optional(object({<br/> max = optional(number)<br/> min = optional(number)<br/> }))<br/> accelerator_manufacturers = optional(list(string))<br/> accelerator_names = optional(list(string))<br/> accelerator_total_memory_mib = optional(object({<br/> max = optional(number)<br/> min = optional(number)<br/> }))<br/> accelerator_types = optional(list(string))<br/> allowed_instance_types = optional(list(string))<br/> bare_metal = optional(string)<br/> baseline_ebs_bandwidth_mbps = optional(object({<br/> max = optional(number)<br/> min = optional(number)<br/> }))<br/> burstable_performance = optional(string)<br/> cpu_manufacturers = optional(list(string))<br/> excluded_instance_types = optional(list(string))<br/> instance_generations = optional(list(string))<br/> local_storage = optional(string)<br/> local_storage_types = optional(list(string))<br/> max_spot_price_as_percentage_of_optimal_on_demand_price = optional(number)<br/> memory_gib_per_vcpu = optional(object({<br/> max = optional(number)<br/> min = optional(number)<br/> }))<br/> memory_mib = optional(object({<br/> max = optional(number)<br/> min = optional(number)<br/> }))<br/> network_bandwidth_gbps = optional(object({<br/> max = optional(number)<br/> min = optional(number)<br/> }))<br/> network_interface_count = optional(object({<br/> max = optional(number)<br/> min = optional(number)<br/> }))<br/> on_demand_max_price_percentage_over_lowest_price = optional(number)<br/> require_hibernate_support = optional(bool)<br/> spot_max_price_percentage_over_lowest_price = optional(number)<br/> total_local_storage_gb = optional(object({<br/> max = optional(number)<br/> min = optional(number)<br/> }))<br/> vcpu_count = optional(object({<br/> max = optional(number)<br/> min = optional(number)<br/> }))<br/> }))<br/> monitoring = optional(string)<br/> network_configuration = optional(object({<br/> security_groups = optional(list(string), [])<br/> subnets = list(string)<br/> }))<br/> storage_configuration = optional(object({<br/> storage_size_gib = number<br/> }))<br/> })<br/> propagate_tags = optional(string, "CAPACITY_PROVIDER")<br/> }))<br/> name = optional(string) # Will fall back to use map key if not set<br/> tags = optional(map(string), {})<br/> }))</pre> | `null` | no |
182182
| <a name="input_cloudwatch_log_group_class"></a> [cloudwatch\_log\_group\_class](#input\_cloudwatch\_log\_group\_class) | Specified the log class of the log group. Possible values are: `STANDARD` or `INFREQUENT_ACCESS` | `string` | `null` | no |
183183
| <a name="input_cloudwatch_log_group_kms_key_id"></a> [cloudwatch\_log\_group\_kms\_key\_id](#input\_cloudwatch\_log\_group\_kms\_key\_id) | If a KMS Key ARN is set, this key will be used to encrypt the corresponding log group. Please be sure that the KMS Key has an appropriate key policy (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/encrypt-log-data-kms.html) | `string` | `null` | no |
184184
| <a name="input_cloudwatch_log_group_name"></a> [cloudwatch\_log\_group\_name](#input\_cloudwatch\_log\_group\_name) | Custom name of CloudWatch Log Group for ECS cluster | `string` | `null` | no |
@@ -230,7 +230,8 @@ No resources.
230230

231231
| Name | Description |
232232
|------|-------------|
233-
| <a name="output_autoscaling_capacity_providers"></a> [autoscaling\_capacity\_providers](#output\_autoscaling\_capacity\_providers) | Map of autoscaling capacity providers created and their attributes |
233+
| <a name="output_autoscaling_capacity_providers"></a> [autoscaling\_capacity\_providers](#output\_autoscaling\_capacity\_providers) | [DEPRECATED - use `capacity_providers`] Map of autoscaling capacity providers created and their attributes |
234+
| <a name="output_capacity_providers"></a> [capacity\_providers](#output\_capacity\_providers) | Map of autoscaling capacity providers created and their attributes |
234235
| <a name="output_cloudwatch_log_group_arn"></a> [cloudwatch\_log\_group\_arn](#output\_cloudwatch\_log\_group\_arn) | ARN of CloudWatch log group created |
235236
| <a name="output_cloudwatch_log_group_name"></a> [cloudwatch\_log\_group\_name](#output\_cloudwatch\_log\_group\_name) | Name of CloudWatch log group created |
236237
| <a name="output_cluster_arn"></a> [cluster\_arn](#output\_cluster\_arn) | ARN that identifies the cluster |

examples/complete/README.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ Configuration in this directory creates:
1414
To run this example you need to execute:
1515

1616
```bash
17-
$ terraform init
18-
$ terraform plan
19-
$ terraform apply
17+
terraform init
18+
terraform plan
19+
terraform apply
2020
```
2121

2222
Note that this example may create resources which will incur monetary charges on your AWS bill. Run `terraform destroy` when you no longer need these resources.
@@ -66,12 +66,26 @@ No inputs.
6666
| Name | Description |
6767
|------|-------------|
6868
| <a name="output_alb_dns_name"></a> [alb\_dns\_name](#output\_alb\_dns\_name) | The DNS name of the load balancer |
69+
| <a name="output_capacity_providers"></a> [capacity\_providers](#output\_capacity\_providers) | Map of autoscaling capacity providers created and their attributes |
70+
| <a name="output_cloudwatch_log_group_arn"></a> [cloudwatch\_log\_group\_arn](#output\_cloudwatch\_log\_group\_arn) | ARN of CloudWatch log group created |
71+
| <a name="output_cloudwatch_log_group_name"></a> [cloudwatch\_log\_group\_name](#output\_cloudwatch\_log\_group\_name) | Name of CloudWatch log group created |
6972
| <a name="output_cluster_arn"></a> [cluster\_arn](#output\_cluster\_arn) | ARN that identifies the cluster |
70-
| <a name="output_cluster_autoscaling_capacity_providers"></a> [cluster\_autoscaling\_capacity\_providers](#output\_cluster\_autoscaling\_capacity\_providers) | Map of capacity providers created and their attributes |
7173
| <a name="output_cluster_capacity_providers"></a> [cluster\_capacity\_providers](#output\_cluster\_capacity\_providers) | Map of cluster capacity providers attributes |
7274
| <a name="output_cluster_id"></a> [cluster\_id](#output\_cluster\_id) | ID that identifies the cluster |
7375
| <a name="output_cluster_name"></a> [cluster\_name](#output\_cluster\_name) | Name that identifies the cluster |
76+
| <a name="output_infrastructure_iam_role_arn"></a> [infrastructure\_iam\_role\_arn](#output\_infrastructure\_iam\_role\_arn) | The Amazon Resource Name (ARN) specifying the IAM role |
77+
| <a name="output_infrastructure_iam_role_name"></a> [infrastructure\_iam\_role\_name](#output\_infrastructure\_iam\_role\_name) | IAM role name |
78+
| <a name="output_infrastructure_iam_role_unique_id"></a> [infrastructure\_iam\_role\_unique\_id](#output\_infrastructure\_iam\_role\_unique\_id) | Stable and unique string identifying the IAM role |
79+
| <a name="output_node_iam_instance_profile_arn"></a> [node\_iam\_instance\_profile\_arn](#output\_node\_iam\_instance\_profile\_arn) | ARN assigned by AWS to the instance profile |
80+
| <a name="output_node_iam_instance_profile_id"></a> [node\_iam\_instance\_profile\_id](#output\_node\_iam\_instance\_profile\_id) | Instance profile's ID |
81+
| <a name="output_node_iam_instance_profile_unique"></a> [node\_iam\_instance\_profile\_unique](#output\_node\_iam\_instance\_profile\_unique) | Stable and unique string identifying the IAM instance profile |
82+
| <a name="output_node_iam_role_arn"></a> [node\_iam\_role\_arn](#output\_node\_iam\_role\_arn) | The Amazon Resource Name (ARN) specifying the IAM role |
83+
| <a name="output_node_iam_role_name"></a> [node\_iam\_role\_name](#output\_node\_iam\_role\_name) | IAM role name |
84+
| <a name="output_node_iam_role_unique_id"></a> [node\_iam\_role\_unique\_id](#output\_node\_iam\_role\_unique\_id) | Stable and unique string identifying the IAM role |
7485
| <a name="output_services"></a> [services](#output\_services) | Map of services created and their attributes |
86+
| <a name="output_task_exec_iam_role_arn"></a> [task\_exec\_iam\_role\_arn](#output\_task\_exec\_iam\_role\_arn) | Task execution IAM role ARN |
87+
| <a name="output_task_exec_iam_role_name"></a> [task\_exec\_iam\_role\_name](#output\_task\_exec\_iam\_role\_name) | Task execution IAM role name |
88+
| <a name="output_task_exec_iam_role_unique_id"></a> [task\_exec\_iam\_role\_unique\_id](#output\_task\_exec\_iam\_role\_unique\_id) | Stable and unique string identifying the task execution IAM role |
7589
<!-- END_TF_DOCS -->
7690

7791
## License

examples/complete/outputs.tf

Lines changed: 73 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,84 @@ output "cluster_name" {
1717
value = module.ecs.cluster_name
1818
}
1919

20+
output "cloudwatch_log_group_name" {
21+
description = "Name of CloudWatch log group created"
22+
value = module.ecs.cloudwatch_log_group_name
23+
}
24+
25+
output "cloudwatch_log_group_arn" {
26+
description = "ARN of CloudWatch log group created"
27+
value = module.ecs.cloudwatch_log_group_arn
28+
}
29+
2030
output "cluster_capacity_providers" {
2131
description = "Map of cluster capacity providers attributes"
2232
value = module.ecs.cluster_capacity_providers
2333
}
2434

25-
output "cluster_autoscaling_capacity_providers" {
26-
description = "Map of capacity providers created and their attributes"
27-
value = module.ecs.autoscaling_capacity_providers
35+
output "capacity_providers" {
36+
description = "Map of autoscaling capacity providers created and their attributes"
37+
value = module.ecs.capacity_providers
38+
}
39+
40+
output "task_exec_iam_role_name" {
41+
description = "Task execution IAM role name"
42+
value = module.ecs.task_exec_iam_role_name
43+
}
44+
45+
output "task_exec_iam_role_arn" {
46+
description = "Task execution IAM role ARN"
47+
value = module.ecs.task_exec_iam_role_arn
48+
}
49+
50+
output "task_exec_iam_role_unique_id" {
51+
description = "Stable and unique string identifying the task execution IAM role"
52+
value = module.ecs.task_exec_iam_role_unique_id
53+
}
54+
55+
output "infrastructure_iam_role_arn" {
56+
description = "The Amazon Resource Name (ARN) specifying the IAM role"
57+
value = module.ecs.infrastructure_iam_role_arn
58+
}
59+
60+
output "infrastructure_iam_role_name" {
61+
description = "IAM role name"
62+
value = module.ecs.infrastructure_iam_role_name
63+
}
64+
65+
output "infrastructure_iam_role_unique_id" {
66+
description = "Stable and unique string identifying the IAM role"
67+
value = module.ecs.infrastructure_iam_role_unique_id
68+
}
69+
70+
output "node_iam_role_arn" {
71+
description = "The Amazon Resource Name (ARN) specifying the IAM role"
72+
value = module.ecs.node_iam_role_arn
73+
}
74+
75+
output "node_iam_role_name" {
76+
description = "IAM role name"
77+
value = module.ecs.node_iam_role_name
78+
}
79+
80+
output "node_iam_role_unique_id" {
81+
description = "Stable and unique string identifying the IAM role"
82+
value = module.ecs.node_iam_role_unique_id
83+
}
84+
85+
output "node_iam_instance_profile_arn" {
86+
description = "ARN assigned by AWS to the instance profile"
87+
value = module.ecs.node_iam_instance_profile_arn
88+
}
89+
90+
output "node_iam_instance_profile_id" {
91+
description = "Instance profile's ID"
92+
value = module.ecs.node_iam_instance_profile_id
93+
}
94+
95+
output "node_iam_instance_profile_unique" {
96+
description = "Stable and unique string identifying the IAM instance profile"
97+
value = module.ecs.node_iam_instance_profile_unique
2898
}
2999

30100
################################################################################

examples/container-definition/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ Configuration in this directory creates:
99
To run this example you need to execute:
1010

1111
```bash
12-
$ terraform init
13-
$ terraform plan
14-
$ terraform apply
12+
terraform init
13+
terraform plan
14+
terraform apply
1515
```
1616

1717
Note that this example may create resources which will incur monetary charges on your AWS bill. Run `terraform destroy` when you no longer need these resources.

0 commit comments

Comments
 (0)