Skip to content

Commit

Permalink
Create main.tf
Browse files Browse the repository at this point in the history
  • Loading branch information
misha-c authored May 7, 2021
1 parent 2e541f7 commit e2cc715
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions modules/aws/ec2/instance/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
resource "aws_instance" "web" {
for_each = toset( var.instance_names )
ami = var.image_id
instance_type = var.instance_type
key_name = var.key_name
tags = merge(var.tags,{ Name = each.key })
vpc_security_group_ids = var.security_groups
user_data = var.user_data
}

variable "server_type" {
default = "web"
}
variable "instance_names" {
default = ["web1"]
}
variable "image_id" {
default = "ami-0bbfeb6eccdd084e1"
}
variable "instance_type" {
default = "t2.micro"
}
variable "key_name" {
default = "m2c.class3"
}
variable "security_groups" {type = list(string)}
variable "tags" {
default = {}
}
variable "user_data" {
default = ""
}
output "instances" {
value = aws_instance.web
}

0 comments on commit e2cc715

Please sign in to comment.