QT-DevOps / DevOpsIssues

This Repo will be used to demonstrate the Skills & Questions in DevOps
Apache License 2.0
27 stars 130 forks source link

Error: Invalid AWS Region: var.region #1000

Open prashanth-1212 opened 3 years ago

prashanth-1212 commented 3 years ago

provider "aws" { region ="var.region" access_key="var.access_key" secret_key ="var.secret_key"

} resource "aws_instance" "first" { ami="var.ami" instance_type="var.instance_type" key_name="var.key_name" security_groups=["launch-wizard-4"] }

resource "aws_instance" "second" { ami="var.ami" instance_type="var.instance_type" key_name="var.key_name" security_groups=["launch-wizard-4"] } resource "aws_security_group" "allow_all" { name ="allow_all" description ="Allow all inbound traffic" vpc_id ="vpc-44c8702f"

ingress { description = "TLS from VPC" 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"] }

}

variable is written in separate file

variable "region" { default ="us-east-2" }

variable "access_key" { type="string" } variable "secret_key" { type="string" } variable "ami" { default="ami-01427db6ea87e11b0" } variable "instance_type" { default="t2.micro"

}

variable "key_name" { default="devops"

} getting error invalid aws region

sivasankardevops commented 3 years ago

try with default = us-east-2. I mean without quotes

santhoshd402 commented 3 years ago

Yes correct try without quotes