Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
badra001 committed Oct 12, 2022
1 parent ac57ffc commit e28d70d
Show file tree
Hide file tree
Showing 4 changed files with 121 additions and 0 deletions.
68 changes: 68 additions & 0 deletions vpc-transit-gateway-association/README.md
Original file line number Diff line number Diff line change
@@ -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 |
|------|---------|
| <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_local"></a> [local](#requirement\_local) | >= 1.0.0 |
| <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) | >= 3.66.0 |
| <a name="provider_aws.tgw_east"></a> [aws.tgw\_east](#provider\_aws.tgw\_east) | >= 3.66.0 |
| <a name="provider_aws.tgw_west"></a> [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 |
|------|-------------|------|---------|:--------:|
| <a name="input_account_alias"></a> [account\_alias](#input\_account\_alias) | AWS Account Alias (default: will pull from current account\_alias) | `string` | `""` | no |
| <a name="input_account_id"></a> [account\_id](#input\_account\_id) | AWS Account ID (default: will pull from current user) | `string` | `""` | no |
| <a name="input_create"></a> [create](#input\_create) | Flag to indicate whether to create the resources or not (default: true) | `bool` | `true` | no |
| <a name="input_network_account_profile"></a> [network\_account\_profile](#input\_network\_account\_profile) | AWS profile of the source account sharing the VPC resources | `string` | n/a | yes |
| <a name="input_override_prefixes"></a> [override\_prefixes](#input\_override\_prefixes) | Override built-in prefixes by component. This should be used primarily for common infrastructure things | `map(string)` | `{}` | no |
| <a name="input_tags"></a> [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 |
| <a name="input_vpc_environment"></a> [vpc\_environment](#input\_vpc\_environment) | VPC environment purpose (infrastructure, common, shared, dev, stage, ite, prod) | `string` | `null` | no |
| <a name="input_vpc_full_name"></a> [vpc\_full\_name](#input\_vpc\_full\_name) | VPC full name component (vpc{index}-{vpc\_name}) | `string` | `null` | no |
| <a name="input_vpc_index"></a> [vpc\_index](#input\_vpc\_index) | VPC index number (integer starting at 1) | `number` | `null` | no |
| <a name="input_vpc_name"></a> [vpc\_name](#input\_vpc\_name) | VPC name component used through the VPC descrbing its purpose (ex: dice-dev) | `string` | `null` | no |
| <a name="input_vpc_short_name"></a> [vpc\_short\_name](#input\_vpc\_short\_name) | VPC short name component (vpc{index}) | `string` | `null` | no |

## Outputs

| Name | Description |
|------|-------------|
| <a name="output_tgw_east"></a> [tgw\_east](#output\_tgw\_east) | Transit Gateway us-gov-east-1 |
| <a name="output_tgw_west"></a> [tgw\_west](#output\_tgw\_west) | Transit Gateway us-gov-west-1 |
25 changes: 25 additions & 0 deletions vpc-transit-gateway-association/main.tf
Original file line number Diff line number Diff line change
@@ -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"
}
}
3 changes: 3 additions & 0 deletions vpc-transit-gateway-association/module_name.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
locals {
_module_name = "vpc-transit-gateway-association"
}
25 changes: 25 additions & 0 deletions vpc-transit-gateway-association/outputs.tf
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit e28d70d

Please sign in to comment.