Initial commit
This commit is contained in:
commit
367f7bcb1e
7 changed files with 739 additions and 0 deletions
26
main.tf
Normal file
26
main.tf
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
provider "aws" {
|
||||
region = "us-east-2"
|
||||
}
|
||||
|
||||
# A local variable that chooses a free-tier instance type depending on region
|
||||
locals {
|
||||
# In some newer regions, t2.micro isn't available, so we fall back to t3.micro
|
||||
free_tier_instance_type = contains(
|
||||
["us-east-1", "us-west-1", "us-west-2", "eu-west-1", "ap-southeast-1"],
|
||||
var.region
|
||||
) ? "t2.micro" : "t3.micro"
|
||||
}
|
||||
|
||||
# Add a variable so you can override region easily if needed
|
||||
variable "region" {
|
||||
default = "us-east-2"
|
||||
}
|
||||
|
||||
resource "aws_instance" "example" {
|
||||
ami = "ami-0fb653ca2d3203ac1"
|
||||
instance_type = local.free_tier_instance_type
|
||||
|
||||
tags = {
|
||||
Name = "terraform-example"
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue