NOTE: we can use multiple services from one account. we can use tag for each resource. ==local value is a good concept than tags == if we need to change tag only we need to change local value.
vim aaa.tf
provider "aws" {
region = "us-east-1"
access_key = "AUGQ"
secret_key = "Kft1aurid"
}
locals {
common_tag = {
Name = "uk-project"
Owner = "moon"
}
}
locals {
usa = {
Name = "us-pro"
}
}
resource "aws_instance" "web" {
ami = "ami-0ed9277fb7eb570c9"
instance_type = "t3.micro"
tags = local.common_tag
}
resource "aws_vpc" "main" {
cidr_block = "10.0.0.0/16"
instance_tenancy = "default"
tags = local.common_tag
}
resource "aws_ebs_volume" "example" {
availability_zone = "us-east-1a"
size = 40
tags = local.common_tag
}
resource "aws_instance" "us1" {
ami = "ami-0ed9277fb7eb570c9"
instance_type = "t3.micro"
tags = local.usa
}
resource "aws_vpc" "us2" {
cidr_block = "10.0.0.0/16"
instance_tenancy = "default"
tags = local.usa
}
resource "aws_ebs_volume" "us3" {
availability_zone = "us-east-1a"
size = 40
tags = local.usa
}
No comments:
Post a Comment