Skip to content

Support Region Parameter for Resources #92

@RoseSecurity

Description

@RoseSecurity

Slack Community

Describe the Feature

Add support for a region parameter in awsutils resources, similar to the functionality available in the AWS 6.0 provider. Since AWSUtils uses a similar authentication mechanism for custom resources, it would be beneficial to include region-level configuration directly in the resources themselves rather than requiring separate provider instances.

Expected Behavior

Resources should accept a region parameter that allows them to operate in different AWS regions without needing to configure multiple provider instances. This would enable users to manage resources across multiple regions using a single provider configuration.

Use Case

Currently, we need to configure approximately 15 separate awsutils provider instances, each with a different region, to delete default VPCs across all regions. This approach is verbose and difficult to maintain. With a region parameter, we could use a single provider configuration and iterate over regions more elegantly, significantly reducing boilerplate code and improving maintainability.

Describe Ideal Solution

provider "awsutils" {}

resource "awsutils_default_vpc_deletion" "region_us_east_1" {
  region = "us-east-1"
}

resource "awsutils_default_vpc_deletion" "region_us_east_2" {
  region = "us-east-2"
}

This approach would allow for cleaner iteration patterns, such as using for_each with a list of regions, making it much easier to manage multi-region deployments.

Alternatives Considered

The current approach of using multiple provider aliases works but creates significant overhead. Each provider instance requires separate configuration and makes the code harder to read and maintain. Another alternative would be using modules with provider passing, but this adds unnecessary complexity for what should be a simpler operation.

Additional Context

This feature would align the awsutils provider with modern Terraform patterns and significantly improve the developer experience when working with multi-region AWS resources.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions