Skip to content

Commit

Permalink
feat: changing the trusted attachments to a map (#49)
Browse files Browse the repository at this point in the history
* feat: changing the trusted attachments to a map

* docs: updating the readme to reflect the changes
  • Loading branch information
gambol99 authored Oct 7, 2024
1 parent 4892e21 commit 8fd14a9
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
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

0 comments on commit 8fd14a9

Please sign in to comment.