【发布时间】:2022-07-28 00:20:44
【问题描述】:
我在根模块 my_terraform 中使用 terraform aws 提供程序 default_tags 块。该模块有一个名为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.
有没有办法解决这个问题?
【问题讨论】:
-
我认为错误信息具有误导性。该错误实际上是针对已声明模块中的提供程序配置引发的。绝对不鼓励这种模式,但它也可能是那个版本的错误。
标签: terraform terraform-provider-aws