通过云教程使用变量的问题

Joh*_*Fox 3 terraform terraform-provider-aws terraform-cloud

我\xe2\x80\x99m 完成本教程并设法将一切设置正常。

\n

https://learn.hashicorp.com/tutorials/terraform/cloud-workspace-configure?in=terraform%2Fcloud-get-started

\n

在对计划进行排队时,我收到以下与变量相关的错误,但无法深入了解它。

\n

有人对如何推进此事有任何想法吗?谢谢

\n

希望这将是一个很容易启动和运行的过程!

\n
Configuring remote state backend...\nInitializing Terraform configuration...\n\nWarning: Value for undeclared variable\n\nThe root module does not declare a variable named "tag_user_name" but a value\nwas found in file "/terraform/terraform.tfvars". To use this value, add a\n"variable" block to the configuration.\n\nUsing a variables file to set an undeclared variable is deprecated and will\nbecome an error in a future release. If you wish to provide certain "global"\nsettings to all configurations in your organization, use TF_VAR_...\nenvironment variables to set these instead.\n\n\nError: No value for required variable\n\n  on variables.tf line 6:\n   6: variable "aws_access_key_id" {\n\nThe root module input variable "aws_access_key_id" is not set, and has no\ndefault value. Use a -var or -var-file command line argument to provide a\nvalue for this variable.\n\n\nError: No value for required variable\n\n  on variables.tf line 10:\n  10: variable "aws_secret_access_key" {\n\nThe root module input variable "aws_secret_access_key" is not set, and has no\ndefault value. Use a -var or -var-file command line argument to provide a\nvalue for this variable.\n
Run Code Online (Sandbox Code Playgroud)\n

小智 7

我按照此处描述的步骤进行操作,但遇到了类似的问题: https: //learn.hashicorp.com/tutorials/terraform/aws-remote ?in=terraform/certification-associate-tutorials

如果我在 Terraform Cloud 中创建变量时选择“Terraform 变量”选项,则会向我显示上述错误。

我通过在创建 AWS_ACCESS_KEY_ID 和 AWS_SECRET_ACCESS_KEY 变量时选择“环境变量”解决了该问题。