-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
36 changed files
with
1,198 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| vpn-configs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| <!-- Replace all the {fields} with appropriate values --> | ||
| # About | ||
|
|
||
| This directory constructs the appropriate resources for the vpc2-dice-dev VPC, including: | ||
|
|
||
| * VPC | ||
| * Subnets | ||
| * Route Tables | ||
| * Network ACLs | ||
| * VPN (CGW, VPG, VPN Connectiosn) | ||
| * Flow Logs | ||
| * Securtity Groups (base, others) | ||
|
|
||
| <!-- Add additional text here --> | ||
|
|
||
| # Application Information | ||
|
|
||
| * Application: DICE | ||
| * Environment: development | ||
| * Organization: ADSD, CTO | ||
| * Project: DICE | ||
| * Point of Contact(s): | ||
| * Creation Date: 2021-05-10 | ||
| * References: | ||
| * Requirements: https://github.e.it.census.gov/terraform/cloud-information/blob/master/aws/projects/dice/ | ||
| * Remedy Ticket: {number} | ||
| * Other: {other} | ||
| * Related Configurations: | ||
| * {directory-path} | ||
|
|
||
| # Application Requirements | ||
|
|
||
| <!-- List functional and non-functional requirements here, without implementation details. --> | ||
|
|
||
| # Terraform Directions | ||
|
|
||
| <!-- Enter commands needed in markdown andor special configuration text for plan and apply of this code --> | ||
|
|
||
| <!-- No editing needed beyond this point --> | ||
| # Details | ||
|
|
||
| <!-- BEGIN_TF_DOCS --> | ||
| account_alias = "" | ||
| account_id = "" | ||
| aws_environment = "" | ||
| census_private_cidr = [ | ||
| "148.129.0.0/16", | ||
| "172.16.0.0/12", | ||
| "192.168.0.0/16" | ||
| ] | ||
| census_public_cidr = [ | ||
| "148.129.0.0/16" | ||
| ] | ||
| kms_tfstate_key = "k-kms-inf-tfstate" | ||
| profile = "" | ||
| region = "" | ||
| region_map = {} | ||
| regions = [] | ||
| tag_costallocation = "csvd:infrastructure" | ||
| tag_creator = "" | ||
| tfstate_bucket = "inf-tfstate-252960665057" | ||
| tfstate_bucket_prefix = "inf-tfstate" | ||
| tfstate_key_prefix = "ma6-gov" | ||
| tfstate_key_suffix = "terraform.tfstate" | ||
| tfstate_region = "us-gov-east-1" | ||
| tfstate_table = "tf_remote_state" | ||
| vpc_cidr_block = "" | ||
| vpc_dns_servers = [] | ||
| vpc_domain_name = "" | ||
| vpc_enable_awsdns = false | ||
| vpc_enable_igw = false | ||
| vpc_enable_nat = false | ||
| vpc_enable_vpn = true | ||
| vpc_environment = "" | ||
| vpc_full_name = "" | ||
| vpc_index = "" | ||
| vpc_name = "" | ||
| vpc_ntp_servers = [] | ||
| vpc_short_name = "" | ||
| <!-- END_TF_DOCS --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| formatter: markdown table | ||
|
|
||
| header-from: main.tf | ||
| footer-from: "" | ||
|
|
||
| sections: | ||
| ## hide: [] | ||
| show: | ||
| - data-sources | ||
| - header | ||
| - footer | ||
| - inputs | ||
| - modules | ||
| - outputs | ||
| - providers | ||
| - requirements | ||
| - resources | ||
|
|
||
| output: | ||
| file: README.md | ||
| mode: inject | ||
| template: |- | ||
| <!-- BEGIN_TF_DOCS --> | ||
| {{ .Content }} | ||
| <!-- END_TF_DOCS --> | ||
| ## output-values: | ||
| ## enabled: false | ||
| ## from: "" | ||
| ## | ||
| ## sort: | ||
| ## enabled: true | ||
| ## by: name | ||
| ## | ||
| ## settings: | ||
| ## anchor: true | ||
| ## color: true | ||
| ## default: true | ||
| ## description: false | ||
| ## escape: true | ||
| ## indent: 2 | ||
| ## required: true | ||
| ## sensitive: true | ||
| ## type: true |
44 changes: 44 additions & 0 deletions
44
examples/full-setup-tf-upgrade/apps/dns/.terraform-docs.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| formatter: markdown table | ||
|
|
||
| header-from: main.tf | ||
| footer-from: "" | ||
|
|
||
| sections: | ||
| ## hide: [] | ||
| show: | ||
| - data-sources | ||
| - header | ||
| - footer | ||
| - inputs | ||
| - modules | ||
| - outputs | ||
| - providers | ||
| - requirements | ||
| - resources | ||
|
|
||
| output: | ||
| file: README.md | ||
| mode: inject | ||
| template: |- | ||
| <!-- BEGIN_TF_DOCS --> | ||
| {{ .Content }} | ||
| <!-- END_TF_DOCS --> | ||
| ## output-values: | ||
| ## enabled: false | ||
| ## from: "" | ||
| ## | ||
| ## sort: | ||
| ## enabled: true | ||
| ## by: name | ||
| ## | ||
| ## settings: | ||
| ## anchor: true | ||
| ## color: true | ||
| ## default: true | ||
| ## description: false | ||
| ## escape: true | ||
| ## indent: 2 | ||
| ## required: true | ||
| ## sensitive: true | ||
| ## type: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| <!-- BEGIN_TF_DOCS --> | ||
| ## Requirements | ||
|
|
||
| No requirements. | ||
|
|
||
| ## Providers | ||
|
|
||
| | Name | Version | | ||
| |------|---------| | ||
| | <a name="provider_aws"></a> [aws](#provider\_aws) | n/a | | ||
| | <a name="provider_aws.east_main_dns"></a> [aws.east\_main\_dns](#provider\_aws.east\_main\_dns) | n/a | | ||
| | <a name="provider_aws.west_main_dns"></a> [aws.west\_main\_dns](#provider\_aws.west\_main\_dns) | n/a | | ||
|
|
||
| ## Modules | ||
|
|
||
| No modules. | ||
|
|
||
| ## Resources | ||
|
|
||
| | Name | Type | | ||
| |------|------| | ||
| | [aws_route53_resolver_rule_association.all_rules](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_resolver_rule_association) | resource | | ||
| | [aws_route53_vpc_association_authorization.east_domain_zone](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_vpc_association_authorization) | resource | | ||
| | [aws_route53_vpc_association_authorization.east_ptr_zone](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_vpc_association_authorization) | resource | | ||
| | [aws_route53_vpc_association_authorization.west_domain_zone](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_vpc_association_authorization) | resource | | ||
| | [aws_route53_vpc_association_authorization.west_ptr_zone](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_vpc_association_authorization) | resource | | ||
| | [aws_route53_zone.domain_zone](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_zone) | resource | | ||
| | [aws_route53_zone.ptr_zone](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_zone) | resource | | ||
| | [aws_route53_zone_association.east_domain_zone](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_zone_association) | resource | | ||
| | [aws_route53_zone_association.east_ptr_zone](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_zone_association) | resource | | ||
| | [aws_route53_zone_association.west_domain_zone](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_zone_association) | resource | | ||
| | [aws_route53_zone_association.west_ptr_zone](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_zone_association) | resource | | ||
| | [aws_route53_resolver_rules.all_rules](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/route53_resolver_rules) | data source | | ||
| | [aws_route53_zone.domain_zone](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/route53_zone) | data source | | ||
|
|
||
| ## Inputs | ||
|
|
||
| | Name | Description | Type | Default | Required | | ||
| |------|-------------|------|---------|:--------:| | ||
| | <a name="input_dns_zone_create"></a> [dns\_zone\_create](#input\_dns\_zone\_create) | Flag determing to create (true) or associate (false) the main forward zone. Used for the same VPC domain name across different regions or VPCs | `bool` | `true` | no | | ||
| | <a name="input_dns_zone_description_prefix"></a> [dns\_zone\_description\_prefix](#input\_dns\_zone\_description\_prefix) | Zone description with the org-project-program-environment | `string` | `""` | no | | ||
| | <a name="input_main_dns_profile"></a> [main\_dns\_profile](#input\_main\_dns\_profile) | Profile name for AWS for the main DNS central account | `string` | `"107742151971-do2-govcloud"` | no | | ||
| | <a name="input_main_dns_vpcs"></a> [main\_dns\_vpcs](#input\_main\_dns\_vpcs) | Map of region and VPC ids of the vpc1-services in us-gov-west-1 and us-gov-east-1 for centralized DNS | `map(string)` | <pre>{<br> "us-gov-east-1": "vpc-099a991da7c4eb8a5",<br> "us-gov-west-1": "vpc-77877a12"<br>}</pre> | no | | ||
|
|
||
| ## Outputs | ||
|
|
||
| | Name | Description | | ||
| |------|-------------| | ||
| | <a name="output_all_zones"></a> [all\_zones](#output\_all\_zones) | DNS zone list | | ||
| | <a name="output_domain_zone_id"></a> [domain\_zone\_id](#output\_domain\_zone\_id) | DNS Zone ID | | ||
| | <a name="output_domain_zone_ns"></a> [domain\_zone\_ns](#output\_domain\_zone\_ns) | DNS Zone Nameservers | | ||
| | <a name="output_ptr_zone_id"></a> [ptr\_zone\_id](#output\_ptr\_zone\_id) | DNS PTR Zone IDs | | ||
| | <a name="output_ptr_zone_info"></a> [ptr\_zone\_info](#output\_ptr\_zone\_info) | DNS PTR Zone Info | | ||
| | <a name="output_ptr_zone_ns"></a> [ptr\_zone\_ns](#output\_ptr\_zone\_ns) | DNS PTR Zone Nameservers | | ||
| <!-- END_TF_DOCS --> |
21 changes: 21 additions & 0 deletions
21
examples/full-setup-tf-upgrade/apps/dns/associate-shared.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| ## locals { | ||
| ## reverse_zones = flatten([ | ||
| ## "10.in-addr.arpa", | ||
| ## "168.192.in-addr.arpa", | ||
| ## "129.148.in-addr.arpa", | ||
| ## [for x in range(16, 32) : format("%v.172.in-addr.arpa", x)], | ||
| ## ]) | ||
| ## reverse_rules = formatlist("reverse-%v", local.reverse_zones) | ||
| ## forward_rules = ["forward-all-onprem", "amazon"] | ||
| ## all_main_rules = formatlist("resolver-%v", concat(local.forward_rules, local.reverse_rules)) | ||
| ## } | ||
|
|
||
| data "aws_route53_resolver_rules" "all_rules" { | ||
| share_status = "SHARED_WITH_ME" | ||
| } | ||
|
|
||
| resource "aws_route53_resolver_rule_association" "all_rules" { | ||
| for_each = toset(data.aws_route53_resolver_rules.all_rules.resolver_rule_ids) | ||
| resolver_rule_id = each.key | ||
| vpc_id = local.vpc_id | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| locals { | ||
| base_tags = { | ||
| "boc:created_by" = "terraform" | ||
| } | ||
| } | ||
|
|
||
| locals { | ||
| vpc_info = data.terraform_remote_state.vpc_REGION_vpcN.outputs.vpc_info | ||
| vpc_id = local.vpc_info["vpc_id"] | ||
| domain_name = local.vpc_info["vpc_domain_name"] | ||
| dns_servers = local.vpc_info["vpc_dns_servers"] | ||
| vpc_short_name = local.vpc_info["vpc_short_name"] | ||
| } |
11 changes: 11 additions & 0 deletions
11
examples/full-setup-tf-upgrade/apps/dns/provider.main_dns.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| provider "aws" { | ||
| alias = "east_main_dns" | ||
| region = var.region_map["east"] | ||
| profile = var.main_dns_profile | ||
| } | ||
|
|
||
| provider "aws" { | ||
| alias = "west_main_dns" | ||
| region = var.region_map["west"] | ||
| profile = var.main_dns_profile | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| locals { | ||
| region = var.region | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| #!/bin/env python | ||
|
|
||
| import json | ||
| import sys | ||
| import ipaddress | ||
|
|
||
| r=0 | ||
| outdata={'ip_addresses_sorted':''} | ||
| try: | ||
| indata=json.load(sys.stdin) | ||
| ipa=indata['ip_addresses'].split(',') | ||
| ips=sorted(ipa,key=ipaddress.ip_address) | ||
| outdata['ip_addresses_sorted']=','.join(ips) | ||
| print(json.dumps(outdata)) | ||
| except: | ||
| sys.stderr.write("unable to parse input address\n") | ||
| r=1 | ||
|
|
||
| sys.exit(r) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| VERSION 1.1.2 | ||
| REMOTE-STATE | ||
| COMMAND tf-directory-setup.py -l none -f | ||
| COMMAND setup-new-directory.sh | ||
| COMMAND tf-init -upgrade | ||
|
|
||
| # LINKTOP includes.d/ENVIRONMENT/variables.application_tags.auto.tfvars . | ||
| LINKTOP includes.d/variables.application_tags.tf . | ||
|
|
||
| ALL | ||
| COMMAND tf-directory-setup.py -l s3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| variable "main_dns_vpcs" { | ||
| description = "Map of region and VPC ids of the vpc1-services in us-gov-west-1 and us-gov-east-1 for centralized DNS" | ||
| type = map(string) | ||
| default = { | ||
| "us-gov-west-1" = "vpc-77877a12" | ||
| "us-gov-east-1" = "vpc-099a991da7c4eb8a5" | ||
| } | ||
| } | ||
|
|
||
| variable "main_dns_profile" { | ||
| description = "Profile name for AWS for the main DNS central account" | ||
| type = string | ||
| default = "107742151971-do2-govcloud" | ||
| } | ||
|
|
||
|
|
||
| variable "dns_zone_description_prefix" { | ||
| description = "Zone description with the org-project-program-environment" | ||
| type = string | ||
| default = "" | ||
| } | ||
|
|
||
| variable "dns_zone_create" { | ||
| description = "Flag determing to create (true) or associate (false) the main forward zone. Used for the same VPC domain name across different regions or VPCs" | ||
| type = bool | ||
| default = true | ||
| } |
Oops, something went wrong.