正如您在下面看到的,我尝试将特定的提供程序传递给模块,然后该模块将其作为主提供程序传递(aws = aws.some_profile)给第二个嵌套模块。
我收到terraform plan以下错误:
Error: missing provider module.module_a.provider["registry.terraform.io/hashicorp/aws"].some_profile
我一定是犯了一些基本错误,或者假设该语言以一种它不工作的方式工作。有想法吗?
\n文件结构:
\n\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 main.tf\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 module_a\n\xe2\x94\x82 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 main.tf\n\xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 module_b\n\xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 main.tf\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 providers.tf\nRun Code Online (Sandbox Code Playgroud)\nmain.tf(顶层):
\nmodule "module_a" {\n source = "./module_a"\n providers = {\n aws.some_profile = aws.some_profile\n }\n}\nRun Code Online (Sandbox Code Playgroud)\nmain.tf(在 module_a 内):
\nmodule "module_b" {\n source = "./module_b"\n providers = {\n aws = aws.some_profile\n }\n}\nRun Code Online (Sandbox Code Playgroud)\nmain.tf(模块 b 内部):
\nresource "null_resource" "null" {}\nRun Code Online (Sandbox Code Playgroud)\n提供商.tf:
\nterraform {\n required_providers {\n …Run Code Online (Sandbox Code Playgroud)