Skip to content

feat!: Upgrade AWS provider and min required Terraform version to 6.0 and 1.5.7 respectively #217

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

Merged
merged 26 commits into from
Jul 7, 2025

Conversation

bryantbiggs
Copy link
Member

@bryantbiggs bryantbiggs commented Aug 5, 2024

Description

List of backwards incompatible changes

  • Terraform v1.5.7 is now minimum supported version
  • AWS provider v6.0.0 is now minimum supported version
  • 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, 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 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.
  • security_group_rules has been split into security_group_ingress_rules and security_group_egress_rules to better match the AWS API and allow for more flexibility in defining security group rules.
  • Default permissive permissions for SSM parameter ARNs and Secrets Manager secret ARNs have been removed throughout. While this made it easier for users since it "just worked", it was not secure and could lead to unexpected access to resources. Users should now explicitly define the permissions they need in their IAM policies.
  • The "hack" put in place to track the task definition version when updating outside of the module has been removed. Instead, users should rely on the track_latest variable to ensure that the latest task definition is used when updating the service. Any issues with tracking the task definition version should be reported to the ECS service team as it is a limitation of the AWS ECS service/API and not the module itself.
  • The inline policy for the Tasks role of the service sub-module has been replaced with a standalone IAM policy. In some organizations, inline policies are not allowed.
  • The default for the container-definition user has been changed from 0 to null.

Additional changes

Added

Modified

  • Variable definitions now contain detailed object types in place of the previously used any type.

Variable and output changes

  1. Removed variables:

    • default_capacity_provider_use_fargate

    • fargate_capacity_providers

    • cluster sub-module

      • fargate_capacity_providers; part of default_capacity_provider_strategy now
      • default_capacity_provider_use_fargate
    • container-definition sub-module

      • None
    • service sub-module

      • inference_accelerator
  2. Renamed variables:

    • cluster_settings -> cluster_setting

    • cluster sub-module

      • cluster_configuration - configuration
      • cluster_settings - setting
      • cluster_service_connect_defaults - service_connect_defaults
    • container-definition sub-module

      • dependencies - dependsOn
      • disable_networking - disableNetworking
      • dns_search_domains - dnsSearchDomains
      • dns_servers - dnsServers
      • docker_labels - dockerLabels
      • docker_security_options - dockerSecurityOptions
      • environment_files - environmentFiles
      • extra_hosts - extraHosts
      • firelens_configuration - firelensConfiguration
      • health_check - healthCheck
      • linux_parameters - linuxParameters
      • log_configuration - logConfiguration
      • memory_reservation - memoryReservation
      • mount_points - mountPoints
      • port_mappings - portMappings
      • psuedo_terminal - pseudoTerminal
      • readonly_root_filesystem - readonlyRootFilesystem
      • repository_credentials - repositoryCredentials
      • start_timeout - startTimeout
      • system_controls - systemControls
      • volumes_from - volumesFrom
      • working_directory - workingDirectory
    • service sub-module

      • None
  3. Added variables:

    • cloudwatch_log_group_class

    • default_capacity_provider_strategy

    • cluster sub-module

      • cloudwatch_log_group_class
      • default_capacity_provider_strategy - replaces fargate_capacity_providers and default_capacity_provider_use_fargate functionality
    • container-definition sub-module

    • service sub-module

      • availability_zone_rebalancing
      • volume_configuration
      • vpc_lattice_configurations
      • enable_fault_injection
      • track_latest
      • create_infrastructure_iam_role
      • infrastructure_iam_role_arn
      • infrastructure_iam_role_name
      • infrastructure_iam_role_use_name_prefix
      • infrastructure_iam_role_path
      • infrastructure_iam_role_description
      • infrastructure_iam_role_permissions_boundary
      • infrastructure_iam_role_tags
  4. Removed outputs:

    • cluster sub-module
      • None
    • container-definition sub-module
      • None
    • service sub-module
      • task_definition_family_revision
  5. Renamed outputs:

    • cluster sub-module
      • None
    • container-definition sub-module
      • None
    • service sub-module
      • None
  6. Added outputs:

    • cluster sub-module
      • None
    • container-definition sub-module
      • None
    • service sub-module
      • infrastructure_iam_role_arn
      • infrastructure_iam_role_name

Motivation and Context

Breaking Changes

  • Yes, see docs/UPGRADE-6.0.md

How Has This Been Tested?

  • I have updated at least one of the examples/* to demonstrate and validate my change(s)
  • I have tested and validated these changes using one or more of the provided examples/* projects
  • I have executed pre-commit run -a on my pull request

@kkrastev-cloudoffice
Copy link

any ETA on this?

@BramRoets
Copy link

@bryantbiggs Could you please provide an update on this PR? It adds multiple important features which are standard to AWS ECS.

It's been open for a very long time. Is this still being maintained or should we move away from this project?

@bryantbiggs
Copy link
Member Author

yes, part of it is finding time since these large, breaking changes do take a considerable amount of time to test and document, and part of it is balancing the number of times we take a breaking change (major version bump). with v6 of the provider coming, I'm half inclined to wait and set the minimum provider version to 6.0 hashicorp/terraform-provider-aws#41101 to have a stable path forward for quite some time after

@nZac
Copy link

nZac commented Mar 28, 2025

@bryantbiggs if I can be of use in testing I'd be glad to help run this through the paces. Do you have a pattern or practice you use and documentation you would need to validate that testing is sufficient?

@webyneter
Copy link

FYI, had to set these to work around validation errors, in a scenario when none of these were meant to be set :

tasks_iam_role_statements = []
security_group_ingress_rules = {}
security_group_egress_rules = {}

@webyneter
Copy link

webyneter commented Apr 3, 2025

Also, FYI, var.track_latest description is off: It says, the default is false whereas the actual default = true.

In addition to that, there's no way to set var.track_latest from the root module, there's neither a track_latest parameter on the module.service, nor the corresponding root module variable.

@nikita-toffee-ai
Copy link

The enabled field in the var.service_connect_configuration is now enabled = true by default, so even if I might not need service discovery, it now requires me to specify the namespace regardless.

@webyneter
Copy link

tag_specifications = optional(list(object({
        propagate_tags = optional(string, "TASK_DEFINITION")
        resource_type  = string
        tags           = optional(map(string))
      })))

I think, we should make resource_type = optional(string, "volume"), besides, "volume" is the only value that's currently allowed.

@bryantbiggs
Copy link
Member Author

note to self: default_capacity_provider_strategy was properly borked the way it was previously configured 😅

@bryantbiggs bryantbiggs force-pushed the wip/v6 branch 3 times, most recently from cd948c3 to 3cc5e95 Compare July 2, 2025 23:43
@@ -188,6 +258,741 @@ variable "task_exec_iam_statements" {

variable "services" {
description = "Map of service definitions to create"
type = any
default = {}
type = map(object({
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I win 😅

@bryantbiggs bryantbiggs force-pushed the wip/v6 branch 2 times, most recently from 9d29599 to ae64da6 Compare July 5, 2025 18:52
@bryantbiggs bryantbiggs changed the title feat!: Work in progress for v6 feat!: Upgrade AWS provider and min required Terraform version to 6.0 and 1.5.7 respectively Jul 5, 2025
@bryantbiggs bryantbiggs marked this pull request as ready for review July 5, 2025 18:53
@bryantbiggs bryantbiggs requested a review from antonbabenko July 5, 2025 18:54
Copy link
Member

@antonbabenko antonbabenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@@ -17,7 +17,7 @@ repos:
- '--args=--only=terraform_documented_variables'
- '--args=--only=terraform_typed_variables'
- '--args=--only=terraform_module_pinned_source'
- '--args=--only=terraform_naming_convention'
# - '--args=--only=terraform_naming_convention' # Disabled due to container definition variables requiring camelCase
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can tflint recognize inline comments to mark just unsupported places? Other tools like tfsec and checkov can, so maybe tflint can also?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh that was much easier than I thought it would be 😅 - fixed in 6d0ff2b

@willfish
Copy link

willfish commented Jul 7, 2025

I'm integrating this in our repo, here, and all seems to work as before trade-tariff/trade-tariff-platform-aws-terraform#416

@bryantbiggs bryantbiggs merged commit 29b257a into master Jul 7, 2025
12 checks passed
@bryantbiggs bryantbiggs deleted the wip/v6 branch July 7, 2025 12:24
antonbabenko pushed a commit that referenced this pull request Jul 7, 2025
## [6.0.0](v5.12.1...v6.0.0) (2025-07-07)

### ⚠ BREAKING CHANGES

* Upgrade AWS provider and min required Terraform version to `6.0` and `1.5.7` respectively (#217)

### Features

* Upgrade AWS provider and min required Terraform version to `6.0` and `1.5.7` respectively ([#217](#217)) ([29b257a](29b257a)), closes [#158](#158)
@antonbabenko
Copy link
Member

This PR is included in version 6.0.0 🎉

dispel-derekberger pushed a commit to dispel/terraform-aws-ecs that referenced this pull request Jul 16, 2025
…0` and `1.5.7` respectively (terraform-aws-modules#217)

* feat: Support `managed_draining` argument at `aws_ecs_capacity_provider` (terraform-aws-modules#158)

* feat: Support manged_draining argument for aws_ecs_capacity_provider

* bump required AWS provider version to 5.34

* align AWS provider version across the project

* feat: Update MSTV to 1.3 to support state migrations, align provider version on minor version

---------

Co-authored-by: Bryant Biggs <[email protected]>

* feat: Add support for multiple `service`s inside `service_connect_configuration` (terraform-aws-modules#123)

feat: Add support for multiple service inside service_connect_configuration

Co-authored-by: Bryant Biggs <[email protected]>

* feat: Add support for custom metric queries in customized_metric_spec (terraform-aws-modules#196)

* feat: add support for custom metric queries in customized metric spec

* fix: Update and run pre-commit checks to format

---------

Co-authored-by: Bryant Biggs <[email protected]>

* feat: Add support for service connect timeout settings (terraform-aws-modules#212)

* feat: add service connect timeout support

* chore: Update required min versions

* chore: Fix merge conflicts

---------

Co-authored-by: Bryant Biggs <[email protected]>

* feat: Add support for EBS volumes (terraform-aws-modules#205)

* feat: Adding support for EBS volumes

* feat: Adding support for EBS volumes

* feat: Add support for EBS volumes

* feat: Add support for EBS volumes

* chore: Update min required AWS provider version

---------

Co-authored-by: Bryant Biggs <[email protected]>

* feat: Add support for service connect tls settings (terraform-aws-modules#216)

* add dynamic tls block for service connect service

* set aws_pca_authority_arn to required

* also apply fix to ecs service without ignore_task_def

* formatting

---------

Co-authored-by: Kevin Ouellet <[email protected]>

* fix: Propagate support for EBS volumes to the root module (terraform-aws-modules#223)

* Add missing support for EBS volumes.

The PR terraform-aws-modules#205 failed to update the main module triggered when using the Terraform Registry as the module source.

* Set default to true

* Correct infra iam role logic.

* fix: Correct logic for local `needs_infrastructure_iam_role` check (terraform-aws-modules#224)

* Fix need infrastructure role check.

* try adjusting logic.

* explicit dep

* forgot this default

* update example.

* feat: Add support for restartPolicy (terraform-aws-modules#231)

* feat: Add support for restartPolicy (terraform-aws-modules#230)

* fix precommit error

* fix: Correct defaults and remove redundant validation

---------

Co-authored-by: Bryant Biggs <[email protected]>

* refactor: Initial pass at variable type definitions for service module'

* refactor: Initial pass at variable type definitions for container definition module

* chore: Update variable name to tag_specifications (terraform-aws-modules#251)

Update variable name

In main.tf it is used a plural tag_specifications name for the attribute

* feat: Add support for availability zone rebalancing (terraform-aws-modules#262) (terraform-aws-modules#269)

* feat: Add support for availability zone rebalancing (terraform-aws-modules#262)

* revert default value of availability zone rebalancing

* chore: Raise MSV of AWS provider

* feat: Use policy for tasks role instead of inline policy

* feat: Add FIS param and remove inference accelerator from `service` module

* feat: Update cluster variable definitions; drop `cluster_` prefix

* feat: Bump version requirements for AWS provider and Terraform to v6.0 and v1.5.7 respectively

* feat: Update cluster configurations

* feat: Update container definition configurations

* feat: Update service configurations

* feat: The worlds longest variable definition

* fix: Corrections

* chore: Update upgrade guide, add container definition example for testing

* fix: Correct tflint ignore statemtns for camelCasing

---------

Co-authored-by: Ivan Sukhomlyn <[email protected]>
Co-authored-by: H.Saki <[email protected]>
Co-authored-by: matt <[email protected]>
Co-authored-by: Sal Sodano <[email protected]>
Co-authored-by: Rodrigo Torres <[email protected]>
Co-authored-by: Kevin Ouellet <[email protected]>
Co-authored-by: Kevin Ouellet <[email protected]>
Co-authored-by: Thomas Montague <[email protected]>
Co-authored-by: Paul SANTUS <[email protected]>
Co-authored-by: Luis Valdés <[email protected]>
Co-authored-by: Keisuke.Matsuda <[email protected]>
dispel-derekberger pushed a commit to dispel/terraform-aws-ecs that referenced this pull request Jul 16, 2025
## [6.0.0](terraform-aws-modules/terraform-aws-ecs@v5.12.1...v6.0.0) (2025-07-07)

### ⚠ BREAKING CHANGES

* Upgrade AWS provider and min required Terraform version to `6.0` and `1.5.7` respectively (terraform-aws-modules#217)

### Features

* Upgrade AWS provider and min required Terraform version to `6.0` and `1.5.7` respectively ([terraform-aws-modules#217](terraform-aws-modules#217)) ([29b257a](terraform-aws-modules@29b257a)), closes [terraform-aws-modules#158](terraform-aws-modules#158)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment