-
Notifications
You must be signed in to change notification settings - Fork 0
/
resources.tf
66 lines (56 loc) · 1.94 KB
/
resources.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
##################################################################################
# PROVIDERS
##################################################################################
provider "aws" {
region = var.region
}
##################################################################################
# DATA
##################################################################################
data "aws_availability_zones" "available" {}
##################################################################################
# RESOURCES
##################################################################################
locals {
common_tags = {
Environment = var.environment
BillingCode = var.billing_code
Workspace = terraform.workspace
}
}
module "main" {
source = "terraform-aws-modules/vpc/aws"
version = "5.0.0"
name = var.prefix
cidr = var.cidr_block
azs = slice(data.aws_availability_zones.available.names, 0, length(var.public_subnets))
public_subnets = [for k, v in var.public_subnets : v]
public_subnet_names = [for k, v in var.public_subnets : "${var.prefix}-${k}"]
enable_dns_hostnames = true
public_subnet_suffix = ""
public_route_table_tags = { Name = "${var.prefix}-public" }
map_public_ip_on_launch = true
enable_nat_gateway = false
tags = local.common_tags
}
resource "aws_security_group" "ingress" {
description = "Security group with no ingress rule"
egress = [{
cidr_blocks = ["0.0.0.0/0"]
description = ""
from_port = 0
ipv6_cidr_blocks = []
prefix_list_ids = []
protocol = "-1"
security_groups = []
self = false
to_port = 0
}]
ingress = []
name = "no-ingress-sg"
name_prefix = null
revoke_rules_on_delete = null
tags = local.common_tags
tags_all = {}
vpc_id = module.main.vpc_id
}