terraform
$ terraform version
Terraform v0.12.20 + provider.aws v2.18.0
terraform init
config_file:main.tf
terraform plan
terraform apply
terraform destroy
terraform Example01
Example output
file:security/output.tf output "secgropu01" { value = aws_security_group.custom-sg01.id } file:iam/output.tf output "aws_iam_instance_profile" { value = aws_iam_instance_profile.tf-ec2-profile.name } ...
Example remote state(but, use local stored metadata!)
file:base/ec2.tf data terraform_remote_state "tf-security-group01" { backend = "local" config = { path = "../security/terraform.tfstate" } } ... resource "aws_instance" "ec2-al2-host01" { ami = data.aws_ssm_parameter.al_ami.value instance_type = "t2.micro" subnet_id = data.terraform_remote_state.tf-public-network01.outputs.subnet-az01_id iam_instance_profile = data.terraform_remote_state.tf-iam.outputs.aws_iam_instance_profile vpc_security_group_ids = [ data.terraform_remote_state.tf-security-group01.outputs.secgroup01 ] key_name = "some_key" tags = { Name = "ec2-al2-host01" } }