terraform instance count code example
Example 1: how to define provider in resource block
provider "google" {
region = "us-central1"
}
provider "google" {
alias = "europe"
region = "europe-west1"
}
resource "google_compute_instance" "example" {
provider = google.europe
}
Example 2: repetitive resource use in different region terraform
provider "aws" {
region = "us-west-1"
access_key = "PUT-ACCESS-KEY"
secret_key = "PUT-SECRET-KEY"
}
provider "aws" {
alias = "mumbai"
region = "ap-south-1"
access_key = "PUT-ACCESS-KEY"
secret_key = "PUT-SECRET-KEY"
}
resource "aws_eip" "eip1" {
vpc = "true"
}
resource "aws_eip" "eip2" {
vpc = "true"
provider = aws.mumbai
}