google-cloud-platform - 带有 GCP 模块的 Terraform
问题描述
我开始使用带有 GCP 模块的 terraform,我是 Terraform 的新手。
我在 Terraform 中下载并放置了 GCP 模块(如“ Google VM ”)以使用它。
我在 google VM 模块之外创建了 main.tf 文件,我将这个模块称为“示例”文件夹中提供的 示例我将此示例复制/粘贴到我的带有 var.tfvars 的 main.tf 文件中(我放变量的地方)
当我执行“地形计划”时,我遇到了类似的错误
│ Error: Reference to undeclared input variable│
│ on main.tf line 31, in module "instance_template":
│ 31: project_id = var.project_id│
│ An input variable with the name "project_id" has not been declared. This variable can be declared with a variable "project_id" {} block.
我想我忘记了一些东西....变量必须在模块中设置,而不是在根模块(tfvars)中?
感谢您的帮助
解决方案
推荐阅读
- sql - 从关键字后面的字符串中选择文本
- ios - 例外:设置通知时“时间间隔必须大于 0”
- javascript - 如何处理 for 循环中的异步 $http,js?
- javascript - Flask/HTML:使用按钮显示确认消息,然后重定向
- sql - 检查选择列 ASP.NET C# 的数据库中是否存在值
- imagemagick - 使用 ImageMagick 旋转透明 png 文件
- javascript - 通过打字稿中的动态键获取对象值
- angular - Abp-Identity-permission Angular UI 在 2.9 版的策略标头和标签上显示 uuid/guid
- algorithm - 图灵机和密码
- facebook-graph-api - 使用 Marketing API 获取 AdInsights 并按小时细分,但没有返回每小时数据