diff --git a/CHANGELOG.md b/CHANGELOG.md index b3be069..ca881e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md new file mode 100644 index 0000000..6bb8933 --- /dev/null +++ b/README.md @@ -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 +#--- diff --git a/common/module_name.tf b/common/module_name.tf new file mode 100644 index 0000000..c844252 --- /dev/null +++ b/common/module_name.tf @@ -0,0 +1,3 @@ +locals { + _module_name = "aws-vpc-setup" +} diff --git a/common/version.tf b/common/version.tf index 6b49608..b3c7710 100644 --- a/common/version.tf +++ b/common/version.tf @@ -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" + } } diff --git a/examples/quotas/quotas.tf b/examples/quotas/quotas.tf new file mode 100644 index 0000000..2739e79 --- /dev/null +++ b/examples/quotas/quotas.tf @@ -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 +} diff --git a/examples/quotas/quotas.yml b/examples/quotas/quotas.yml new file mode 100644 index 0000000..562acaa --- /dev/null +++ b/examples/quotas/quotas.yml @@ -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 +# }, diff --git a/flowlogs-role/main.tf b/flowlogs-role/main.tf index ae51669..8f5ad0e 100644 --- a/flowlogs-role/main.tf +++ b/flowlogs-role/main.tf @@ -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" } } diff --git a/flowlogs-role/module_name.tf b/flowlogs-role/module_name.tf new file mode 100644 index 0000000..6c1285a --- /dev/null +++ b/flowlogs-role/module_name.tf @@ -0,0 +1,3 @@ +locals { + _module_name = "flowlogs-role" +} diff --git a/flowlogs/README.md b/flowlogs/README.md index 80062d8..3267f14 100644 --- a/flowlogs/README.md +++ b/flowlogs/README.md @@ -41,15 +41,22 @@ module "flowlogs" { ## Requirements -No requirements. +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 0.13 | +| [aws](#requirement\_aws) | >= 3.66.0 | +| [ldap](#requirement\_ldap) | >= 0.5.4 | +| [null](#requirement\_null) | >= 3.0 | +| [random](#requirement\_random) | >= 3.0 | +| [template](#requirement\_template) | >= 2.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | n/a | -| [null](#provider\_null) | n/a | -| [template](#provider\_template) | n/a | +| [aws](#provider\_aws) | >= 3.66.0 | +| [null](#provider\_null) | >= 3.0 | +| [template](#provider\_template) | >= 2.0 | ## Modules diff --git a/flowlogs/main.tf b/flowlogs/main.tf index 3df8f26..abf605d 100644 --- a/flowlogs/main.tf +++ b/flowlogs/main.tf @@ -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" } diff --git a/flowlogs/module_name.tf b/flowlogs/module_name.tf new file mode 100644 index 0000000..5eaa4a8 --- /dev/null +++ b/flowlogs/module_name.tf @@ -0,0 +1,3 @@ +locals { + _module_name = "flowlogs" +} diff --git a/nacl-rules/README.md b/nacl-rules/README.md index ef61c9a..8d77090 100644 --- a/nacl-rules/README.md +++ b/nacl-rules/README.md @@ -29,7 +29,9 @@ module "nacls_enterprise" { | Name | Version | |------|---------| +| [terraform](#requirement\_terraform) | >= 0.13 | | [aws](#requirement\_aws) | >= 3.66.0 | +| [ldap](#requirement\_ldap) | >= 0.5.4 | | [null](#requirement\_null) | >= 3.0 | | [random](#requirement\_random) | >= 3.0 | | [template](#requirement\_template) | >= 2.0 | diff --git a/nacl-rules/main.tf b/nacl-rules/main.tf index e00382f..16cf49f 100644 --- a/nacl-rules/main.tf +++ b/nacl-rules/main.tf @@ -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" } } diff --git a/nacl-rules/module_name.tf b/nacl-rules/module_name.tf new file mode 100644 index 0000000..825522a --- /dev/null +++ b/nacl-rules/module_name.tf @@ -0,0 +1,3 @@ +locals { + _module_name = "nacl-rules" +} diff --git a/nacls/main.tf b/nacls/main.tf index b6c2e26..4605ee1 100644 --- a/nacls/main.tf +++ b/nacls/main.tf @@ -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" } diff --git a/nacls/module_name.tf b/nacls/module_name.tf new file mode 100644 index 0000000..9db7ed4 --- /dev/null +++ b/nacls/module_name.tf @@ -0,0 +1,3 @@ +locals { + _module_name = "nacls" +} diff --git a/peer/README.md b/peer/README.md index b16c07d..a4947a5 100644 --- a/peer/README.md +++ b/peer/README.md @@ -80,7 +80,9 @@ module "peer_services" { | Name | Version | |------|---------| +| [terraform](#requirement\_terraform) | >= 0.13 | | [aws](#requirement\_aws) | >= 3.66.0 | +| [ldap](#requirement\_ldap) | >= 0.5.4 | | [null](#requirement\_null) | >= 3.0 | | [random](#requirement\_random) | >= 3.0 | | [template](#requirement\_template) | >= 2.0 | diff --git a/peer/main.tf b/peer/main.tf index 8cb4b2e..29c5b7f 100644 --- a/peer/main.tf +++ b/peer/main.tf @@ -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" } } diff --git a/peer/module_name.tf b/peer/module_name.tf new file mode 100644 index 0000000..8d27972 --- /dev/null +++ b/peer/module_name.tf @@ -0,0 +1,3 @@ +locals { + _module_name = "peer" +} diff --git a/routing/main.tf b/routing/main.tf index 544d66c..341dad6 100644 --- a/routing/main.tf +++ b/routing/main.tf @@ -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" } diff --git a/routing/module_name.tf b/routing/module_name.tf new file mode 100644 index 0000000..14c3264 --- /dev/null +++ b/routing/module_name.tf @@ -0,0 +1,3 @@ +locals { + _module_name = "routing" +} diff --git a/security-groups/main.tf b/security-groups/main.tf index 9658044..e0fcf35 100644 --- a/security-groups/main.tf +++ b/security-groups/main.tf @@ -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" } } diff --git a/security-groups/module_name.tf b/security-groups/module_name.tf new file mode 100644 index 0000000..71c482e --- /dev/null +++ b/security-groups/module_name.tf @@ -0,0 +1,3 @@ +locals { + _module_name = "security-groups" +} diff --git a/subnets/main.tf b/subnets/main.tf index 308713b..247a862 100644 --- a/subnets/main.tf +++ b/subnets/main.tf @@ -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" } diff --git a/subnets/module_name.tf b/subnets/module_name.tf new file mode 100644 index 0000000..e8d6f2e --- /dev/null +++ b/subnets/module_name.tf @@ -0,0 +1,3 @@ +locals { + _module_name = "subnets" +} diff --git a/vpc-interface-endpoint/README.md b/vpc-interface-endpoint/README.md index 1764ea9..d1a3e40 100644 --- a/vpc-interface-endpoint/README.md +++ b/vpc-interface-endpoint/README.md @@ -54,7 +54,9 @@ These are not included in the module because they don't exist until the resource | Name | Version | |------|---------| +| [terraform](#requirement\_terraform) | >= 0.13 | | [aws](#requirement\_aws) | >= 3.66.0 | +| [ldap](#requirement\_ldap) | >= 0.5.4 | | [null](#requirement\_null) | >= 3.0 | | [random](#requirement\_random) | >= 3.0 | | [template](#requirement\_template) | >= 2.0 | diff --git a/vpc-interface-endpoint/main.tf b/vpc-interface-endpoint/main.tf index 63c35ca..d879540 100644 --- a/vpc-interface-endpoint/main.tf +++ b/vpc-interface-endpoint/main.tf @@ -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" } } diff --git a/vpc-interface-endpoint/module_name.tf b/vpc-interface-endpoint/module_name.tf new file mode 100644 index 0000000..50a0a96 --- /dev/null +++ b/vpc-interface-endpoint/module_name.tf @@ -0,0 +1,3 @@ +locals { + _module_name = "vpc-interface-endpoint" +} diff --git a/vpc/main.tf b/vpc/main.tf index dc1db82..ade85af 100644 --- a/vpc/main.tf +++ b/vpc/main.tf @@ -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" } diff --git a/vpc/module_name.tf b/vpc/module_name.tf new file mode 100644 index 0000000..96f3d58 --- /dev/null +++ b/vpc/module_name.tf @@ -0,0 +1,3 @@ +locals { + _module_name = "vpc" +} diff --git a/vpn-transit-gateway/README.md b/vpn-transit-gateway/README.md index 325e8b1..18d35d9 100644 --- a/vpn-transit-gateway/README.md +++ b/vpn-transit-gateway/README.md @@ -44,7 +44,9 @@ module "vpn_transit-gateway" { | Name | Version | |------|---------| +| [terraform](#requirement\_terraform) | >= 0.13 | | [aws](#requirement\_aws) | >= 3.66.0 | +| [ldap](#requirement\_ldap) | >= 0.5.4 | | [null](#requirement\_null) | >= 3.0 | | [random](#requirement\_random) | >= 3.0 | | [template](#requirement\_template) | >= 2.0 | diff --git a/vpn-transit-gateway/main.tf b/vpn-transit-gateway/main.tf index 8e98e9a..9c01132 100644 --- a/vpn-transit-gateway/main.tf +++ b/vpn-transit-gateway/main.tf @@ -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" } diff --git a/vpn-transit-gateway/module_name.tf b/vpn-transit-gateway/module_name.tf new file mode 100644 index 0000000..cc65731 --- /dev/null +++ b/vpn-transit-gateway/module_name.tf @@ -0,0 +1,3 @@ +locals { + _module_name = "vpn-transit-gateway" +} diff --git a/vpn/main.tf b/vpn/main.tf index 2d05977..d7a8c2a 100644 --- a/vpn/main.tf +++ b/vpn/main.tf @@ -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" } diff --git a/vpn/module_name.tf b/vpn/module_name.tf new file mode 100644 index 0000000..1c530b0 --- /dev/null +++ b/vpn/module_name.tf @@ -0,0 +1,3 @@ +locals { + _module_name = "vpn" +}