我正在使用Terraform AWS提供者中的default_tags
块在根模块my_terraform
中。该模块具有名为my_submodule
的子模块,并且我想在该子模块中有其他默认标记。我尝试在my_terraform/my_submodule/main.tf
中执行此操作:
provider "aws" {
default_tags {
tags = {
"extra_tag" = "something"
}
}
}
但是我收到了这个错误:
$ 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.
有没有什么办法可以解决这个问题?