Reputation: 11
I have to create a server in 30 AWS providers.
i tried copy providers with "count", "alias" and variable block "type=list(string)", but got this message:
The provider argument name "count" is reserved for use by Terraform in a future version.
but it is too hard to type and manage 30 providers in a main.tf
.
Here is my main.tf
:
terraform {
required_providers {
aws={
source = "Hashicorp/aws"
version="~> 4.0"
}
}
}
provider "aws" {
count = 6
region = var.region
alias = "man01_${count.index}"
access_key = var.list_ak["${count.index}"]
secret_key = var.list_sk["${count.index}"]
}
data "aws_instance" "man01_instance" {
count = 6
provider = "aws.man01_${count.index}"
...
}
I don't have any idea about this...
Upvotes: 0
Views: 1125
Reputation: 718
This is (as of Aug 2022) not possible with pure Terraform. The ability for providers using for_each
or count
is a long standing request in the Terraform GitHub project (link).
Upvotes: 1