Skip to content

region meta-argument #25308

Closed
Closed
@timkye-blueocean-ai

Description

@timkye-blueocean-ai

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

I think all resources should have a new region meta-argument that allowed it to override the region of the provider it was using.

This would unlock a long-standing issue with dynamic terraform configurations: it would allow for_each or count to iterate over an array of regions and deploy to each one.

AWS Credentials are not inherently region-locked, and one set of credentials generally has the same permissions in all regions. There is nothing intrinsic about the provider-region relationship in AWS.

I get that this is a huge ask. In all likelihood it would be a major breaking change. I think defaulting to the region on the provider makes sense, but that may not be workable under-the-hood in or in all cases. However, I still think it would be worth it. The ability to dynamic deploy to multiple regions, or deploy one resource (e.g. ACM Cert) to a unique region without setting up a unique provider for it, would be huge.

hashicorp/terraform#25244

New or Affected Resource(s)

Literally all of them.

Potential Terraform Configuration

variable regions {
  type    = list(string)
  default = ["us-west-2", "us-east-1"]
}

resource "aws_lambda_function" "this" {
  count  = length(var.regions)
  region = var.regions[count.index]
  
  
  filename         = var.filename
  function_name    = var.function_name
  // a bunch of other props
}

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementRequests to existing resources that expand the functionality or scope.service/lambdaIssues and PRs that pertain to the lambda service.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions