'terraform aws provider: add default tags in sub-module
I'm using terraform aws provider default_tags block in a root module my_terraform. That module has a submodule called my_submodule, and I would like to have additional default tags in that submodule. I tried this in my_terraform/my_submodule/main.tf:
provider "aws" {
default_tags {
tags = {
"extra_tag" = "something"
}
}
}
But I get this error:
$ terraform init
Initializing modules...
- my_terraform.my_submodule in my_terraform/my_submodule
There are some problems with the configuration, described below.
The Terraform configuration must be valid before initialization so that
Terraform can determine which modules and providers need to be installed.
╷
│ Error: Module module.my_submodule contains provider configuration
│
│ Providers cannot be configured within modules using count, for_each or depends_on.
Is there any way around this?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
