From e28d70deb4d5a7522a3a34752fe724b5d672aeb4 Mon Sep 17 00:00:00 2001 From: badra001 Date: Wed, 12 Oct 2022 12:18:34 -0400 Subject: [PATCH] update --- vpc-transit-gateway-association/README.md | 68 +++++++++++++++++++ vpc-transit-gateway-association/main.tf | 25 +++++++ .../module_name.tf | 3 + vpc-transit-gateway-association/outputs.tf | 25 +++++++ 4 files changed, 121 insertions(+) create mode 100644 vpc-transit-gateway-association/README.md create mode 100644 vpc-transit-gateway-association/main.tf create mode 100644 vpc-transit-gateway-association/module_name.tf create mode 100644 vpc-transit-gateway-association/outputs.tf diff --git a/vpc-transit-gateway-association/README.md b/vpc-transit-gateway-association/README.md new file mode 100644 index 0000000..9789194 --- /dev/null +++ b/vpc-transit-gateway-association/README.md @@ -0,0 +1,68 @@ +# About aws-vpc-setup :: vpc-transit-gateway-association + +# Usage + +```hcl +module "vpc_tgw" { + source = "git@github.e.it.census.gov:terraform-modules/aws-vpc-setup.git//vpc-transit-gateway-association?ref=tf-upgrade" + network_account_profile = "057445207498-ent-gov-network-sa" +} +``` + +## Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 0.13 | +| [aws](#requirement\_aws) | >= 3.66.0 | +| [ldap](#requirement\_ldap) | >= 0.5.4 | +| [local](#requirement\_local) | >= 1.0.0 | +| [null](#requirement\_null) | >= 3.0 | +| [random](#requirement\_random) | >= 3.0 | +| [template](#requirement\_template) | >= 2.0 | + +## Providers + +| Name | Version | +|------|---------| +| [aws](#provider\_aws) | >= 3.66.0 | +| [aws.tgw\_east](#provider\_aws.tgw\_east) | >= 3.66.0 | +| [aws.tgw\_west](#provider\_aws.tgw\_west) | >= 3.66.0 | + +## Modules + +No modules. + +## Resources + +| Name | Type | +|------|------| +| [aws_arn.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/arn) | data source | +| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source | +| [aws_ec2_transit_gateway.tgw_east](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ec2_transit_gateway) | data source | +| [aws_ec2_transit_gateway.tgw_west](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ec2_transit_gateway) | data source | +| [aws_iam_account_alias.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_account_alias) | data source | +| [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [account\_alias](#input\_account\_alias) | AWS Account Alias (default: will pull from current account\_alias) | `string` | `""` | no | +| [account\_id](#input\_account\_id) | AWS Account ID (default: will pull from current user) | `string` | `""` | no | +| [create](#input\_create) | Flag to indicate whether to create the resources or not (default: true) | `bool` | `true` | no | +| [network\_account\_profile](#input\_network\_account\_profile) | AWS profile of the source account sharing the VPC resources | `string` | n/a | yes | +| [override\_prefixes](#input\_override\_prefixes) | Override built-in prefixes by component. This should be used primarily for common infrastructure things | `map(string)` | `{}` | no | +| [tags](#input\_tags) | AWS Tags to apply to appropriate resources (S3, KMS). Do not include safeguard tags here, use the data\_safeguard field for such things. | `map(string)` | `{}` | no | +| [vpc\_environment](#input\_vpc\_environment) | VPC environment purpose (infrastructure, common, shared, dev, stage, ite, prod) | `string` | `null` | no | +| [vpc\_full\_name](#input\_vpc\_full\_name) | VPC full name component (vpc{index}-{vpc\_name}) | `string` | `null` | no | +| [vpc\_index](#input\_vpc\_index) | VPC index number (integer starting at 1) | `number` | `null` | no | +| [vpc\_name](#input\_vpc\_name) | VPC name component used through the VPC descrbing its purpose (ex: dice-dev) | `string` | `null` | no | +| [vpc\_short\_name](#input\_vpc\_short\_name) | VPC short name component (vpc{index}) | `string` | `null` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| [tgw\_east](#output\_tgw\_east) | Transit Gateway us-gov-east-1 | +| [tgw\_west](#output\_tgw\_west) | Transit Gateway us-gov-west-1 | diff --git a/vpc-transit-gateway-association/main.tf b/vpc-transit-gateway-association/main.tf new file mode 100644 index 0000000..80bc2b2 --- /dev/null +++ b/vpc-transit-gateway-association/main.tf @@ -0,0 +1,25 @@ +/* +* # About aws-vpc-setup :: vpc-transit-gateway-association +* +* # Usage +* +* ```hcl +* module "vpc_tgw" { +* source = "git@github.e.it.census.gov:terraform-modules/aws-vpc-setup.git//vpc-transit-gateway-association?ref=tf-upgrade" +* network_account_profile = "057445207498-ent-gov-network-sa" +* } +* ``` +*/ + +locals { + account_id = var.account_id != "" ? var.account_id : data.aws_caller_identity.current.account_id + account_environment = data.aws_arn.current.partition == "aws-us-gov" ? "gov" : "ew" + region = data.aws_region.current.name + region_short = join("", [for c in split("-", local.region) : substr(c, 0, 1)]) + + 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-transit-gateway-association/module_name.tf b/vpc-transit-gateway-association/module_name.tf new file mode 100644 index 0000000..979f028 --- /dev/null +++ b/vpc-transit-gateway-association/module_name.tf @@ -0,0 +1,3 @@ +locals { + _module_name = "vpc-transit-gateway-association" +} diff --git a/vpc-transit-gateway-association/outputs.tf b/vpc-transit-gateway-association/outputs.tf new file mode 100644 index 0000000..3552111 --- /dev/null +++ b/vpc-transit-gateway-association/outputs.tf @@ -0,0 +1,25 @@ +data "aws_ec2_transit_gateway" "tgw_east" { + provider = aws.tgw_east + filter { + name = "owner-id" + values = [data.aws_arn.network_account.account] + } +} + +data "aws_ec2_transit_gateway" "tgw_west" { + provider = aws.tgw_west + filter { + name = "owner-id" + values = [data.aws_arn.network_account.account] + } +} + +output "tgw_east" { + description = "Transit Gateway us-gov-east-1" + value = data.aws_ec2_transit_gateway.tgw_east.id +} + +output "tgw_west" { + description = "Transit Gateway us-gov-west-1" + value = data.aws_ec2_transit_gateway.tgw_west.id +}