Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: changing the trusted attachments to a map #49

Merged
merged 2 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/inspection/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ No resources.
|------|-------------|------|---------|:--------:|
| <a name="input_asn"></a> [asn](#input\_asn) | The ASN of the gateway. | `number` | `64512` | no |
| <a name="input_name"></a> [name](#input\_name) | The name of the transit gateway to provision. | `string` | `"main-hub"` | no |
| <a name="input_tags"></a> [tags](#input\_tags) | A map of tags to assign to the resources. | `map(string)` | <pre>{<br> "Environment": "test",<br> "GitRepo": "https://github.com/appvia/terraform-aws-connectivity"<br>}</pre> | no |
| <a name="input_tags"></a> [tags](#input\_tags) | A map of tags to assign to the resources. | `map(string)` | <pre>{<br/> "Environment": "test",<br/> "GitRepo": "https://github.com/appvia/terraform-aws-connectivity"<br/>}</pre> | no |

## Outputs

Expand Down
2 changes: 1 addition & 1 deletion examples/trusted/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ No resources.
| <a name="input_name"></a> [name](#input\_name) | The name of the transit gateway to provision. | `string` | `"main-hub"` | no |
| <a name="input_ram_principals"></a> [ram\_principals](#input\_ram\_principals) | The AWS RAM principal to share the transit gateway with. | `map(string)` | `{}` | no |
| <a name="input_tags"></a> [tags](#input\_tags) | A map of tags to assign to the resources. | `map(string)` | `{}` | no |
| <a name="input_trusted_attachments"></a> [trusted\_attachments](#input\_trusted\_attachments) | The list of trusted account IDs. | `list(string)` | `[]` | no |
| <a name="input_trusted_attachments"></a> [trusted\_attachments](#input\_trusted\_attachments) | The list of trusted account IDs. | `map(string)` | `{}` | no |

## Outputs

Expand Down
4 changes: 2 additions & 2 deletions examples/trusted/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ variable "asn" {

variable "trusted_attachments" {
description = "The list of trusted account IDs."
type = list(string)
default = []
type = map(string)
default = {}
}

variable "tags" {
Expand Down
2 changes: 1 addition & 1 deletion trusted.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ resource "aws_ec2_transit_gateway_route_table_association" "trusted" {
## table. This will allow traffic to flow from the trusted routing table to the trusted
## routing table.
resource "aws_ec2_transit_gateway_route_table_propagation" "trusted" {
for_each = local.enable_trusted == true ? toset(var.connectivity_config.trusted.trusted_attachments) : toset([])
for_each = local.enable_trusted == true ? var.connectivity_config.trusted.trusted_attachments : {}

transit_gateway_attachment_id = each.value
transit_gateway_route_table_id = aws_ec2_transit_gateway_route_table.trusted[0].id
Expand Down
2 changes: 1 addition & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ variable "connectivity_config" {

trusted = optional(object({
# Defines the configuration for the trusted routing
trusted_attachments = optional(list(string), [])
trusted_attachments = optional(map(string), {})
# The list of transit gateway attachments to trust e.g can see all the other untrusted networks. Defaults to an empty list.
trusted_route_table_name = optional(string, "trusted")
# The name of the trusted route table. Defaults to 'trusted'.
Expand Down