-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
46 lines (40 loc) · 1.01 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 4.40"
}
}
required_version = ">= 1.2.0"
}
provider "aws" {
region = "us-east-1"
profile = "cloudProject"
}
module "vpc" {
source = "./modules/vpc_mod"
}
module "security_group" {
source = "./modules/security_group_mod"
name = "instance-sg"
description = "security group for production grade web servers"
vpc_id = module.vpc.id
ingress = var.ingress
}
module "subnet" {
source = "./modules/subnet_mod"
vpc_id = module.vpc.id
availability_zone = "us-east-1a"
}
module "instance" {
source = "./modules/instance_mod"
subnet_id = module.subnet.id
vpc_security_group_ids = [module.security_group.id]
for_each = var.instances
ami = each.value.ami
instance_type = each.value.instance_type
}
resource "aws_iam_user" "new_user" {
for_each = var.users
name = each.value.name
}