Questions tagged «terraform»

5
Terraform-使用带计数的嵌套循环
我正在尝试在Terraform中使用嵌套循环。我有两个列表变量list_of_allowed_accounts和list_of_images,并且希望遍历list list_of_images,然后遍历list list_of_allowed_accounts。 这是我的Terraform代码。 variable "list_of_allowed_accounts" { type = "list" default = ["111111111", "2222222"] } variable "list_of_images" { type = "list" default = ["alpine", "java", "jenkins"] } data "template_file" "ecr_policy_allowed_accounts" { template = "${file("${path.module}/ecr_policy.tpl")}" vars { count = "${length(var.list_of_allowed_accounts)}" account_id = "${element(var.list_of_allowed_accounts, count.index)}" } } resource "aws_ecr_repository_policy" "repo_policy_allowed_accounts" { count …
18 terraform  count 

3
Terraform:为远程状态文件选择凭据
我在Terraform中拥有现有的基础架构,并且已经使用了一段时间。最近,我交换了本地笔记本电脑的AWS凭据(凭据存储在中~/.aws/credentials),直到我重新设置这些凭据后,它才停止工作。 问题是我在Terraform源代码中声明了凭据,但似乎根本没有使用它们。 terraform { backend "s3" { bucket = "example_tf_states" key = "global/vpc/us_east_1/example_state.tfstate" encrypt = true region = "us-east-1" } } provider "aws" { access_key = "${var.access_key}" secret_key = "${var.secret_key}" region = "${var.region}" } variable "access_key" { default = "<hidden_for_stack_exchange_post>" } variable "secret_key" { default = "<hidden_for_stack_exchange_post>" } variable "region" …
10 terraform 
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.