Skip to content

Commit

Permalink
add module_name
Browse files Browse the repository at this point in the history
  • Loading branch information
badra001 committed May 24, 2022
1 parent d27f0a2 commit 54c4b76
Show file tree
Hide file tree
Showing 35 changed files with 175 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,7 @@
- flowlogs-role
- source aws-iam-role?ref=tf-upgrade
-remove module call, incorporate necessary role code

* 2.0.1 -- 2022-05-24
- update map() and list() to tf 1.x compatible things
- add tf_module_name tag
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# This submodule creates the following resources, using a typical deployment configuration that we follow:
# * VPC
# * Route tables (one per availability zone)
# * Subnets, public and private (one of each label per availability zone)
# * Network ACLs
# * Base security groups
# * VPN components (optional)
# * Internet Gateway and NAT gateway (optional)
#
# This module also includes a submodule to setup VPC peering.

#---
# security groups
#---
module "security-groups"
# source = "git@github.e.it.census.gov:terraform-modules/aws-vpc-setup.git//security-groups"
source = "${path.module}/../security-groups"
vpc_id = aws_vpc.vpc.id
vpc_full_name = var.vpc_full_name
vpc_environment = var.vpc_environment
tags = {}
}

#---
# VPNs on per site
#---
3 changes: 3 additions & 0 deletions common/module_name.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
locals {
_module_name = "aws-vpc-setup"
}
18 changes: 17 additions & 1 deletion common/version.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
locals {
_module_version = "2.0.0"
_module_version = "2.0.1"
_module_names = {
"_main_" = "aws-vpc-setup"

"flowlogs" = "aws-vpc-setup//flowlogs"
"flowlogs-role" = "aws-vpc-setup//flowlogs-role"
"nacl-rules" = "aws-vpc-setup//nacl-rules"
"nacls" = "aws-vpc-setup//nacls"
"peer" = "aws-vpc-setup//peer"
"routing" = "aws-vpc-setup//routing"
"security-groups" = "aws-vpc-setup//security-groups"
"subnets" = "aws-vpc-setup//subnets"
"vpc" = "aws-vpc-setup//vpc"
"vpc-interface-endpoint" = "aws-vpc-setup//vpc-interface-endpoint"
"vpn" = "aws-vpc-setup//vpn"
"vpn-transit-gateway" = "aws-vpc-setup//vpn-transit-gateway"
}
}
27 changes: 27 additions & 0 deletions examples/quotas/quotas.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# % aws --profile $(get-profile) --region $(get-region) service-quotas list-services
# % aws --profile $(get-profile) --region $(get-region) service-quotas list-service-quotas --service-code s3
# % aws --profile $(get-profile) --region $(get-region) service-quotas list-aws-default-service-quotas --service-code s3
#
# {
# "ServiceCode": "s3",
# "ServiceName": "Amazon Simple Storage Service (Amazon S3)",
# "QuotaArn": "arn:aws-us-gov:servicequotas:us-gov-west-1::s3/L-DC2B2D3D",
# "QuotaCode": "L-DC2B2D3D",
# "QuotaName": "Buckets",
# "Value": 100.0,
# "Unit": "None",
# "Adjustable": true,
# "GlobalQuota": false
# },

locals {
quotas = yamldecode(file("quotas.yml"))
quota_map = { for v in local.quotas.quotas : format("%v:%v", v.service_code, v.quota_code) => v }
}

resource "aws_servicequotas_service_quota" "quotas" {
for_each = local.quota_map
quota_code = each.value.quota_code
service_code = each.value.service_code
value = each.value.value
}
31 changes: 31 additions & 0 deletions examples/quotas/quotas.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
quotas:
- description: "EBS SSD gp2 size increase"
service_code: ebs
quota_code: "L-D18FCD1D"
default_value: 300
value: 1500


# structure of each item
# description: string, like a comment describing what this is doing, maybe why. It is currently only for documenting the request
# service_code: string, required, the specific service for which the quota will be submitted. comes from
# aws --profile PROFILE --region REGION service-quotas list-services
# quota_code: string, required, the specific quota code for the service. Comes from:
# aws --profile PROFILE --region REGION service-quotas list-service-quotas --service-code SERVICE_CODE
# default_value: string, optional, used for indicating the default value (maybe ned to change to previous?). Comes from:
# aws --profile PROFILE -region REGION service-quotas list-aws-default-service-quotas --service-code SERVICE_CODE
# value: number, required, used to indicate the new value requestd
#
# example from list from default_value
#
# {
# "ServiceCode": "s3",
# "ServiceName": "Amazon Simple Storage Service (Amazon S3)",
# "QuotaArn": "arn:aws-us-gov:servicequotas:us-gov-west-1::s3/L-DC2B2D3D",
# "QuotaCode": "L-DC2B2D3D",
# "QuotaName": "Buckets",
# "Value": 100.0,
# "Unit": "None",
# "Adjustable": true,
# "GlobalQuota": false
# },
1 change: 1 addition & 0 deletions flowlogs-role/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ locals {

base_tags = {
"boc:tf_module_version" = local._module_version
"boc:tf_module_name" = lookup(local._module_names, local._module_name, local._module_names["_main_"])
"boc:created_by" = "terraform"
}
}
Expand Down
3 changes: 3 additions & 0 deletions flowlogs-role/module_name.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
locals {
_module_name = "flowlogs-role"
}
15 changes: 11 additions & 4 deletions flowlogs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,22 @@ module "flowlogs" {

## Requirements

No requirements.
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.66.0 |
| <a name="requirement_ldap"></a> [ldap](#requirement\_ldap) | >= 0.5.4 |
| <a name="requirement_null"></a> [null](#requirement\_null) | >= 3.0 |
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 3.0 |
| <a name="requirement_template"></a> [template](#requirement\_template) | >= 2.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | n/a |
| <a name="provider_null"></a> [null](#provider\_null) | n/a |
| <a name="provider_template"></a> [template](#provider\_template) | n/a |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.66.0 |
| <a name="provider_null"></a> [null](#provider\_null) | >= 3.0 |
| <a name="provider_template"></a> [template](#provider\_template) | >= 2.0 |

## Modules

Expand Down
1 change: 1 addition & 0 deletions flowlogs/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ locals {

base_tags = {
"boc:tf_module_version" = local._module_version
"boc:tf_module_name" = lookup(local._module_names, local._module_name, local._module_names["_main_"])
"boc:created_by" = "terraform"
}

Expand Down
3 changes: 3 additions & 0 deletions flowlogs/module_name.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
locals {
_module_name = "flowlogs"
}
2 changes: 2 additions & 0 deletions nacl-rules/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ module "nacls_enterprise" {

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.66.0 |
| <a name="requirement_ldap"></a> [ldap](#requirement\_ldap) | >= 0.5.4 |
| <a name="requirement_null"></a> [null](#requirement\_null) | >= 3.0 |
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 3.0 |
| <a name="requirement_template"></a> [template](#requirement\_template) | >= 2.0 |
Expand Down
1 change: 1 addition & 0 deletions nacl-rules/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ locals {

base_tags = {
"boc:tf_module_version" = local._module_version
"boc:tf_module_name" = lookup(local._module_names, local._module_name, local._module_names["_main_"])
"boc:created_by" = "terraform"
}
}
Expand Down
3 changes: 3 additions & 0 deletions nacl-rules/module_name.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
locals {
_module_name = "nacl-rules"
}
1 change: 1 addition & 0 deletions nacls/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ locals {

base_tags = {
"boc:tf_module_version" = local._module_version
"boc:tf_module_name" = lookup(local._module_names, local._module_name, local._module_names["_main_"])
"boc:created_by" = "terraform"
}

Expand Down
3 changes: 3 additions & 0 deletions nacls/module_name.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
locals {
_module_name = "nacls"
}
2 changes: 2 additions & 0 deletions peer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ module "peer_services" {

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.66.0 |
| <a name="requirement_ldap"></a> [ldap](#requirement\_ldap) | >= 0.5.4 |
| <a name="requirement_null"></a> [null](#requirement\_null) | >= 3.0 |
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 3.0 |
| <a name="requirement_template"></a> [template](#requirement\_template) | >= 2.0 |
Expand Down
1 change: 1 addition & 0 deletions peer/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ locals {

base_tags = {
"boc:tf_module_version" = local._module_version
"boc:tf_module_name" = lookup(local._module_names, local._module_name, local._module_names["_main_"])
"boc:created_by" = "terraform"
}
}
Expand Down
3 changes: 3 additions & 0 deletions peer/module_name.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
locals {
_module_name = "peer"
}
1 change: 1 addition & 0 deletions routing/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ locals {

base_tags = {
"boc:tf_module_version" = local._module_version
"boc:tf_module_name" = lookup(local._module_names, local._module_name, local._module_names["_main_"])
"boc:created_by" = "terraform"
}

Expand Down
3 changes: 3 additions & 0 deletions routing/module_name.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
locals {
_module_name = "routing"
}
1 change: 1 addition & 0 deletions security-groups/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ locals {

base_tags = {
"boc:tf_module_version" = local._module_version
"boc:tf_module_name" = lookup(local._module_names, local._module_name, local._module_names["_main_"])
"boc:created_by" = "terraform"
}
}
Expand Down
3 changes: 3 additions & 0 deletions security-groups/module_name.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
locals {
_module_name = "security-groups"
}
1 change: 1 addition & 0 deletions subnets/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ locals {

base_tags = {
"boc:tf_module_version" = local._module_version
"boc:tf_module_name" = lookup(local._module_names, local._module_name, local._module_names["_main_"])
"boc:created_by" = "terraform"
}

Expand Down
3 changes: 3 additions & 0 deletions subnets/module_name.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
locals {
_module_name = "subnets"
}
2 changes: 2 additions & 0 deletions vpc-interface-endpoint/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ These are not included in the module because they don't exist until the resource

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.66.0 |
| <a name="requirement_ldap"></a> [ldap](#requirement\_ldap) | >= 0.5.4 |
| <a name="requirement_null"></a> [null](#requirement\_null) | >= 3.0 |
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 3.0 |
| <a name="requirement_template"></a> [template](#requirement\_template) | >= 2.0 |
Expand Down
1 change: 1 addition & 0 deletions vpc-interface-endpoint/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ locals {

base_tags = {
"boc:tf_module_version" = local._module_version
"boc:tf_module_name" = lookup(local._module_names, local._module_name, local._module_names["_main_"])
"boc:created_by" = "terraform"
}
}
Expand Down
3 changes: 3 additions & 0 deletions vpc-interface-endpoint/module_name.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
locals {
_module_name = "vpc-interface-endpoint"
}
1 change: 1 addition & 0 deletions vpc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ locals {

base_tags = {
"boc:tf_module_version" = local._module_version
"boc:tf_module_name" = lookup(local._module_names, local._module_name, local._module_names["_main_"])
"boc:created_by" = "terraform"
}

Expand Down
3 changes: 3 additions & 0 deletions vpc/module_name.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
locals {
_module_name = "vpc"
}
2 changes: 2 additions & 0 deletions vpn-transit-gateway/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ module "vpn_transit-gateway" {

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.66.0 |
| <a name="requirement_ldap"></a> [ldap](#requirement\_ldap) | >= 0.5.4 |
| <a name="requirement_null"></a> [null](#requirement\_null) | >= 3.0 |
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 3.0 |
| <a name="requirement_template"></a> [template](#requirement\_template) | >= 2.0 |
Expand Down
1 change: 1 addition & 0 deletions vpn-transit-gateway/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ locals {

base_tags = {
"boc:tf_module_version" = local._module_version
"boc:tf_module_name" = lookup(local._module_names, local._module_name, local._module_names["_main_"])
"boc:created_by" = "terraform"
}

Expand Down
3 changes: 3 additions & 0 deletions vpn-transit-gateway/module_name.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
locals {
_module_name = "vpn-transit-gateway"
}
1 change: 1 addition & 0 deletions vpn/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ locals {

base_tags = {
"boc:tf_module_version" = local._module_version
"boc:tf_module_name" = lookup(local._module_names, local._module_name, local._module_names["_main_"])
"boc:created_by" = "terraform"
}

Expand Down
3 changes: 3 additions & 0 deletions vpn/module_name.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
locals {
_module_name = "vpn"
}

0 comments on commit 54c4b76

Please sign in to comment.