-
-
Couldn't load subscription status.
- Fork 230
feat: Add resolver-endpoints submodule #106
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
Merged
antonbabenko
merged 4 commits into
terraform-aws-modules:master
from
renebarbosafl:master
Jun 8, 2024
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| # Route53 Resolver Endpoints | ||
|
|
||
| This module creates Route53 Resolver Endpoints. | ||
|
|
||
| <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> | ||
| ## Requirements | ||
|
|
||
| | Name | Version | | ||
| |------|---------| | ||
| | <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3.2 | | ||
| | <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.32 | | ||
|
|
||
| ## Providers | ||
|
|
||
| | Name | Version | | ||
| |------|---------| | ||
| | <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.32 | | ||
|
|
||
| ## Modules | ||
|
|
||
| No modules. | ||
|
|
||
| ## Resources | ||
|
|
||
| | Name | Type | | ||
| |------|------| | ||
| | [aws_route53_resolver_endpoint.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_resolver_endpoint) | resource | | ||
| | [aws_security_group.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group) | resource | | ||
|
|
||
| ## Inputs | ||
|
|
||
| | Name | Description | Type | Default | Required | | ||
| |------|-------------|------|---------|:--------:| | ||
| | <a name="input_create"></a> [create](#input\_create) | Whether to create Route53 resolver endpoints | `bool` | `true` | no | | ||
| | <a name="input_create_security_group"></a> [create\_security\_group](#input\_create\_security\_group) | Whether to create Security Groups for Route53 Resolver Endpoints | `bool` | `true` | no | | ||
| | <a name="input_direction"></a> [direction](#input\_direction) | The resolver endpoint flow direction | `string` | `"INBOUND"` | no | | ||
| | <a name="input_name"></a> [name](#input\_name) | The resolver endpoint name | `string` | `null` | no | | ||
| | <a name="input_protocols"></a> [protocols](#input\_protocols) | The resolver endpoint protocols | `list(string)` | `[]` | no | | ||
| | <a name="input_security_group_description"></a> [security\_group\_description](#input\_security\_group\_description) | The security group description | `string` | `null` | no | | ||
| | <a name="input_security_group_ids"></a> [security\_group\_ids](#input\_security\_group\_ids) | A list of security group IDs | `list(string)` | `[]` | no | | ||
| | <a name="input_security_group_ingress_cidr_blocks"></a> [security\_group\_ingress\_cidr\_blocks](#input\_security\_group\_ingress\_cidr\_blocks) | A list of CIDR blocks to allow on security group | `list(string)` | `[]` | no | | ||
| | <a name="input_security_group_name"></a> [security\_group\_name](#input\_security\_group\_name) | The name of the security group | `string` | `null` | no | | ||
| | <a name="input_security_group_name_prefix"></a> [security\_group\_name\_prefix](#input\_security\_group\_name\_prefix) | The prefix of the security group | `string` | `null` | no | | ||
| | <a name="input_security_group_tags"></a> [security\_group\_tags](#input\_security\_group\_tags) | A map of tags for the security group | `map(string)` | `{}` | no | | ||
| | <a name="input_subnet_ids"></a> [subnet\_ids](#input\_subnet\_ids) | A list of subnets where Route53 resolver endpoints will be deployed | `list(string)` | `[]` | no | | ||
| | <a name="input_tags"></a> [tags](#input\_tags) | A map of tags for the Route53 resolver endpoint | `map(string)` | `{}` | no | | ||
| | <a name="input_type"></a> [type](#input\_type) | The resolver endpoint IP type | `string` | `"IPV4"` | no | | ||
| | <a name="input_vpc_id"></a> [vpc\_id](#input\_vpc\_id) | The VPC ID for all the Route53 Resolver Endpoints | `string` | `""` | no | | ||
|
|
||
| ## Outputs | ||
|
|
||
| | Name | Description | | ||
| |------|-------------| | ||
| | <a name="output_route53_resolver_endpoint_arn"></a> [route53\_resolver\_endpoint\_arn](#output\_route53\_resolver\_endpoint\_arn) | The ARN of the Resolver Endpoint | | ||
| | <a name="output_route53_resolver_endpoint_host_vpc_id"></a> [route53\_resolver\_endpoint\_host\_vpc\_id](#output\_route53\_resolver\_endpoint\_host\_vpc\_id) | The VPC ID used by the Resolver Endpoint | | ||
| | <a name="output_route53_resolver_endpoint_id"></a> [route53\_resolver\_endpoint\_id](#output\_route53\_resolver\_endpoint\_id) | The ID of the Resolver Endpoint | | ||
| | <a name="output_route53_resolver_endpoint_ip_addresses"></a> [route53\_resolver\_endpoint\_ip\_addresses](#output\_route53\_resolver\_endpoint\_ip\_addresses) | Resolver Endpoint IP Addresses | | ||
| | <a name="output_route53_resolver_endpoint_security_group_ids"></a> [route53\_resolver\_endpoint\_security\_group\_ids](#output\_route53\_resolver\_endpoint\_security\_group\_ids) | Security Group IDs mapped to Resolver Endpoint | | ||
| <!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| locals { | ||
| security_group_ids = var.create && var.create_security_group ? [aws_security_group.this[0].id] : var.security_group_ids | ||
| } | ||
|
|
||
| resource "aws_route53_resolver_endpoint" "this" { | ||
| count = var.create ? 1 : 0 | ||
|
|
||
| name = var.name | ||
| direction = var.direction | ||
|
|
||
| resolver_endpoint_type = var.type | ||
| security_group_ids = local.security_group_ids | ||
|
|
||
| dynamic "ip_address" { | ||
| for_each = var.subnet_ids | ||
|
|
||
| content { | ||
| subnet_id = ip_address.value | ||
| } | ||
| } | ||
|
|
||
| protocols = var.protocols | ||
|
|
||
| tags = var.tags | ||
| } | ||
|
|
||
| resource "aws_security_group" "this" { | ||
| count = var.create && var.create_security_group ? 1 : 0 | ||
|
|
||
| name = var.security_group_name_prefix == null ? coalesce(var.security_group_name, var.name) : null | ||
| name_prefix = var.security_group_name_prefix | ||
| description = var.security_group_description | ||
| vpc_id = var.vpc_id | ||
|
|
||
| dynamic "ingress" { | ||
| for_each = toset(["tcp", "udp"]) | ||
|
|
||
| content { | ||
| description = "Allow DNS" | ||
| protocol = ingress.value | ||
| from_port = 53 | ||
| to_port = 53 | ||
| cidr_blocks = var.security_group_ingress_cidr_blocks | ||
| } | ||
| } | ||
|
|
||
| egress { | ||
| description = "Allow All" | ||
| protocol = "-1" | ||
| from_port = 0 | ||
| to_port = 0 | ||
| cidr_blocks = ["0.0.0.0/0"] | ||
| } | ||
|
|
||
| tags = var.security_group_tags | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
|
|
||
| output "route53_resolver_endpoint_id" { | ||
| description = "The ID of the Resolver Endpoint" | ||
| value = try(aws_route53_resolver_endpoint.this[0].id, null) | ||
| } | ||
|
|
||
| output "route53_resolver_endpoint_arn" { | ||
| description = "The ARN of the Resolver Endpoint" | ||
| value = try(aws_route53_resolver_endpoint.this[0].arn, null) | ||
| } | ||
|
|
||
| output "route53_resolver_endpoint_host_vpc_id" { | ||
| description = "The VPC ID used by the Resolver Endpoint" | ||
| value = try(aws_route53_resolver_endpoint.this[0].host_vpc_id, null) | ||
| } | ||
|
|
||
| output "route53_resolver_endpoint_security_group_ids" { | ||
| description = "Security Group IDs mapped to Resolver Endpoint" | ||
| value = try(aws_route53_resolver_endpoint.this[0].security_group_ids, null) | ||
| } | ||
|
|
||
| output "route53_resolver_endpoint_ip_addresses" { | ||
| description = "Resolver Endpoint IP Addresses" | ||
| value = try(aws_route53_resolver_endpoint.this[0].ip_address, null) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| variable "create" { | ||
| description = "Whether to create Route53 resolver endpoints" | ||
| type = bool | ||
| default = true | ||
| } | ||
|
|
||
| variable "name" { | ||
| description = "The resolver endpoint name" | ||
| type = string | ||
| default = null | ||
| } | ||
|
|
||
| variable "protocols" { | ||
| description = "The resolver endpoint protocols" | ||
| type = list(string) | ||
| default = [] | ||
| } | ||
|
|
||
| variable "direction" { | ||
| description = "The resolver endpoint flow direction" | ||
| type = string | ||
| default = "INBOUND" | ||
| } | ||
|
|
||
| variable "type" { | ||
| description = "The resolver endpoint IP type" | ||
| type = string | ||
| default = "IPV4" | ||
| } | ||
|
|
||
| variable "subnet_ids" { | ||
| description = "A list of subnets where Route53 resolver endpoints will be deployed" | ||
| type = list(string) | ||
| default = [] | ||
| } | ||
|
|
||
| variable "security_group_ids" { | ||
| description = "A list of security group IDs" | ||
| type = list(string) | ||
| default = [] | ||
| } | ||
|
|
||
| variable "tags" { | ||
| description = "A map of tags for the Route53 resolver endpoint" | ||
| type = map(string) | ||
| default = {} | ||
| } | ||
|
|
||
| # Security Group | ||
|
|
||
| variable "create_security_group" { | ||
| description = "Whether to create Security Groups for Route53 Resolver Endpoints" | ||
| type = bool | ||
| default = true | ||
| } | ||
|
|
||
| variable "vpc_id" { | ||
| description = "The VPC ID for all the Route53 Resolver Endpoints" | ||
| type = string | ||
| default = "" | ||
| } | ||
|
|
||
| variable "security_group_name" { | ||
| description = "The name of the security group" | ||
| type = string | ||
| default = null | ||
| } | ||
|
|
||
| variable "security_group_name_prefix" { | ||
| description = "The prefix of the security group" | ||
| type = string | ||
| default = null | ||
| } | ||
|
|
||
| variable "security_group_description" { | ||
| description = "The security group description" | ||
| type = string | ||
| default = null | ||
| } | ||
|
|
||
| variable "security_group_ingress_cidr_blocks" { | ||
| description = "A list of CIDR blocks to allow on security group" | ||
| type = list(string) | ||
| default = [] | ||
| } | ||
|
|
||
| variable "security_group_tags" { | ||
| description = "A map of tags for the security group" | ||
| type = map(string) | ||
| default = {} | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| terraform { | ||
| required_version = ">= 1.3.2" | ||
|
|
||
| required_providers { | ||
| aws = { | ||
| source = "hashicorp/aws" | ||
| version = ">= 5.32" | ||
| } | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.