Skip to content

Commit 2b456f8

Browse files
authored
feat!: Upgrade Terraform and AWS min required providers to 1.10 and 6.19 respectively (#426)
1 parent aee16dd commit 2b456f8

File tree

15 files changed

+1033
-465
lines changed

15 files changed

+1033
-465
lines changed

README.md

Lines changed: 27 additions & 24 deletions
Large diffs are not rendered by default.

docs/UPGRADE-5.0.md

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
# Upgrade from v4.x to v5.x
2+
3+
Please consult the `examples` directory for reference example configurations. If you find a bug, please open an issue with supporting configuration to reproduce.
4+
5+
## List of backwards incompatible changes
6+
7+
- Minimum supported version of Terraform AWS provider updated to `v6.19` to support the latest resources utilized
8+
- Minimum supported version of Terraform updated to `v1.10` (min supported version for ACM module used within this module)
9+
- The underlying `aws_security_group_rule` have been replaced with `aws_vpc_security_group_ingress_rule` and `aws_vpc_security_group_egress_rule` to allow for more flexibility in defining security group rules.
10+
- The attributes used to construct the container definition(s) have been changed from HCL's norm of `snake_case` to `camelCase` to match the AWS API. There currently isn't a [resource nor data source for the container definition](https://github.com/hashicorp/terraform-provider-aws/issues/17988), so one is constructed entirely from HCL in the `container-definition` sub-module. This definition is then rendered as JSON when presented to the task definition (or task set) APIs. Previously, the variable names used were `snake_case` and then internally converted to `camelCase`. However, this does not allow for [using the `container-definition` sub-module on its own](https://github.com/terraform-aws-modules/terraform-aws-ecs/issues/147) due to the mismatch between casing. Its probably going to trip a few folks up, but hopefully we'll remove this for a data source in the future.
11+
- `service.task_exec_ssm_param_arns` default of `["arn:aws:ssm:*:*:parameter/*"]` has been removed to prevent unintended permission grants. If you were relying on this default, you will need to explicitly set this variable in your configuration.
12+
- `service.task_exec_secret_arns` default of `["arn:aws:secretsmanager:*:*:secret:*"]` has been removed to prevent unintended permission grants. If you were relying on this default, you will need to explicitly set this variable in your configuration.
13+
14+
## Additional changes
15+
16+
### Added
17+
18+
- Support for `region` argument to specify the AWS region for the resources created if different from the provider region.
19+
20+
### Modified
21+
22+
- The ALB module used within this module has been updated to `v10.2.0`
23+
- The ECS cluster and service modules used within this module have been updated to `v6.7.0`
24+
- The ACM module used within this module has been updated to `v6.1.1`
25+
- The EFS module used within this module has been updated to `v2.0.0`
26+
- Variable definitions now contain detailed object types in place of the previously used `any` type
27+
28+
### Removed
29+
30+
- None
31+
32+
### Variable and output changes
33+
34+
1. Removed variables:
35+
36+
- `atlantis_gid` -> is now `atlantis.group_id` within the `atlantis` object variable
37+
- `atlantis_uid` -> is now `atlantis.user_id` within the `atlantis` object variable
38+
- `alb_https_default_action` -> replaced by `alb.https_default_action` within the `alb` object variable
39+
- `alb_subnets` -> replaced by `alb.subnet_ids` within the `alb` object variable
40+
- `service_subnets` -> replaced by `service.subnet_ids` within the `service` object variable
41+
- From the `alb` object variable:
42+
- `customer_owned_ipv4_pool`
43+
- `desync_mitigation_mode`
44+
- `dns_record_client_routing_policy`
45+
- `enable_tls_version_and_cipher_suite_headers`
46+
- `enable_xff_client_port`
47+
- `load_balancer_type`
48+
- `xff_header_processing_mode`
49+
- From the `service` object variable:
50+
- `ignore_task_definition_changes`
51+
- `alarms`
52+
- `deployment_controller`
53+
- `deployment_maximum_percent` - Atlantis only supports 1 running instance
54+
- `deployment_minimum_healthy_percent` - Atlantis only supports 1 running instance
55+
- `desired_count` - Atlantis only supports 1 running instance
56+
- `enable_execute_command`
57+
- `ordered_placement_strategy`
58+
- `placement_constraints`
59+
- `scheduling_strategy`
60+
- `service_connect_configuration`
61+
- `service_registries`
62+
- `container_definition_defaults`
63+
- `inference_accelerator`
64+
- `ipc_mode`
65+
- `pid_mode`
66+
- `task_definition_placement_constraints`
67+
- `proxy_configuration`
68+
- `skip_destroy`
69+
- `external_id`
70+
- `scale`
71+
- `force_delete`
72+
- `wait_until_stable`
73+
- `wait_until_stable_timeout`
74+
- `enable_autoscaling`
75+
- `autoscaling_min_capacity`
76+
- `autoscaling_max_capacity`
77+
- `autoscaling_policies`
78+
- `autoscaling_scheduled_actions`
79+
- From the `atlantis` object variable:
80+
- `essential` - now always true
81+
- `extra_hosts`
82+
- `interactive`
83+
- `links`
84+
- `pseudo_terminal`
85+
- `system_controls`
86+
- From the `efs` object variable:
87+
- `create_backup_policy`
88+
- `enable_backup_policy`
89+
- `create_replication_configuration`
90+
- `replication_configuration_destination`
91+
92+
2. Renamed variables:
93+
94+
- `cluster.settings` -> `cluster.setting` (singular)
95+
- `cluster.fargate_capacity_providers` -> replaced by `cluster.default_capacity_provider_strategy`
96+
97+
3. Added variables:
98+
99+
- `region`
100+
101+
4. Removed outputs:
102+
103+
- None
104+
105+
5. Renamed outputs:
106+
107+
- None
108+
109+
6. Added outputs:
110+
111+
- None
112+
113+
## Upgrade Migrations
114+
115+
### Diff of Before vs After
116+
117+
```diff
118+
module "atlantis" {
119+
source = "terraform-aws-modules/atlantis/aws"
120+
- version = "4.4.1"
121+
+ version = "5.0.0"
122+
123+
# Truncated for brevity, only the relevant changes shown
124+
125+
- alb_subnets = module.vpc.public_subnets
126+
alb = {
127+
+ subnet_ids = module.vpc.public_subnets
128+
...
129+
}
130+
131+
- service_subnets = module.vpc.private_subnets
132+
service = {
133+
+ subnet_ids = module.vpc.private_subnets
134+
...
135+
}
136+
```
137+
138+
### State Move Commands
139+
140+
None - the security group rules will be replaced on apply due to the change from `aws_security_group_rule` to `aws_vpc_security_group_ingress_rule` and `aws_vpc_security_group_egress_rule`

examples/github-complete/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@ Note that this example may create resources which cost money. Run `terraform des
1919

2020
| Name | Version |
2121
|------|---------|
22-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
23-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | ~> 5.0 |
22+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.11 |
23+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 6.19 |
2424
| <a name="requirement_github"></a> [github](#requirement\_github) | >= 5.0 |
2525
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 3.0 |
2626

2727
## Providers
2828

2929
| Name | Version |
3030
|------|---------|
31-
| <a name="provider_aws"></a> [aws](#provider\_aws) | ~> 5.0 |
31+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 6.19 |
3232
| <a name="provider_random"></a> [random](#provider\_random) | >= 3.0 |
3333

3434
## Modules
@@ -37,8 +37,8 @@ Note that this example may create resources which cost money. Run `terraform des
3737
|------|--------|---------|
3838
| <a name="module_atlantis"></a> [atlantis](#module\_atlantis) | ../../ | n/a |
3939
| <a name="module_github_repository_webhooks"></a> [github\_repository\_webhooks](#module\_github\_repository\_webhooks) | ../../modules/github-repository-webhook | n/a |
40-
| <a name="module_secrets_manager"></a> [secrets\_manager](#module\_secrets\_manager) | terraform-aws-modules/secrets-manager/aws | ~> 1.0 |
41-
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | ~> 5.0 |
40+
| <a name="module_secrets_manager"></a> [secrets\_manager](#module\_secrets\_manager) | terraform-aws-modules/secrets-manager/aws | ~> 2.0 |
41+
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | ~> 6.0 |
4242

4343
## Resources
4444

examples/github-complete/main.tf

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,10 @@ locals {
3434
module "atlantis" {
3535
source = "../../"
3636

37-
name = local.name
37+
name = local.name
38+
vpc_id = module.vpc.vpc_id
3839

39-
# ECS
40+
# ECS Container Definition
4041
atlantis = {
4142
environment = [
4243
{
@@ -64,7 +65,10 @@ module "atlantis" {
6465
]
6566
}
6667

68+
# ECS Service
6769
service = {
70+
subnet_ids = module.vpc.private_subnets
71+
6872
task_exec_secret_arns = [for sec in module.secrets_manager : sec.secret_arn]
6973
# Provide Atlantis permission necessary to create/destroy resources
7074
tasks_iam_role_policies = {
@@ -74,14 +78,12 @@ module "atlantis" {
7478

7579
# ALB
7680
alb = {
81+
subnet_ids = module.vpc.public_subnets
82+
7783
# For example only
7884
enable_deletion_protection = false
7985
}
8086

81-
alb_subnets = module.vpc.public_subnets
82-
service_subnets = module.vpc.private_subnets
83-
vpc_id = module.vpc.vpc_id
84-
8587
# ACM
8688
certificate_domain_name = "${local.name}.${var.domain}"
8789
route53_zone_id = data.aws_route53_zone.this.id
@@ -125,7 +127,7 @@ resource "random_password" "webhook_secret" {
125127

126128
module "secrets_manager" {
127129
source = "terraform-aws-modules/secrets-manager/aws"
128-
version = "~> 1.0"
130+
version = "~> 2.0"
129131

130132
for_each = {
131133
github-token = {
@@ -137,16 +139,17 @@ module "secrets_manager" {
137139
}
138140

139141
# Secret
140-
name_prefix = each.key
141-
recovery_window_in_days = 0 # For example only
142-
secret_string = each.value.secret_string
142+
name_prefix = each.key
143+
recovery_window_in_days = 0 # For example only
144+
secret_string_wo = each.value.secret_string
145+
secret_string_wo_version = 2
143146

144147
tags = local.tags
145148
}
146149

147150
module "vpc" {
148151
source = "terraform-aws-modules/vpc/aws"
149-
version = "~> 5.0"
152+
version = "~> 6.0"
150153

151154
name = local.name
152155
cidr = local.vpc_cidr

examples/github-complete/versions.tf

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
terraform {
2-
required_version = ">= 1.0"
2+
required_version = ">= 1.11"
33

44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = "~> 5.0"
7+
version = ">= 6.19"
88
}
9-
109
github = {
1110
source = "integrations/github"
1211
version = ">= 5.0"
1312
}
14-
1513
random = {
1614
source = "hashicorp/random"
1715
version = ">= 3.0"

examples/github-separate/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,29 @@ Note that this example may create resources which cost money. Run `terraform des
1919

2020
| Name | Version |
2121
|------|---------|
22-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
23-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | ~> 5.0 |
22+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.11 |
23+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 6.19 |
2424
| <a name="requirement_github"></a> [github](#requirement\_github) | >= 5.0 |
2525
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 3.0 |
2626

2727
## Providers
2828

2929
| Name | Version |
3030
|------|---------|
31-
| <a name="provider_aws"></a> [aws](#provider\_aws) | ~> 5.0 |
31+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 6.19 |
3232
| <a name="provider_random"></a> [random](#provider\_random) | >= 3.0 |
3333

3434
## Modules
3535

3636
| Name | Source | Version |
3737
|------|--------|---------|
38-
| <a name="module_alb"></a> [alb](#module\_alb) | terraform-aws-modules/alb/aws | 9.1.0 |
38+
| <a name="module_alb"></a> [alb](#module\_alb) | terraform-aws-modules/alb/aws | 10.2.0 |
3939
| <a name="module_atlantis"></a> [atlantis](#module\_atlantis) | ../../ | n/a |
4040
| <a name="module_atlantis_disabled"></a> [atlantis\_disabled](#module\_atlantis\_disabled) | ../../ | n/a |
41-
| <a name="module_ecs_cluster"></a> [ecs\_cluster](#module\_ecs\_cluster) | terraform-aws-modules/ecs/aws//modules/cluster | 5.6.0 |
41+
| <a name="module_ecs_cluster"></a> [ecs\_cluster](#module\_ecs\_cluster) | terraform-aws-modules/ecs/aws//modules/cluster | 6.7.0 |
4242
| <a name="module_github_repository_webhooks"></a> [github\_repository\_webhooks](#module\_github\_repository\_webhooks) | ../../modules/github-repository-webhook | n/a |
43-
| <a name="module_secrets_manager"></a> [secrets\_manager](#module\_secrets\_manager) | terraform-aws-modules/secrets-manager/aws | ~> 1.0 |
44-
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | ~> 5.0 |
43+
| <a name="module_secrets_manager"></a> [secrets\_manager](#module\_secrets\_manager) | terraform-aws-modules/secrets-manager/aws | ~> 2.0 |
44+
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | ~> 6.0 |
4545

4646
## Resources
4747

examples/github-separate/main.tf

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ locals {
3030
module "atlantis" {
3131
source = "../../"
3232

33-
name = local.name
33+
name = local.name
34+
vpc_id = module.vpc.vpc_id
3435

3536
# Existing cluster
3637
create_cluster = false
@@ -41,7 +42,7 @@ module "atlantis" {
4142
alb_target_group_arn = module.alb.target_groups["atlantis"].arn
4243
alb_security_group_id = module.alb.security_group_id
4344

44-
# ECS
45+
# ECS Container Definition
4546
atlantis = {
4647
environment = [
4748
{
@@ -70,17 +71,17 @@ module "atlantis" {
7071
fqdn = module.alb.dns_name
7172
}
7273

74+
# ECS Service
7375
service = {
76+
subnet_ids = module.vpc.private_subnets
77+
7478
task_exec_secret_arns = [for sec in module.secrets_manager : sec.secret_arn]
7579
# Provide Atlantis permission necessary to create/destroy resources
7680
tasks_iam_role_policies = {
7781
AdministratorAccess = "arn:aws:iam::aws:policy/AdministratorAccess"
7882
}
7983
}
8084

81-
service_subnets = module.vpc.private_subnets
82-
vpc_id = module.vpc.vpc_id
83-
8485
tags = local.tags
8586
}
8687

@@ -105,21 +106,21 @@ module "atlantis_disabled" {
105106

106107
module "ecs_cluster" {
107108
source = "terraform-aws-modules/ecs/aws//modules/cluster"
108-
version = "5.6.0"
109+
version = "6.7.0"
109110

110111
# Cluster
111-
cluster_name = local.name
112-
cluster_settings = {
112+
name = local.name
113+
setting = [{
113114
name = "containerInsights"
114115
value = "enabled"
115-
}
116+
}]
116117

117118
tags = local.tags
118119
}
119120

120121
module "alb" {
121122
source = "terraform-aws-modules/alb/aws"
122-
version = "9.1.0"
123+
version = "10.2.0"
123124

124125
name = local.name
125126

@@ -192,7 +193,7 @@ resource "random_password" "webhook_secret" {
192193

193194
module "secrets_manager" {
194195
source = "terraform-aws-modules/secrets-manager/aws"
195-
version = "~> 1.0"
196+
version = "~> 2.0"
196197

197198
for_each = {
198199
github-token = {
@@ -204,16 +205,17 @@ module "secrets_manager" {
204205
}
205206

206207
# Secret
207-
name_prefix = each.key
208-
recovery_window_in_days = 0 # For example only
209-
secret_string = each.value.secret_string
208+
name_prefix = each.key
209+
recovery_window_in_days = 0 # For example only
210+
secret_string_wo = each.value.secret_string
211+
secret_string_wo_version = 2
210212

211213
tags = local.tags
212214
}
213215

214216
module "vpc" {
215217
source = "terraform-aws-modules/vpc/aws"
216-
version = "~> 5.0"
218+
version = "~> 6.0"
217219

218220
name = local.name
219221
cidr = local.vpc_cidr

0 commit comments

Comments
 (0)