Skip to content

Support for AWS Provider v6 region attribute in example karpenter #3537

Description

@moko-poi

Is your request related to a new offering from AWS?

Yes
This functionality is available in the AWS provider for Terraform starting from v6.0.0.
The provider now supports specifying the region argument directly in individual resources and data sources, eliminating the need for multiple aliased provider configurations.

Is your request related to a problem? Please describe.

In the current examples/karpenter/main.tf, multiple aws provider blocks are used to handle resources across two regions (e.g., region = local.region and alias = "virginia").
However, since AWS Provider v6.0.0, users can define a single provider and specify region directly in each resource.
This example may confuse users migrating to v6, as it reflects a pre-v6 configuration pattern.

Describe the solution you'd like.

Update the examples/karpenter/main.tf to use a single aws provider configuration, with resource-level region attributes instead of multiple provider blocks.
Example:

provider "aws" {
  region = local.region
}

resource "aws_s3_bucket" "replica" {
  bucket = "example-replica"
  region = "us-east-1"
}

This reflects the modern, simplified multi-region usage pattern introduced in v6.

Describe alternatives you've considered.

  • Keeping the existing dual-provider configuration (still valid, but deprecated for most use cases).
  • Adding a note to the README explaining that the multiple-provider pattern is optional in v6.
    However, updating the example itself provides a clearer and more practical demonstration for new users.

Additional context

  • The karpenter example currently defines two AWS providers:

    provider "aws" {
      region = local.region
    }
    
    provider "aws" {
      region = "us-east-1"
      alias  = "virginia"
    }
  • As of AWS Provider v6, this pattern can be simplified.

  • Reference: AWS Provider v6 Changelog

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions