Skip to content

Commit

Permalink
update vpc-peering with requester params (#1097)
Browse files Browse the repository at this point in the history
  • Loading branch information
Benbentwo authored Aug 14, 2024
1 parent 4cfa96c commit 8354d70
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 2 additions & 0 deletions modules/vpc-peering/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,9 @@ atmos terraform apply vpc-peering -s ue1-prod
| <a name="input_regex_replace_chars"></a> [regex\_replace\_chars](#input\_regex\_replace\_chars) | Terraform regular expression (regex) string.<br>Characters matching the regex will be removed from the ID elements.<br>If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits. | `string` | `null` | no |
| <a name="input_region"></a> [region](#input\_region) | AWS Region | `string` | n/a | yes |
| <a name="input_requester_allow_remote_vpc_dns_resolution"></a> [requester\_allow\_remote\_vpc\_dns\_resolution](#input\_requester\_allow\_remote\_vpc\_dns\_resolution) | Allow requester VPC to resolve public DNS hostnames to private IP addresses when queried from instances in the accepter VPC | `bool` | `true` | no |
| <a name="input_requester_role_arn"></a> [requester\_role\_arn](#input\_requester\_role\_arn) | Requestor AWS assume role ARN, if not provided it will be assumed to be the current terraform role. | `string` | `null` | no |
| <a name="input_requester_vpc_component_name"></a> [requester\_vpc\_component\_name](#input\_requester\_vpc\_component\_name) | Requestor vpc component name | `string` | `"vpc"` | no |
| <a name="input_requester_vpc_id"></a> [requester\_vpc\_id](#input\_requester\_vpc\_id) | Requestor VPC ID, if not provided, it will be looked up by component using variable `requester_vpc_component_name` | `string` | `null` | no |
| <a name="input_stage"></a> [stage](#input\_stage) | ID element. Usually used to indicate role, e.g. 'prod', 'staging', 'source', 'build', 'test', 'deploy', 'release' | `string` | `null` | no |
| <a name="input_tags"></a> [tags](#input\_tags) | Additional tags (e.g. `{'BusinessUnit': 'XYZ'}`).<br>Neither the tag keys nor the tag values will be modified by this module. | `map(string)` | `{}` | no |
| <a name="input_tenant"></a> [tenant](#input\_tenant) | ID element \_(Rarely used, not included by default)\_. A customer identifier, indicating who this instance of a resource is for | `string` | `null` | no |
Expand Down
4 changes: 2 additions & 2 deletions modules/vpc-peering/main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
locals {
enabled = module.this.enabled

requester_vpc_id = module.requester_vpc.outputs.vpc_id
requester_vpc_id = coalesce(var.requester_vpc_id, module.requester_vpc.outputs.vpc_id)

accepter_aws_assume_role_arn = var.accepter_stage_name != null ? module.iam_roles.terraform_role_arns[var.accepter_stage_name] : var.accepter_aws_assume_role_arn
}
Expand All @@ -24,7 +24,7 @@ module "vpc_peering" {
auto_accept = var.auto_accept

requester_allow_remote_vpc_dns_resolution = var.requester_allow_remote_vpc_dns_resolution
requester_aws_assume_role_arn = module.iam_roles.terraform_role_arn
requester_aws_assume_role_arn = coalesce(var.requester_role_arn, module.iam_roles.terraform_role_arn)
requester_region = var.region
requester_vpc_id = local.requester_vpc_id

Expand Down
12 changes: 12 additions & 0 deletions modules/vpc-peering/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,18 @@ variable "accepter_stage_name" {
default = null
}

variable "requester_vpc_id" {
type = string
description = "Requestor VPC ID, if not provided, it will be looked up by component using variable `requester_vpc_component_name`"
default = null
}

variable "requester_role_arn" {
type = string
description = "Requestor AWS assume role ARN, if not provided it will be assumed to be the current terraform role."
default = null
}

variable "requester_allow_remote_vpc_dns_resolution" {
type = bool
description = "Allow requester VPC to resolve public DNS hostnames to private IP addresses when queried from instances in the accepter VPC"
Expand Down

0 comments on commit 8354d70

Please sign in to comment.