1
0
Fork 0
terraform-training/09_aws_vpc/base.tf

23 lines
510 B
Terraform
Raw Normal View History

2020-05-14 10:33:26 +02:00
provider "aws" {
region = var.region
}
resource "aws_key_pair" "default" {
key_name = "cedric-key"
public_key = file(var.key_path)
}
resource "aws_instance" "webserver" {
ami = var.ami
instance_type = "t2.micro"
key_name = aws_key_pair.default.id
subnet_id = aws_subnet.public-subnet1.id
vpc_security_group_ids = [ aws_security_group.sg.id ]
associate_public_ip_address = true
source_dest_check = false
user_data = file(var.userdata_file)
tags = {
Name = "cedric-webserver"
}
}