main.tf
terraform init --> to download aws provider files if not there.
terraform validate --> to check tf file
terraform plan --> to see what happens
terraform apply --> to deploy the changes
provider "aws"{ region = "us-west-2" access_key = "<access_key_aws>" secret_key = "<secret_key_aws>" } resource "aws_instance" "myfirst"{ ami = "ami-0a7d051a1c4b54f65" instance_type = "t2.micro" key_name = "<key_pair_aws>" security_groups = ["<secuirty_group_aws>"] } resource "aws_security_group" "allow_all"{ name = "allow_all" description = "Allow all inbound traffic" vpc_id = "<vpc_id_aws>" ingress { from_port = 0 to_port = 0 protocol = "-1" cidr_blocks = ["0.0.0.0/0"] } egress { from_port = 0 to_port = 0 protocol = "-1" cidr_blocks = ["0.0.0.0/0"] } }
terraform init --> to download aws provider files if not there.
terraform validate --> to check tf file
terraform plan --> to see what happens
terraform apply --> to deploy the changes
No comments:
Post a Comment