I am currently working on implementing my own terraform provider. In my use case I have some static properties that I have to set for all of my resources, like the region the resource is living in.
To avoid working with variables and having to copy and paste all those region_name = var.default_region_name
statements to all of my resources I am looking for a way to encapsulate those values somewhere else.
My idea was to do that in the provider configuration like this:
provider "example_provider" {
default_region_name = "ww"
}
resource "example_resource" "example" {
name = "example"
//region_name = "ww"
}
While reading through the documentation I could not find an example that is accessing the provider config within a resource. Does anyone know how to do that or has a better idea on how I can handle my static configuration without the need of copy and pasting it to all resources?
Thank you in advance! :)