Skip to content

[Major Version]: Terraform AWS Provider v6.0.0 #41101

Open
@breathingdust

Description

@breathingdust

Description

The next major version of the Terraform AWS Provider is planned to release in beta in April 2025. There will be a 6 week beta period in which we will ask the community for feedback, to better understand the impact of the upgrade experience, to assess the implementation of multi-region and other enhancements and to resolve any issues found. Please submit any feedback by creating an issue in the provider using the beta-feedback form.

After the release of the beta, we will endeavor to maintain and keep both v5 and v6 branches up to date with new service/resource coverage and bugfixes during the beta period. After v6.0.0 exits beta with a stable release, v5 will only receive critical security updates.

Opting into the v6.0.0 beta

The builds will be versioned as "beta" pre-releases and uploaded to the Terraform Registry as usual. Users with permissive version constraints, such as > 5.8, will not automatically use the new beta version. Instead, they will need to opt-in by specifying the pre-release version in their provider requirements:

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "= 6.0.0-beta"
    }
  }
}

Terraform 0.12

Terraform 0.12 does not support pre-releases in provider version constraints. For this reason, 0.12 users will receive a runtime error when attempting to use the v6.0.0 beta either by specifying the version or via a non-specific version constraint. This will be removed after the stable release so that 0.12 users can use v6.0.0. We advise that users of v0.12 should upgrade to a more recent version of Terraform at the earliest opportunity.

Upgrade Instructions

As always comprehensive upgrade instructions will be found in the Registry. We would welcome in particular contributions to documentation if these instructions are unclear in any way to ensure that the upgrade process is as easy as possible for practitioners.

Note: The upgrade guide is under development and will be added to as we work though the scope of the major version.

Summary of Changes

Enhanced Multi-Region Support

We will introduce a new approach to managing AWS resources across multiple Regions in Terraform by allowing a single provider configuration to handle multiple Regions. Currently, each provider configuration in Terraform targets a single AWS Region, leading to increased memory consumption and complexity when managing multi-Region deployments. The new approach leverages an injected region attribute at the resource level, reducing memory overhead and simplifying configuration.

Key Highlights:

  • Single Provider Configuration: Reduces the need to load multiple instances of the AWS provider, lowering memory usage.
  • Region Attribute Injection: The region argument will be automatically added to all resources without requiring explicit schema changes.
  • Global Resources: The region argument will still exist on global resources, however in this case changing the region in reconfiguration will not result in resource recreation.
  • Terraform Plugin Framework Updates: Adjustments to the AWS API client mechanism will support per-Region API client mappings.
  • Resource Import Enhancements: A new @ suffix allows importing resources from different Regions.
  • Documentation & Testing: Changes will be documented at the provider level, and testing will ensure backward compatibility.
  • Certain resources that already have a top level region attribute will need special handling and a deprecation cycle leading to a breaking change in a future major version.
  • The initial refresh after an upgrade to v6.0 will show diffs for each resource where the meta region attribute is added. We are looking into way to suppress this.

Thanks to @brittandeyoung for inspiration and prototyping in #31517

EC2 Instance User Data Improvements

We will modify the aws_instance resource to display cleartext diffs for user_data changes instead of hashed values. Currently, user_data is stored as a hash in the Terraform state, making it difficult for users to evaluate unexpected modifications. The proposal outlines a strategy to safely transition to storing and displaying the raw user_data content while addressing backward compatibility concerns, including state migration and legacy base64 encoding behavior. The goal is to improve visibility and usability for practitioners managing EC2 instances with Terraform.

Deprecations

Service Deprecations

These AWS services have an announced EOL date so should now be deprecated in the provider.

Resource and Data Source Deprecations

There will be a set of deprecations to signal to users that certain resources or attributes should not be used and will be removed in the next major version (v7.0.0). Generally, this will correspond to upstream AWS service EOL events, or when attributes are not working as expected and cannot be fixed in their current form. In some specific cases (typically when features are widely used) we may use deprecations to signal to users that a resource/attribute should not be used but have no intentions to actually remove it.

Attribute Deprecations

Behaviour Deprecations

Removals

Service Removals

Resource and Data Source Removals

Attribute Removals

  • aws_api_gateway_deployment - Remove stage_name, stage_description, canary_settings attributes #39958
  • aws_dms_endpoint - Remove s3_settings attribute #29726
  • aws_dx_gateway_association - Remove vpn_gateway_id attribute #31383
  • aws_eip - Remove vpc attribute #26715
  • aws_eks_addon - Remove resolve_conflicts attribute #31292
  • aws_flog_log - Remove log_group_name attribute #31381
  • aws_identitystore_group - Remove filter attribute #33312
  • aws_identitystore_user - Remove filter attribute #33312
  • aws_instance - Remove cpu_threads_per_core, cpu_core_count attributes #31165
  • aws_networkmanager_core_network - Remove base_policy_region attribute #29780
  • aws_opensearch_domain - Remove kibana_endpoint attribute #31491
  • aws_quicksight_data_set - Remove tags_all attribute #31164
  • aws_service_discovery_service - Remove tags_all attribute #31163
  • aws_ssm_association - Remove instance_id attribute #31379
  • aws_batch_job_queue - Remove compute_environments attribute #40751

Behavior Changes

  • aws_redshift_cluster - We will update the aws_redshift_cluster resource to align with AWS's changes to default public accessibility settings. As of January 10, 2025, AWS disabled public accessibility by default for newly provisioned Redshift clusters. Currently, the provider sets a default value of true rather than leaving the attribute unset to inherit AWS's default, which is both inconsistent with best practices and unsafe. We will remove this default so that new clusters follow AWS's intended behavior. Additionally, we will correct the attribute types for cluster_public_key, cluster_revision_number, and endpoint, which are currently marked as Optional, Computed but should be Computed only, as they are set by AWS and cannot be configured by the user.#41041, #41044
  • aws_apigateway_account - We will update the behavior of the so that deleting it will always reset account settings. As part of this change, we will also remove the reset_on_delete attribute, which was introduced as a temporary workaround to avoid breaking changes. #40043
  • aws_cloudfront_response_headers_policy - We will update the behavior of the resource to make the etag attribute computed and read-only. We will also document the attribute to clarify its purpose. #38244
  • aws_ami - We will update the behavior of the data source to improve security and prevent unintended AMI selections. Currently, if a user queries for an AMI without specifying an owner, they may receive results from an unexpected source, posing a security risk as highlighted in CVE-2018-15869. Previously, we added a warning to inform users of this risk, but we will now enforce stricter behavior by returning an error if narrowing criteria, such as an owner, are not provided. To maintain flexibility, we will introduce an optional allow_unsafe_filter attribute, allowing users to explicitly accept the risk of searching without constraints. #40198
  • aws_db_instance - We will update the behavior of the aws_db_instance resource to enforce correct usage of the character_set_name attribute. Currently, this attribute is only valid when creating a new database instance, but users have been able to specify it for replicated or restored databases without effect. Previously, we added a warning to inform users that their character set selection was not being applied in these cases. To prevent confusion and ensure expected behavior, we will now return an error when character_set_name is set for a database that is not newly created. #36519
  • aws_elasticache_replication_group - We will update the resource by removing the default value for the auth_token_update_strategy argument. This argument was originally introduced with a default value of ROTATE to maintain backward compatibility with earlier provider versions where this behavior was hardcoded. However, to ensure users explicitly define their preferred token update strategy when setting an auth_token, we will now make auth_token_update_strategy a required argument. This change improves clarity and control over credential rotation. #34496
  • aws_lb_listener - We will update the resource to improve validation and handling of the mutual_authentication attributes. Currently, the provider schema incorrectly defaults ignore_client_certificate_expiry to false in all cases and allows both ignore_client_certificate_expiry and trust_store_arn to be set regardless of the mode value.
    We will modify the schema to enforce the correct behavior: ignore_client_certificate_expiry will default to false only when mode is validate and will be null otherwise. Additionally, we will introduce validation rules to ensure ignore_client_certificate_expiry can only be set when mode is validate, and trust_store_arn can only be set when mode is validate or passthrough. Finally, we will remove the incorrect requirement that trust_store_arn must be set when mode is passthrough, aligning the provider with the AWS API behavior. #35452
  • aws_globalaccelerator_accelerator - We will update the data source so that the id attribute is no longer settable. Currently, users can provide a value for id, but it is ignored and does not influence the data source’s behavior. This change aligns with common patterns in Terraform, where id is typically a read-only attribute reflecting a resource’s actual identifier. #39236
  • aws_cloudfront_key_value_store - We will update the resource so that the id attribute correctly reflects the actual ID returned by the AWS API. Currently, the provider sets id to the name, which is inconsistent with typical Terraform behavior and may cause confusion when managing resources. This change ensures that id aligns with AWS's expected identifier for the key-value store. #40839
  • aws_cognito_user_in_group - We will update the resource to use a composite key instead of the unique id currently implemented. This will allow import for the resource to work correctly. #34082
  • aws_wafv2_web_acl - Changes the default value for the enable_machine_learning attribute. The current default value of true is significantly more expensive than leaving it disabled and has been reported by the community as a source of significant unintended cost. #39858

Disallow use of SingleNestedBlock in resource schemas

This change should not generally be practitioner facing and will not require resource config updates. However there may be reliance on the previous state structure in scripts or outputs. In such cases, they will need to update references accordingly (e.g., changing attribute.thing to attribute[0].thing).

This will include changes to the following resources and attributes

Resource Attribute
aws_bedrock_model_invocation_logging_configuration logging_config, cloudwatch_config, large_data_delivery_s3_config, s3_config
aws_lb_listener_rule authenticate_cognito, authenticate_oidc, fixed_response, forward, stickiness, redirect, host_header, http_header, http_request_method, path_pattern, query_string, source_ip
aws_opensearchserverless_security_config saml_options
aws_paymentcryptography_key key_attributes, key_modes_of_use
aws_rekognition_stream_processor bounding_box
aws_resiliencehub_resiliency_policy policy az, hardware, software, and region
aws_verifiedpermissions_schema definition

Nullable Boolean Values Behavior Change

We will update the TypeNullableBool schema type, for the 14 plugin SDK resources that use it, to remove support for the values “0” and “1,” which were previously deprecated. Currently, users can set these attributes to an empty string, “false,” “true,” “0,” or “1.” We will restrict the allowed values to only "", “false,” and “true” to align with modern Terraform practices and ensure clearer, more consistent behavior. This change will enforce the use of false or true for boolean values, improving the integrity of the configuration. Any configurations currently using “0” or “1” for boolean attributes will result in an error when applied. Users will need to update their configurations to use either an empty string, false, or true to avoid errors. While this change enforces stricter validation, it will improve consistency and reduce ambiguity in handling boolean values.

Type Name Attribute
Resource aws_ec2_launch_template delete_on_termination, encrypted, ebs_optimized, associate_carrier_ip_address, associate_public_ip_address, primary_ipv6
Resource aws_accessanalyzer_archive_rule exists
Resource aws_cloudtrail_event_data_store suspend
Resource aws_spot_fleet_request terminate_instances_on_delete
Resource aws_elasticache_cluster auto_minor_version_upgrade
Resource aws_elasticache_replication_group at_rest_encryption_enabled, auto_minor_version_upgrade
Resource aws_lb_target_group preserve_client_ip
Resource aws_evidently_feature bool_value
Resource aws_imagebuilder_container_recipe delete_on_termination, encrypted
Resource aws_imagebuilder_image_recipe delete_on_termination, encrypted
Data Source aws_imagebuilder_image_recipe delete_on_termination, encrypted
Resource aws_mq_broker audit
Data Source aws_mq_broker audit

Resource Structure Changes

  • aws_securitylake_aws_log_source - We will move all the sub-attributes of the source attribute to top-level attributes to simplify configurations. #37160

Non-User Facing Changes

Removal of aws-sdk-go (V1)

We have completed the migration of the provider codebase to use v2 of the AWS SDK. The only remaining holdout is the single SimpleDB resource which is due to be removed in this version as this service is not supported in v2 of the SDK. Users of SimpleDB will need to continue to use v5 of the provider.

Upgrade to Go 1.24

Go 1.24 introduces several performance optimizations, security enhancements, and standard library improvements that benefit large-scale applications like the Terraform AWS Provider. By staying current with Go releases, we ensure compatibility with modern tooling and libraries while leveraging the latest language and runtime improvements. Additionally, Go 1.24 may offer optimizations that improve provider execution efficiency, reducing memory usage, and improving runtime performance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementRequests to existing resources that expand the functionality or scope.service/apigatewayIssues and PRs that pertain to the apigateway service.service/batchIssues and PRs that pertain to the batch service.service/cloudfrontIssues and PRs that pertain to the cloudfront service.service/cognitoidpIssues and PRs that pertain to the cognitoidp service.service/directconnectIssues and PRs that pertain to the directconnect service.service/dmsIssues and PRs that pertain to the dms service.service/ec2Issues and PRs that pertain to the ec2 service.service/eksIssues and PRs that pertain to the eks service.service/elasticacheIssues and PRs that pertain to the elasticache service.service/elbv2Issues and PRs that pertain to the elbv2 service.service/globalacceleratorIssues and PRs that pertain to the globalaccelerator service.service/identitystoreIssues and PRs that pertain to the identitystore service.service/networkmanagerIssues and PRs that pertain to the networkmanager service.service/opensearchIssues and PRs that pertain to the opensearch service.service/quicksightIssues and PRs that pertain to the quicksight service.service/rdsIssues and PRs that pertain to the rds service.service/redshiftIssues and PRs that pertain to the redshift service.service/securitylakeIssues and PRs that pertain to the securitylake service.service/servicediscoveryIssues and PRs that pertain to the servicediscovery service.service/ssmIssues and PRs that pertain to the ssm service.service/wafv2Issues and PRs that pertain to the wafv2 service.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions