From a15db2d2f15310f497ecc4dd3f477278cbe36c72 Mon Sep 17 00:00:00 2001 From: Bayron Carranza Date: Wed, 1 Mar 2023 16:47:44 -0600 Subject: [PATCH 01/36] record route53 --- .../aws/route53/record/README.md | 36 +++++++++++++++++++ terraform-modules/aws/route53/record/main.tf | 10 ++++++ .../aws/route53/record/outputs.tf | 9 +++++ .../aws/route53/record/variables.tf | 32 +++++++++++++++++ 4 files changed, 87 insertions(+) create mode 100644 terraform-modules/aws/route53/record/README.md create mode 100644 terraform-modules/aws/route53/record/main.tf create mode 100644 terraform-modules/aws/route53/record/outputs.tf create mode 100644 terraform-modules/aws/route53/record/variables.tf diff --git a/terraform-modules/aws/route53/record/README.md b/terraform-modules/aws/route53/record/README.md new file mode 100644 index 000000000..5eee9f04a --- /dev/null +++ b/terraform-modules/aws/route53/record/README.md @@ -0,0 +1,36 @@ +## Requirements + +No requirements. + +## Providers + +| Name | Version | +|------|---------| +| [aws](#provider\_aws) | n/a | + +## Modules + +No modules. + +## Resources + +| Name | Type | +|------|------| +| [aws_route53_record.example_record](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_record) | resource | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [evaluate\_target\_health](#input\_evaluate\_target\_health) | whether or not Route 53 should perform health checks on the target of an alias record before responding to DNS queries. | `bool` | `false` | no | +| [fqdn](#input\_fqdn) | FQDN built using the zone domain and name. | `string` | n/a | yes | +| [name](#input\_name) | The name for the Route 53 record. | `string` | n/a | yes | +| [record\_name](#input\_record\_name) | The name for the Route 53 record. | `string` | n/a | yes | +| [route53\_zone\_id](#input\_route53\_zone\_id) | The ID of the Route 53 zone where the record will be created. | `string` | n/a | yes | +| [type](#input\_type) | Also known as an Address record, is used to map a domain name to an IP address. | `string` | `"A"` | no | +| [vpc\_endpoint\_dns\_name](#input\_vpc\_endpoint\_dns\_name) | The DNS name of the VPC Endpoint. | `string` | n/a | yes | +| [vpc\_endpoint\_zone\_id](#input\_vpc\_endpoint\_zone\_id) | The ID of the Hosted Zone for the VPC Endpoint. | `string` | n/a | yes | + +## Outputs + +No outputs. diff --git a/terraform-modules/aws/route53/record/main.tf b/terraform-modules/aws/route53/record/main.tf new file mode 100644 index 000000000..4152f178b --- /dev/null +++ b/terraform-modules/aws/route53/record/main.tf @@ -0,0 +1,10 @@ +resource "aws_route53_record" "example_record" { + zone_id = var.route53_zone_id + name = var.record_name + type = var.type + alias { + name = var.vpc_endpoint_dns_name + zone_id = var.vpc_endpoint_zone_id + evaluate_target_health = false + } +} \ No newline at end of file diff --git a/terraform-modules/aws/route53/record/outputs.tf b/terraform-modules/aws/route53/record/outputs.tf new file mode 100644 index 000000000..5fbecba60 --- /dev/null +++ b/terraform-modules/aws/route53/record/outputs.tf @@ -0,0 +1,9 @@ +variable "name" { + description = "The name for the Route 53 record." + type = string +} + +variable "fqdn" { + description = "FQDN built using the zone domain and name." + type = string +} \ No newline at end of file diff --git a/terraform-modules/aws/route53/record/variables.tf b/terraform-modules/aws/route53/record/variables.tf new file mode 100644 index 000000000..f896bcab9 --- /dev/null +++ b/terraform-modules/aws/route53/record/variables.tf @@ -0,0 +1,32 @@ +variable "route53_zone_id" { + description = "The ID of the Route 53 zone where the record will be created." + type = string +} + +variable "record_name" { + description = "The name for the Route 53 record." + type = string +} + +variable "type" { + type = string + default = "A" + description = "Also known as an Address record, is used to map a domain name to an IP address." +} + + +variable "vpc_endpoint_dns_name" { + description = "The DNS name of the VPC Endpoint." + type = string +} + +variable "vpc_endpoint_zone_id" { + description = "The ID of the Hosted Zone for the VPC Endpoint." + type = string +} + +variable "evaluate_target_health" { + type = bool + default = false + description = "whether or not Route 53 should perform health checks on the target of an alias record before responding to DNS queries." +} From 85dd2209343f7b688d0d637d2d8b4c5b0bfc3b44 Mon Sep 17 00:00:00 2001 From: Bayron Carranza Date: Thu, 2 Mar 2023 09:33:50 -0600 Subject: [PATCH 02/36] fix output vars --- terraform-modules/aws/route53/record/README.md | 9 +++++---- terraform-modules/aws/route53/record/main.tf | 2 +- terraform-modules/aws/route53/record/outputs.tf | 10 +++++----- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/terraform-modules/aws/route53/record/README.md b/terraform-modules/aws/route53/record/README.md index 5eee9f04a..781290251 100644 --- a/terraform-modules/aws/route53/record/README.md +++ b/terraform-modules/aws/route53/record/README.md @@ -16,15 +16,13 @@ No modules. | Name | Type | |------|------| -| [aws_route53_record.example_record](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_record) | resource | +| [aws_route53_record.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_record) | resource | ## Inputs | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| | [evaluate\_target\_health](#input\_evaluate\_target\_health) | whether or not Route 53 should perform health checks on the target of an alias record before responding to DNS queries. | `bool` | `false` | no | -| [fqdn](#input\_fqdn) | FQDN built using the zone domain and name. | `string` | n/a | yes | -| [name](#input\_name) | The name for the Route 53 record. | `string` | n/a | yes | | [record\_name](#input\_record\_name) | The name for the Route 53 record. | `string` | n/a | yes | | [route53\_zone\_id](#input\_route53\_zone\_id) | The ID of the Route 53 zone where the record will be created. | `string` | n/a | yes | | [type](#input\_type) | Also known as an Address record, is used to map a domain name to an IP address. | `string` | `"A"` | no | @@ -33,4 +31,7 @@ No modules. ## Outputs -No outputs. +| Name | Description | +|------|-------------| +| [fqdn](#output\_fqdn) | FQDN built using the zone domain and name. | +| [name](#output\_name) | The name for the Route 53 record. | diff --git a/terraform-modules/aws/route53/record/main.tf b/terraform-modules/aws/route53/record/main.tf index 4152f178b..e5c13cd18 100644 --- a/terraform-modules/aws/route53/record/main.tf +++ b/terraform-modules/aws/route53/record/main.tf @@ -1,4 +1,4 @@ -resource "aws_route53_record" "example_record" { +resource "aws_route53_record" "this" { zone_id = var.route53_zone_id name = var.record_name type = var.type diff --git a/terraform-modules/aws/route53/record/outputs.tf b/terraform-modules/aws/route53/record/outputs.tf index 5fbecba60..511ba9275 100644 --- a/terraform-modules/aws/route53/record/outputs.tf +++ b/terraform-modules/aws/route53/record/outputs.tf @@ -1,9 +1,9 @@ -variable "name" { +output "name" { + value = aws_route53_record.this.name description = "The name for the Route 53 record." - type = string } -variable "fqdn" { +output "fqdn" { + value = aws_route53_record.this.fqdn description = "FQDN built using the zone domain and name." - type = string -} \ No newline at end of file +} From cfe494e55025c893dc04fa74e298bc614179e379 Mon Sep 17 00:00:00 2001 From: Bayron Carranza Date: Thu, 2 Mar 2023 13:53:02 -0600 Subject: [PATCH 03/36] record route 53 aws transfer. --- .../README.md | 45 +++++++++++++++++++ .../record-vpc-endpoint-sftp-transfer/main.tf | 35 +++++++++++++++ .../outputs.tf | 24 ++++++++++ .../variables.tf | 38 ++++++++++++++++ 4 files changed, 142 insertions(+) create mode 100644 terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/README.md create mode 100644 terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf create mode 100644 terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/outputs.tf create mode 100644 terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/variables.tf diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/README.md b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/README.md new file mode 100644 index 000000000..e2352e87c --- /dev/null +++ b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/README.md @@ -0,0 +1,45 @@ +## Requirements + +No requirements. + +## Providers + +| Name | Version | +|------|---------| +| [aws](#provider\_aws) | n/a | + +## Modules + +| Name | Source | Version | +|------|--------|---------| +| [record](#module\_record) | ../record/ | n/a | + +## Resources + +| Name | Type | +|------|------| +| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source | +| [aws_transfer_server.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/transfer_server) | data source | +| [aws_vpc_endpoint.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc_endpoint) | data source | +| [aws_vpc_endpoint_service.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc_endpoint_service) | data source | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [evaluate\_target\_health](#input\_evaluate\_target\_health) | whether or not Route 53 should perform health checks on the target of an alias record before responding to DNS queries. | `bool` | `false` | no | +| [record\_name](#input\_record\_name) | The name for the Route 53 record. | `string` | n/a | yes | +| [route53\_zone\_id](#input\_route53\_zone\_id) | The ID of the Route 53 zone where the record will be created. | `string` | n/a | yes | +| [transfer\_server\_id](#input\_transfer\_server\_id) | The ID of the AWS Transfer Server | `string` | `""` | no | +| [type](#input\_type) | Also known as an Address record, is used to map a domain name to an IP address. | `string` | `"A"` | no | +| [vpc\_endpoint\_dns\_name](#input\_vpc\_endpoint\_dns\_name) | The DNS name of the VPC Endpoint. | `string` | n/a | yes | +| [vpc\_endpoint\_zone\_id](#input\_vpc\_endpoint\_zone\_id) | The ID of the Hosted Zone for the VPC Endpoint. | `string` | n/a | yes | + +## Outputs + +| Name | Description | +|------|-------------| +| [fqdn](#output\_fqdn) | FQDN built using the zone domain and name. | +| [vpc\_endpoint\_dns\_entry](#output\_vpc\_endpoint\_dns\_entry) | Retrieve the DNS name associated with an AWS VPC Endpoint. | +| [vpc\_endpoint\_dns\_name](#output\_vpc\_endpoint\_dns\_name) | Retrieves the primary DNS name associated with the VPC Endpoint | +| [vpc\_endpoint\_id](#output\_vpc\_endpoint\_id) | ID of an AWS VPC Endpoint | diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf new file mode 100644 index 000000000..add2a1c24 --- /dev/null +++ b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf @@ -0,0 +1,35 @@ + +data "aws_caller_identity" "current" {} + +# Get the ARN of the Transfer Server +data "aws_transfer_server" "this" { + server_id = var.transfer_server_id +} + +# Get the VPC Endpoint Service Name for the Transfer Service +data "aws_vpc_endpoint_service" "this" { + service = "com.amazonaws.${data.aws_caller_identity.current.region}.transfer.server.${data.aws_transfer_server.this.id}" +} + +# Get the VPC Endpoint ID for the Transfer Service +data "aws_vpc_endpoint" "this" { + service_name = data.aws_vpc_endpoint_service.this.service_name + vpc_id = var.vpc_id +} + +module "record" { + source = "../record/" + inputs { + zone_id = var.route53_zone_id + name = var.record_name + type = var.type + alias { + name = var.vpc_endpoint_dns_name + zone_id = var.vpc_endpoint_zone_id + evaluate_target_health = false + } + } +} + + + diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/outputs.tf b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/outputs.tf new file mode 100644 index 000000000..0003d9b3d --- /dev/null +++ b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/outputs.tf @@ -0,0 +1,24 @@ +output "vpc_endpoint_id" { + value = module.record.name + description = "The name for the Route 53 record." +} + +output "fqdn" { + value = module.record.fqdn + description = "FQDN built using the zone domain and name." +} + +output "vpc_endpoint_id" { + value = data.aws_vpc_endpoint.this.id + description = "ID of an AWS VPC Endpoint" +} + +output "vpc_endpoint_dns_entry" { + value = data.aws_vpc_endpoint.this.dns_entry + description = "Retrieve the DNS name associated with an AWS VPC Endpoint." +} + +output "vpc_endpoint_dns_name" { + value = data.aws_vpc_endpoint.this.dns_name + description = "Retrieves the primary DNS name associated with the VPC Endpoint" +} \ No newline at end of file diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/variables.tf b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/variables.tf new file mode 100644 index 000000000..55d7fc55e --- /dev/null +++ b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/variables.tf @@ -0,0 +1,38 @@ +variable "route53_zone_id" { + description = "The ID of the Route 53 zone where the record will be created." + type = string +} + +variable "record_name" { + description = "The name for the Route 53 record." + type = string +} + +variable "type" { + type = string + default = "A" + description = "Also known as an Address record, is used to map a domain name to an IP address." +} + + +variable "vpc_endpoint_dns_name" { + description = "The DNS name of the VPC Endpoint." + type = string +} + +variable "vpc_endpoint_zone_id" { + description = "The ID of the Hosted Zone for the VPC Endpoint." + type = string +} + +variable "evaluate_target_health" { + type = bool + default = false + description = "whether or not Route 53 should perform health checks on the target of an alias record before responding to DNS queries." +} + +variable "transfer_server_id" { + type = string + default = "" + description = "The ID of the AWS Transfer Server" +} From 1912d6b6e6130bf79bd0b93017c4e833b88cd1b3 Mon Sep 17 00:00:00 2001 From: Bayron Carranza Date: Thu, 2 Mar 2023 14:01:54 -0600 Subject: [PATCH 04/36] fix aws transfer attributes --- .../route53/record-vpc-endpoint-sftp-transfer/main.tf | 4 ++-- .../record-vpc-endpoint-sftp-transfer/variables.tf | 11 ----------- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf index add2a1c24..3c34a6744 100644 --- a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf +++ b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf @@ -24,8 +24,8 @@ module "record" { name = var.record_name type = var.type alias { - name = var.vpc_endpoint_dns_name - zone_id = var.vpc_endpoint_zone_id + name = data.aws_vpc_endpoint_service.dns_name + zone_id = data.aws_vpc_endpoint_service.zone_id evaluate_target_health = false } } diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/variables.tf b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/variables.tf index 55d7fc55e..205aa961e 100644 --- a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/variables.tf +++ b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/variables.tf @@ -14,17 +14,6 @@ variable "type" { description = "Also known as an Address record, is used to map a domain name to an IP address." } - -variable "vpc_endpoint_dns_name" { - description = "The DNS name of the VPC Endpoint." - type = string -} - -variable "vpc_endpoint_zone_id" { - description = "The ID of the Hosted Zone for the VPC Endpoint." - type = string -} - variable "evaluate_target_health" { type = bool default = false From 1a6d0363a3649111c86e74592c2cd07a20e585f5 Mon Sep 17 00:00:00 2001 From: Bayron Carranza Date: Thu, 2 Mar 2023 14:23:50 -0600 Subject: [PATCH 05/36] record name --- .../aws/route53/record-vpc-endpoint-sftp-transfer/outputs.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/outputs.tf b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/outputs.tf index 0003d9b3d..a913be6ff 100644 --- a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/outputs.tf +++ b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/outputs.tf @@ -1,4 +1,4 @@ -output "vpc_endpoint_id" { +output "name" { value = module.record.name description = "The name for the Route 53 record." } From 35d84252377c63f7a0c737777b365a2edcff4f5a Mon Sep 17 00:00:00 2001 From: Bayron Carranza Date: Thu, 2 Mar 2023 14:42:58 -0600 Subject: [PATCH 06/36] fix module --- .../record-vpc-endpoint-sftp-transfer/main.tf | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf index 3c34a6744..ff06392af 100644 --- a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf +++ b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf @@ -19,17 +19,8 @@ data "aws_vpc_endpoint" "this" { module "record" { source = "../record/" - inputs { - zone_id = var.route53_zone_id - name = var.record_name - type = var.type - alias { - name = data.aws_vpc_endpoint_service.dns_name - zone_id = data.aws_vpc_endpoint_service.zone_id - evaluate_target_health = false - } - } -} - - - + route53_zone_id = var.route53_zone_id + record_name = var.record_name + vpc_endpoint_dns_name = data.aws_vpc_endpoint.this.dns_name + vpc_endpoint_zone_id = data.aws_vpc_endpoint.this.zone_id +} \ No newline at end of file From d48229fdee01d1a9e674609c01c1b67367f68d27 Mon Sep 17 00:00:00 2001 From: Bayron Carranza Date: Thu, 2 Mar 2023 14:53:17 -0600 Subject: [PATCH 07/36] region --- .../aws/route53/record-vpc-endpoint-sftp-transfer/main.tf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf index ff06392af..1b1737096 100644 --- a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf +++ b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf @@ -1,5 +1,6 @@ data "aws_caller_identity" "current" {} +data "aws_region" "current" {} # Get the ARN of the Transfer Server data "aws_transfer_server" "this" { @@ -8,7 +9,7 @@ data "aws_transfer_server" "this" { # Get the VPC Endpoint Service Name for the Transfer Service data "aws_vpc_endpoint_service" "this" { - service = "com.amazonaws.${data.aws_caller_identity.current.region}.transfer.server.${data.aws_transfer_server.this.id}" + service = "com.amazonaws.${data.aws_region.current.name}.transfer.server.${data.aws_transfer_server.this.id}" } # Get the VPC Endpoint ID for the Transfer Service From 2dac7e7a536b4e5e78b9cd079acf4f48c4b46c34 Mon Sep 17 00:00:00 2001 From: Bayron Carranza Date: Thu, 2 Mar 2023 15:03:39 -0600 Subject: [PATCH 08/36] vpc id --- .../route53/record-vpc-endpoint-sftp-transfer/README.md | 5 +++-- .../route53/record-vpc-endpoint-sftp-transfer/variables.tf | 7 +++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/README.md b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/README.md index e2352e87c..796a32614 100644 --- a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/README.md +++ b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/README.md @@ -19,6 +19,7 @@ No requirements. | Name | Type | |------|------| | [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source | +| [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source | | [aws_transfer_server.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/transfer_server) | data source | | [aws_vpc_endpoint.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc_endpoint) | data source | | [aws_vpc_endpoint_service.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc_endpoint_service) | data source | @@ -32,14 +33,14 @@ No requirements. | [route53\_zone\_id](#input\_route53\_zone\_id) | The ID of the Route 53 zone where the record will be created. | `string` | n/a | yes | | [transfer\_server\_id](#input\_transfer\_server\_id) | The ID of the AWS Transfer Server | `string` | `""` | no | | [type](#input\_type) | Also known as an Address record, is used to map a domain name to an IP address. | `string` | `"A"` | no | -| [vpc\_endpoint\_dns\_name](#input\_vpc\_endpoint\_dns\_name) | The DNS name of the VPC Endpoint. | `string` | n/a | yes | -| [vpc\_endpoint\_zone\_id](#input\_vpc\_endpoint\_zone\_id) | The ID of the Hosted Zone for the VPC Endpoint. | `string` | n/a | yes | +| [vpc\_id](#input\_vpc\_id) | The VPC ID Where VPC enpoint is configured | `string` | `""` | no | ## Outputs | Name | Description | |------|-------------| | [fqdn](#output\_fqdn) | FQDN built using the zone domain and name. | +| [name](#output\_name) | The name for the Route 53 record. | | [vpc\_endpoint\_dns\_entry](#output\_vpc\_endpoint\_dns\_entry) | Retrieve the DNS name associated with an AWS VPC Endpoint. | | [vpc\_endpoint\_dns\_name](#output\_vpc\_endpoint\_dns\_name) | Retrieves the primary DNS name associated with the VPC Endpoint | | [vpc\_endpoint\_id](#output\_vpc\_endpoint\_id) | ID of an AWS VPC Endpoint | diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/variables.tf b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/variables.tf index 205aa961e..554a8e5e9 100644 --- a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/variables.tf +++ b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/variables.tf @@ -25,3 +25,10 @@ variable "transfer_server_id" { default = "" description = "The ID of the AWS Transfer Server" } + +variable vpc_id { + type = string + default = "" + description = "The VPC ID Where VPC enpoint is configured" +} + From c70252ccbf45e696f9883af6654aa971e1db47f0 Mon Sep 17 00:00:00 2001 From: Bayron Carranza Date: Thu, 2 Mar 2023 15:17:55 -0600 Subject: [PATCH 09/36] dns_entry --- .../aws/route53/record-vpc-endpoint-sftp-transfer/main.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf index 1b1737096..3f2e9c422 100644 --- a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf +++ b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf @@ -22,6 +22,6 @@ module "record" { source = "../record/" route53_zone_id = var.route53_zone_id record_name = var.record_name - vpc_endpoint_dns_name = data.aws_vpc_endpoint.this.dns_name - vpc_endpoint_zone_id = data.aws_vpc_endpoint.this.zone_id + vpc_endpoint_dns_name = data.aws_vpc_endpoint.this.dns_entry.dns_name + vpc_endpoint_zone_id = data.aws_vpc_endpoint.this.dns_entry.hosted_zone_id } \ No newline at end of file From 515604d15045fa79378be4618534f534821ad054 Mon Sep 17 00:00:00 2001 From: Bayron Carranza Date: Thu, 2 Mar 2023 15:29:43 -0600 Subject: [PATCH 10/36] output fixes --- .../record-vpc-endpoint-sftp-transfer/outputs.tf | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/outputs.tf b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/outputs.tf index a913be6ff..674540e01 100644 --- a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/outputs.tf +++ b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/outputs.tf @@ -13,12 +13,12 @@ output "vpc_endpoint_id" { description = "ID of an AWS VPC Endpoint" } -output "vpc_endpoint_dns_entry" { - value = data.aws_vpc_endpoint.this.dns_entry +output "vpc_endpoint_dns_name" { + value = data.aws_vpc_endpoint.this.dns_entry.dns_name description = "Retrieve the DNS name associated with an AWS VPC Endpoint." } -output "vpc_endpoint_dns_name" { - value = data.aws_vpc_endpoint.this.dns_name - description = "Retrieves the primary DNS name associated with the VPC Endpoint" +output "vpc_endpoint_hosted_zone_id" { + value = data.aws_vpc_endpoint.this.dns_entry.hosted_zone_id + description = "Retrieves the Zona ID name associated with the VPC Endpoint" } \ No newline at end of file From 1f83d9fb653f23f15fa83b89accfe6be9095efff Mon Sep 17 00:00:00 2001 From: Bayron Carranza Date: Thu, 2 Mar 2023 15:39:26 -0600 Subject: [PATCH 11/36] arrays --- .../aws/route53/record-vpc-endpoint-sftp-transfer/main.tf | 4 ++-- .../aws/route53/record-vpc-endpoint-sftp-transfer/outputs.tf | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf index 3f2e9c422..bf3082dbf 100644 --- a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf +++ b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf @@ -22,6 +22,6 @@ module "record" { source = "../record/" route53_zone_id = var.route53_zone_id record_name = var.record_name - vpc_endpoint_dns_name = data.aws_vpc_endpoint.this.dns_entry.dns_name - vpc_endpoint_zone_id = data.aws_vpc_endpoint.this.dns_entry.hosted_zone_id + vpc_endpoint_dns_name = data.aws_vpc_endpoint.this.dns_entry.dns_name[0] + vpc_endpoint_zone_id = data.aws_vpc_endpoint.this.dns_entry.hosted_zone_id[0] } \ No newline at end of file diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/outputs.tf b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/outputs.tf index 674540e01..787deacde 100644 --- a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/outputs.tf +++ b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/outputs.tf @@ -14,11 +14,11 @@ output "vpc_endpoint_id" { } output "vpc_endpoint_dns_name" { - value = data.aws_vpc_endpoint.this.dns_entry.dns_name + value = data.aws_vpc_endpoint.this.dns_entry.dns_name[0] description = "Retrieve the DNS name associated with an AWS VPC Endpoint." } output "vpc_endpoint_hosted_zone_id" { - value = data.aws_vpc_endpoint.this.dns_entry.hosted_zone_id + value = data.aws_vpc_endpoint.this.dns_entry.hosted_zone_id[0] description = "Retrieves the Zona ID name associated with the VPC Endpoint" } \ No newline at end of file From 133ab9f5e7bdb90d02c05af751d89fa323c4b084 Mon Sep 17 00:00:00 2001 From: Bayron Carranza Date: Thu, 2 Mar 2023 15:46:51 -0600 Subject: [PATCH 12/36] fix arrays --- .../aws/route53/record-vpc-endpoint-sftp-transfer/main.tf | 4 ++-- .../aws/route53/record-vpc-endpoint-sftp-transfer/outputs.tf | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf index bf3082dbf..406623955 100644 --- a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf +++ b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf @@ -22,6 +22,6 @@ module "record" { source = "../record/" route53_zone_id = var.route53_zone_id record_name = var.record_name - vpc_endpoint_dns_name = data.aws_vpc_endpoint.this.dns_entry.dns_name[0] - vpc_endpoint_zone_id = data.aws_vpc_endpoint.this.dns_entry.hosted_zone_id[0] + vpc_endpoint_dns_name = data.aws_vpc_endpoint.this.dns_entry[0].dns_name + vpc_endpoint_zone_id = data.aws_vpc_endpoint.this.dns_entry[0].hosted_zone_id } \ No newline at end of file diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/outputs.tf b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/outputs.tf index 787deacde..3e930a9dd 100644 --- a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/outputs.tf +++ b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/outputs.tf @@ -14,11 +14,11 @@ output "vpc_endpoint_id" { } output "vpc_endpoint_dns_name" { - value = data.aws_vpc_endpoint.this.dns_entry.dns_name[0] + value = data.aws_vpc_endpoint.this.dns_entry[0].dns_name description = "Retrieve the DNS name associated with an AWS VPC Endpoint." } output "vpc_endpoint_hosted_zone_id" { - value = data.aws_vpc_endpoint.this.dns_entry.hosted_zone_id[0] + value = data.aws_vpc_endpoint.this.dns_entry[0].hosted_zone_id description = "Retrieves the Zona ID name associated with the VPC Endpoint" } \ No newline at end of file From 2432d2454ae18b573a97851199e688efb8a15673 Mon Sep 17 00:00:00 2001 From: Bayron Carranza Date: Thu, 2 Mar 2023 18:47:17 -0600 Subject: [PATCH 13/36] vpc endpoint id --- .../aws/route53/record-vpc-endpoint-sftp-transfer/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf index 406623955..73db75b46 100644 --- a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf +++ b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf @@ -9,7 +9,7 @@ data "aws_transfer_server" "this" { # Get the VPC Endpoint Service Name for the Transfer Service data "aws_vpc_endpoint_service" "this" { - service = "com.amazonaws.${data.aws_region.current.name}.transfer.server.${data.aws_transfer_server.this.id}" + id = data.aws_transfer_server.this.vpc_endpoint_id } # Get the VPC Endpoint ID for the Transfer Service From b24b4c6506626f3dd0fb892afbe34ba3edda48f1 Mon Sep 17 00:00:00 2001 From: Bayron Carranza Date: Thu, 2 Mar 2023 19:33:35 -0600 Subject: [PATCH 14/36] vpc endpoint id --- .../aws/route53/record-vpc-endpoint-sftp-transfer/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf index 73db75b46..5d5f5a552 100644 --- a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf +++ b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf @@ -9,7 +9,7 @@ data "aws_transfer_server" "this" { # Get the VPC Endpoint Service Name for the Transfer Service data "aws_vpc_endpoint_service" "this" { - id = data.aws_transfer_server.this.vpc_endpoint_id + id = data.aws_transfer_server.this.endpoint_details.vpc_endpoint_id } # Get the VPC Endpoint ID for the Transfer Service From 4674c8e2e56531a15f1f3738a8224153e75f2295 Mon Sep 17 00:00:00 2001 From: Bayron Carranza Date: Thu, 2 Mar 2023 19:42:34 -0600 Subject: [PATCH 15/36] endpoint details --- .../aws/route53/record-vpc-endpoint-sftp-transfer/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf index 5d5f5a552..1ee84f4e5 100644 --- a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf +++ b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf @@ -9,7 +9,7 @@ data "aws_transfer_server" "this" { # Get the VPC Endpoint Service Name for the Transfer Service data "aws_vpc_endpoint_service" "this" { - id = data.aws_transfer_server.this.endpoint_details.vpc_endpoint_id + id = data.aws_transfer_server.this.endpoint_details.0.vpc_endpoint_id } # Get the VPC Endpoint ID for the Transfer Service From fb736e5a2e15ffc10c8fc1aea2c3fc09612606e0 Mon Sep 17 00:00:00 2001 From: Bayron Carranza Date: Thu, 2 Mar 2023 20:16:51 -0600 Subject: [PATCH 16/36] endpoint_details --- .../aws/route53/record-vpc-endpoint-sftp-transfer/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf index 1ee84f4e5..b320e57f5 100644 --- a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf +++ b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf @@ -9,7 +9,7 @@ data "aws_transfer_server" "this" { # Get the VPC Endpoint Service Name for the Transfer Service data "aws_vpc_endpoint_service" "this" { - id = data.aws_transfer_server.this.endpoint_details.0.vpc_endpoint_id + id = data.aws_transfer_server.this.endpoint_details[0].vpc_endpoint_id } # Get the VPC Endpoint ID for the Transfer Service From a5915e72abf24ce256b3adbc84d51d6289e8314b Mon Sep 17 00:00:00 2001 From: Bayron Carranza Date: Thu, 2 Mar 2023 20:34:17 -0600 Subject: [PATCH 17/36] other way to get vpc endpoint it. --- .../record-vpc-endpoint-sftp-transfer/main.tf | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf index b320e57f5..0a5fa4349 100644 --- a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf +++ b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf @@ -8,16 +8,18 @@ data "aws_transfer_server" "this" { } # Get the VPC Endpoint Service Name for the Transfer Service -data "aws_vpc_endpoint_service" "this" { - id = data.aws_transfer_server.this.endpoint_details[0].vpc_endpoint_id -} - # Get the VPC Endpoint ID for the Transfer Service data "aws_vpc_endpoint" "this" { - service_name = data.aws_vpc_endpoint_service.this.service_name - vpc_id = var.vpc_id + count = local.is_enabled + vpc_id = var.vpc_id + + filter { + name = "vpc-endpoint-id" + values = ["${data.aws_transfer_server.this[0].endpoint_details[0].vpc_endpoint_id}"] + } } + module "record" { source = "../record/" route53_zone_id = var.route53_zone_id From 6cfb974955dea86d435567e601fce5d93307ffed Mon Sep 17 00:00:00 2001 From: Bayron Carranza Date: Thu, 2 Mar 2023 20:53:12 -0600 Subject: [PATCH 18/36] fix --- .../record-vpc-endpoint-sftp-transfer/main.tf | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf index 0a5fa4349..b320e57f5 100644 --- a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf +++ b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf @@ -8,18 +8,16 @@ data "aws_transfer_server" "this" { } # Get the VPC Endpoint Service Name for the Transfer Service +data "aws_vpc_endpoint_service" "this" { + id = data.aws_transfer_server.this.endpoint_details[0].vpc_endpoint_id +} + # Get the VPC Endpoint ID for the Transfer Service data "aws_vpc_endpoint" "this" { - count = local.is_enabled - vpc_id = var.vpc_id - - filter { - name = "vpc-endpoint-id" - values = ["${data.aws_transfer_server.this[0].endpoint_details[0].vpc_endpoint_id}"] - } + service_name = data.aws_vpc_endpoint_service.this.service_name + vpc_id = var.vpc_id } - module "record" { source = "../record/" route53_zone_id = var.route53_zone_id From 72addb63c2f1cd145fc8be9480b293c2fdf2a391 Mon Sep 17 00:00:00 2001 From: Bayron Carranza Date: Thu, 2 Mar 2023 21:40:22 -0600 Subject: [PATCH 19/36] test harcoding --- .../route53/record-vpc-endpoint-sftp-transfer/main.tf | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf index b320e57f5..97efadf89 100644 --- a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf +++ b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf @@ -2,11 +2,19 @@ data "aws_caller_identity" "current" {} data "aws_region" "current" {} +/* # Get the ARN of the Transfer Server data "aws_transfer_server" "this" { server_id = var.transfer_server_id } +*/ +data "aws_vpc_endpoint" "this" { + service_name = "com.amazonaws.${data.aws_region.current.name}.transfer.server.c-0008" + vpc_id = var.vpc_id +} + +/* # Get the VPC Endpoint Service Name for the Transfer Service data "aws_vpc_endpoint_service" "this" { id = data.aws_transfer_server.this.endpoint_details[0].vpc_endpoint_id @@ -17,6 +25,7 @@ data "aws_vpc_endpoint" "this" { service_name = data.aws_vpc_endpoint_service.this.service_name vpc_id = var.vpc_id } +*/ module "record" { source = "../record/" From 65107a8216f85ad3dbca68debd86a2078e681a0f Mon Sep 17 00:00:00 2001 From: Bayron Carranza Date: Thu, 2 Mar 2023 23:56:55 -0600 Subject: [PATCH 20/36] testing local-exec --- .../record-vpc-endpoint-sftp-transfer/main.tf | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf index 97efadf89..7c1620450 100644 --- a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf +++ b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf @@ -2,30 +2,24 @@ data "aws_caller_identity" "current" {} data "aws_region" "current" {} -/* -# Get the ARN of the Transfer Server -data "aws_transfer_server" "this" { - server_id = var.transfer_server_id -} -*/ - -data "aws_vpc_endpoint" "this" { - service_name = "com.amazonaws.${data.aws_region.current.name}.transfer.server.c-0008" - vpc_id = var.vpc_id -} +resource "null_resource" "extract_vpc_endpoint_id" { + provisioner "local-exec" { + command = "aws transfer describe-server --server-id ${var.transfer_server_id} --query 'Server.EndpointDetails.VpcEndpointId' --output text" -/* -# Get the VPC Endpoint Service Name for the Transfer Service -data "aws_vpc_endpoint_service" "this" { - id = data.aws_transfer_server.this.endpoint_details[0].vpc_endpoint_id + environment = { + AWS_REGION = data.aws_region.current.name + } + } } # Get the VPC Endpoint ID for the Transfer Service data "aws_vpc_endpoint" "this" { - service_name = data.aws_vpc_endpoint_service.this.service_name - vpc_id = var.vpc_id + id = vpc_id + + depends_on = [ + null_resource.extract_vpc_endpoint_id + ] } -*/ module "record" { source = "../record/" @@ -33,4 +27,8 @@ module "record" { record_name = var.record_name vpc_endpoint_dns_name = data.aws_vpc_endpoint.this.dns_entry[0].dns_name vpc_endpoint_zone_id = data.aws_vpc_endpoint.this.dns_entry[0].hosted_zone_id + + depends_on = [ + aws_vpc_endpoint.this + ] } \ No newline at end of file From 6357618a2e6d57b7786bc7cb8f205b1ff53deafa Mon Sep 17 00:00:00 2001 From: Bayron Carranza Date: Fri, 3 Mar 2023 00:25:05 -0600 Subject: [PATCH 21/36] depends on --- .../aws/route53/record-vpc-endpoint-sftp-transfer/main.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf index 7c1620450..cc5c4a489 100644 --- a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf +++ b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf @@ -14,7 +14,7 @@ resource "null_resource" "extract_vpc_endpoint_id" { # Get the VPC Endpoint ID for the Transfer Service data "aws_vpc_endpoint" "this" { - id = vpc_id + id = data.null_resource.extract_vpc_endpoint_id.stdout depends_on = [ null_resource.extract_vpc_endpoint_id @@ -29,6 +29,6 @@ module "record" { vpc_endpoint_zone_id = data.aws_vpc_endpoint.this.dns_entry[0].hosted_zone_id depends_on = [ - aws_vpc_endpoint.this + data.aws_vpc_endpoint.this ] } \ No newline at end of file From 53cb42621d9e589a96228accd7f4f373a45486ca Mon Sep 17 00:00:00 2001 From: Bayron Carranza Date: Fri, 3 Mar 2023 00:37:38 -0600 Subject: [PATCH 22/36] typo data --- .../aws/route53/record-vpc-endpoint-sftp-transfer/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf index cc5c4a489..f4293acb3 100644 --- a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf +++ b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf @@ -14,7 +14,7 @@ resource "null_resource" "extract_vpc_endpoint_id" { # Get the VPC Endpoint ID for the Transfer Service data "aws_vpc_endpoint" "this" { - id = data.null_resource.extract_vpc_endpoint_id.stdout + id = null_resource.extract_vpc_endpoint_id.stdout depends_on = [ null_resource.extract_vpc_endpoint_id From 47d06647acfed70981f9539c6f07fbf4c4605a62 Mon Sep 17 00:00:00 2001 From: Bayron Carranza Date: Fri, 3 Mar 2023 00:51:40 -0600 Subject: [PATCH 23/36] null_resource.cluster.triggers.output --- .../aws/route53/record-vpc-endpoint-sftp-transfer/main.tf | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf index f4293acb3..6a124d524 100644 --- a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf +++ b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf @@ -3,18 +3,22 @@ data "aws_caller_identity" "current" {} data "aws_region" "current" {} resource "null_resource" "extract_vpc_endpoint_id" { + triggers = { + output = "${local_executed_output}" + } provisioner "local-exec" { command = "aws transfer describe-server --server-id ${var.transfer_server_id} --query 'Server.EndpointDetails.VpcEndpointId' --output text" environment = { AWS_REGION = data.aws_region.current.name + LOCAL_EXECUTED_OUTPUT = "${local_executed_output}" } } } # Get the VPC Endpoint ID for the Transfer Service data "aws_vpc_endpoint" "this" { - id = null_resource.extract_vpc_endpoint_id.stdout + id = null_resource.cluster.triggers.output depends_on = [ null_resource.extract_vpc_endpoint_id From 0da8c72abfb0da066537d019367c845cbe9161dc Mon Sep 17 00:00:00 2001 From: Bayron Carranza Date: Fri, 3 Mar 2023 09:37:56 -0600 Subject: [PATCH 24/36] local exec provisioner --- .../record-vpc-endpoint-sftp-transfer/main.tf | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf index 6a124d524..0afd2eed0 100644 --- a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf +++ b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf @@ -2,26 +2,28 @@ data "aws_caller_identity" "current" {} data "aws_region" "current" {} -resource "null_resource" "extract_vpc_endpoint_id" { - triggers = { - output = "${local_executed_output}" - } - provisioner "local-exec" { - command = "aws transfer describe-server --server-id ${var.transfer_server_id} --query 'Server.EndpointDetails.VpcEndpointId' --output text" - environment = { - AWS_REGION = data.aws_region.current.name - LOCAL_EXECUTED_OUTPUT = "${local_executed_output}" - } +resource "null_resource" "output-vpc-endpoint-id" { + provisioner "local-exec" { + command = "aws transfer describe-server --server-id "${var.transfer_server_id}" --query 'Server.EndpointDetails.VpcEndpointId' --output text > ${data.template_file.log_name.rendered}" } } +data "template_file" "log_name" { + template = "${path.module}/output.log" +} + +data "local_file" "get-vpc-endpoint-id-value" { + filename = "${data.template_file.log_name.rendered}" + depends_on = ["null_resource.output-vpc-endpoint-id"] +} + # Get the VPC Endpoint ID for the Transfer Service data "aws_vpc_endpoint" "this" { - id = null_resource.cluster.triggers.output + id = data.local_file. depends_on = [ - null_resource.extract_vpc_endpoint_id + data.local_file.get-vpc-endpoint-id-value ] } From 9bfdabd940f54ba95eea9f7e6a7eee255b35ef4a Mon Sep 17 00:00:00 2001 From: Bayron Carranza Date: Fri, 3 Mar 2023 09:56:32 -0600 Subject: [PATCH 25/36] typos in output --- .../aws/route53/record-vpc-endpoint-sftp-transfer/main.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf index 0afd2eed0..2ce3b8d7f 100644 --- a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf +++ b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf @@ -5,7 +5,7 @@ data "aws_region" "current" {} resource "null_resource" "output-vpc-endpoint-id" { provisioner "local-exec" { - command = "aws transfer describe-server --server-id "${var.transfer_server_id}" --query 'Server.EndpointDetails.VpcEndpointId' --output text > ${data.template_file.log_name.rendered}" + command = "aws transfer describe-server --server-id ${var.transfer_server_id} --query 'Server.EndpointDetails.VpcEndpointId' > ${data.template_file.log_name.rendered}" } } @@ -20,7 +20,7 @@ data "local_file" "get-vpc-endpoint-id-value" { # Get the VPC Endpoint ID for the Transfer Service data "aws_vpc_endpoint" "this" { - id = data.local_file. + id = data.local_file.get-vpc-endpoint-id-value depends_on = [ data.local_file.get-vpc-endpoint-id-value From 0c9a927bda74f32ca47416e314ebd6d700b24706 Mon Sep 17 00:00:00 2001 From: Bayron Carranza Date: Fri, 3 Mar 2023 10:14:18 -0600 Subject: [PATCH 26/36] add content --- .../aws/route53/record-vpc-endpoint-sftp-transfer/main.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf index 2ce3b8d7f..f5f07ad70 100644 --- a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf +++ b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf @@ -15,12 +15,12 @@ data "template_file" "log_name" { data "local_file" "get-vpc-endpoint-id-value" { filename = "${data.template_file.log_name.rendered}" - depends_on = ["null_resource.output-vpc-endpoint-id"] + depends_on = [null_resource.output-vpc-endpoint-id] } # Get the VPC Endpoint ID for the Transfer Service data "aws_vpc_endpoint" "this" { - id = data.local_file.get-vpc-endpoint-id-value + id = data.local_file.get-vpc-endpoint-id-value.content depends_on = [ data.local_file.get-vpc-endpoint-id-value From c6b491fa9bb55ebd0e68ad3afd1efee233fbbee3 Mon Sep 17 00:00:00 2001 From: Bayron Carranza Date: Fri, 3 Mar 2023 10:33:35 -0600 Subject: [PATCH 27/36] remove quotes --- .../aws/route53/record-vpc-endpoint-sftp-transfer/main.tf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf index f5f07ad70..5d716b8bb 100644 --- a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf +++ b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf @@ -20,7 +20,8 @@ data "local_file" "get-vpc-endpoint-id-value" { # Get the VPC Endpoint ID for the Transfer Service data "aws_vpc_endpoint" "this" { - id = data.local_file.get-vpc-endpoint-id-value.content + # Remove quotes + id = tr(data.local_file.get-vpc-endpoint-id-value.content, "\"", "") depends_on = [ data.local_file.get-vpc-endpoint-id-value From fd0c3748c893e06664fbb7eb152590fbd1da6148 Mon Sep 17 00:00:00 2001 From: Bayron Carranza Date: Fri, 3 Mar 2023 10:44:56 -0600 Subject: [PATCH 28/36] trim function --- .../aws/route53/record-vpc-endpoint-sftp-transfer/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf index 5d716b8bb..810369bdd 100644 --- a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf +++ b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf @@ -21,7 +21,7 @@ data "local_file" "get-vpc-endpoint-id-value" { # Get the VPC Endpoint ID for the Transfer Service data "aws_vpc_endpoint" "this" { # Remove quotes - id = tr(data.local_file.get-vpc-endpoint-id-value.content, "\"", "") + id = trim(data.local_file.get-vpc-endpoint-id-value.content, "\"") depends_on = [ data.local_file.get-vpc-endpoint-id-value From 1578e98b2e8f8a6197d84045b4a454e4564e7294 Mon Sep 17 00:00:00 2001 From: Bayron Carranza Date: Fri, 3 Mar 2023 11:07:49 -0600 Subject: [PATCH 29/36] vpc id --- .../aws/route53/record-vpc-endpoint-sftp-transfer/main.tf | 1 + 1 file changed, 1 insertion(+) diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf index 810369bdd..ef0cf0026 100644 --- a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf +++ b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf @@ -22,6 +22,7 @@ data "local_file" "get-vpc-endpoint-id-value" { data "aws_vpc_endpoint" "this" { # Remove quotes id = trim(data.local_file.get-vpc-endpoint-id-value.content, "\"") + vpc_id = var.vpc_id depends_on = [ data.local_file.get-vpc-endpoint-id-value From 07442a199d1311340affedb3ce98b13986616fd9 Mon Sep 17 00:00:00 2001 From: Bayron Carranza Date: Fri, 3 Mar 2023 11:30:17 -0600 Subject: [PATCH 30/36] change name of txt --- .../aws/route53/record-vpc-endpoint-sftp-transfer/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf index ef0cf0026..b73d2875d 100644 --- a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf +++ b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf @@ -10,7 +10,7 @@ resource "null_resource" "output-vpc-endpoint-id" { } data "template_file" "log_name" { - template = "${path.module}/output.log" + template = "${path.module}/vpc-endpoint-id.txt" } data "local_file" "get-vpc-endpoint-id-value" { From e0c1e7473cadb64d30f230182c0371523069ad30 Mon Sep 17 00:00:00 2001 From: Bayron Carranza Date: Fri, 3 Mar 2023 11:52:08 -0600 Subject: [PATCH 31/36] replace trim --- .../aws/route53/record-vpc-endpoint-sftp-transfer/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf index b73d2875d..b03570fff 100644 --- a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf +++ b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf @@ -21,7 +21,7 @@ data "local_file" "get-vpc-endpoint-id-value" { # Get the VPC Endpoint ID for the Transfer Service data "aws_vpc_endpoint" "this" { # Remove quotes - id = trim(data.local_file.get-vpc-endpoint-id-value.content, "\"") + id = trim(replace(data.local_file.get-vpc-endpoint-id-value.content, "\"", "")) vpc_id = var.vpc_id depends_on = [ From d54211eb609069e67d66b30d3be82e16258a738b Mon Sep 17 00:00:00 2001 From: Bayron Carranza Date: Fri, 3 Mar 2023 12:08:06 -0600 Subject: [PATCH 32/36] typo trim --- .../aws/route53/record-vpc-endpoint-sftp-transfer/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf index b03570fff..8616ced59 100644 --- a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf +++ b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf @@ -21,7 +21,7 @@ data "local_file" "get-vpc-endpoint-id-value" { # Get the VPC Endpoint ID for the Transfer Service data "aws_vpc_endpoint" "this" { # Remove quotes - id = trim(replace(data.local_file.get-vpc-endpoint-id-value.content, "\"", "")) + id = trim(replace(data.local_file.get-vpc-endpoint-id-value.content, "\""), "") vpc_id = var.vpc_id depends_on = [ From 602ea173a31b427999d3b603ea9c6112c555c2f2 Mon Sep 17 00:00:00 2001 From: Bayron Carranza Date: Fri, 3 Mar 2023 12:16:24 -0600 Subject: [PATCH 33/36] typo replace --- .../aws/route53/record-vpc-endpoint-sftp-transfer/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf index 8616ced59..fe7a5fff9 100644 --- a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf +++ b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf @@ -21,7 +21,7 @@ data "local_file" "get-vpc-endpoint-id-value" { # Get the VPC Endpoint ID for the Transfer Service data "aws_vpc_endpoint" "this" { # Remove quotes - id = trim(replace(data.local_file.get-vpc-endpoint-id-value.content, "\""), "") + id = trim(replace(data.local_file.get-vpc-endpoint-id-value.content, "\"", ""), "") vpc_id = var.vpc_id depends_on = [ From d301f733ccf2b1923f0dc9f7b0e70673c72e34d4 Mon Sep 17 00:00:00 2001 From: Bayron Carranza Date: Fri, 3 Mar 2023 12:46:36 -0600 Subject: [PATCH 34/36] remove new lines --- .../aws/route53/record-vpc-endpoint-sftp-transfer/main.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf index fe7a5fff9..10a7b2910 100644 --- a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf +++ b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer/main.tf @@ -20,8 +20,8 @@ data "local_file" "get-vpc-endpoint-id-value" { # Get the VPC Endpoint ID for the Transfer Service data "aws_vpc_endpoint" "this" { - # Remove quotes - id = trim(replace(data.local_file.get-vpc-endpoint-id-value.content, "\"", ""), "") + # Remove quotes and new lines + id = trim(replace(replace(data.local_file.get-vpc-endpoint-id-value.content, "\"", ""),"/\"|\r\n|\r|\n/",""), "") vpc_id = var.vpc_id depends_on = [ From 1bf54349bdc3edb2a5f1ad34705ad9a63eb51d08 Mon Sep 17 00:00:00 2001 From: Bayron Carranza Date: Mon, 6 Mar 2023 11:24:37 -0600 Subject: [PATCH 35/36] route 53 v2 --- .../README.md | 49 +++++++++++++++++++ .../main.tf | 35 +++++++++++++ .../outputs.tf | 24 +++++++++ .../variables.tf | 48 ++++++++++++++++++ 4 files changed, 156 insertions(+) create mode 100644 terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer-v2/README.md create mode 100644 terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer-v2/main.tf create mode 100644 terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer-v2/outputs.tf create mode 100644 terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer-v2/variables.tf diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer-v2/README.md b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer-v2/README.md new file mode 100644 index 000000000..8e1819904 --- /dev/null +++ b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer-v2/README.md @@ -0,0 +1,49 @@ +## Requirements + +No requirements. + +## Providers + +| Name | Version | +|------|---------| +| [aws](#provider\_aws) | n/a | +| [terraform](#provider\_terraform) | n/a | + +## Modules + +| Name | Source | Version | +|------|--------|---------| +| [record](#module\_record) | ../record/ | n/a | + +## Resources + +| Name | Type | +|------|------| +| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source | +| [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source | +| [aws_vpc_endpoint.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc_endpoint) | data source | +| [terraform_remote_state.this](https://registry.terraform.io/providers/hashicorp/terraform/latest/docs/data-sources/remote_state) | data source | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [evaluate\_target\_health](#input\_evaluate\_target\_health) | whether or not Route 53 should perform health checks on the target of an alias record before responding to DNS queries. | `bool` | `false` | no | +| [record\_name](#input\_record\_name) | The name for the Route 53 record. | `string` | n/a | yes | +| [route53\_zone\_id](#input\_route53\_zone\_id) | The ID of the Route 53 zone where the record will be created. | `string` | n/a | yes | +| [tf\_state\_bucket\_name](#input\_tf\_state\_bucket\_name) | The name of the S3 bucket where the Terraform state is stored aws\_transfer\_server | `string` | n/a | yes | +| [tf\_state\_path](#input\_tf\_state\_path) | The path within the S3 bucket where the Terraform state file is stored aws\_transfer\_server | `string` | n/a | yes | +| [tf\_state\_region](#input\_tf\_state\_region) | The name of the AWS region where the Terraform code is being executed aws\_transfer\_server | `string` | n/a | yes | +| [transfer\_server\_id](#input\_transfer\_server\_id) | The ID of the AWS Transfer Server | `string` | `""` | no | +| [type](#input\_type) | Also known as an Address record, is used to map a domain name to an IP address. | `string` | `"A"` | no | +| [vpc\_id](#input\_vpc\_id) | The VPC ID Where VPC enpoint is configured | `string` | `""` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| [fqdn](#output\_fqdn) | FQDN built using the zone domain and name. | +| [name](#output\_name) | The name for the Route 53 record. | +| [vpc\_endpoint\_dns\_name](#output\_vpc\_endpoint\_dns\_name) | Retrieve the DNS name associated with an AWS VPC Endpoint. | +| [vpc\_endpoint\_hosted\_zone\_id](#output\_vpc\_endpoint\_hosted\_zone\_id) | Retrieves the Zona ID name associated with the VPC Endpoint | +| [vpc\_endpoint\_id](#output\_vpc\_endpoint\_id) | ID of an AWS VPC Endpoint | diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer-v2/main.tf b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer-v2/main.tf new file mode 100644 index 000000000..e1eb8cad1 --- /dev/null +++ b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer-v2/main.tf @@ -0,0 +1,35 @@ + +data "aws_caller_identity" "current" {} +data "aws_region" "current" {} + +data "terraform_remote_state" "this" { + backend = "s3" + config = { + bucket = var.tf_state_bucket_name + key = var.tf_state_path + region = var.tf_state_region + } +} + +# Get the VPC Endpoint ID for the Transfer Service +data "aws_vpc_endpoint" "this" { + # Remove quotes and new lines + id = data.terraform_remote_state.this.aws_transfer_server.default.instances.0.attributes.endpoint_details.0.vpc_endpoint_id + vpc_id = var.vpc_id + + depends_on = [ + data.local_file.get-vpc-endpoint-id-value + ] +} + +module "record" { + source = "../record/" + route53_zone_id = var.route53_zone_id + record_name = var.record_name + vpc_endpoint_dns_name = data.aws_vpc_endpoint.this.dns_entry[0].dns_name + vpc_endpoint_zone_id = data.aws_vpc_endpoint.this.dns_entry[0].hosted_zone_id + + depends_on = [ + data.aws_vpc_endpoint.this + ] +} \ No newline at end of file diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer-v2/outputs.tf b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer-v2/outputs.tf new file mode 100644 index 000000000..3e930a9dd --- /dev/null +++ b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer-v2/outputs.tf @@ -0,0 +1,24 @@ +output "name" { + value = module.record.name + description = "The name for the Route 53 record." +} + +output "fqdn" { + value = module.record.fqdn + description = "FQDN built using the zone domain and name." +} + +output "vpc_endpoint_id" { + value = data.aws_vpc_endpoint.this.id + description = "ID of an AWS VPC Endpoint" +} + +output "vpc_endpoint_dns_name" { + value = data.aws_vpc_endpoint.this.dns_entry[0].dns_name + description = "Retrieve the DNS name associated with an AWS VPC Endpoint." +} + +output "vpc_endpoint_hosted_zone_id" { + value = data.aws_vpc_endpoint.this.dns_entry[0].hosted_zone_id + description = "Retrieves the Zona ID name associated with the VPC Endpoint" +} \ No newline at end of file diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer-v2/variables.tf b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer-v2/variables.tf new file mode 100644 index 000000000..50383643a --- /dev/null +++ b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer-v2/variables.tf @@ -0,0 +1,48 @@ +variable "route53_zone_id" { + description = "The ID of the Route 53 zone where the record will be created." + type = string +} + +variable "record_name" { + description = "The name for the Route 53 record." + type = string +} + +variable "type" { + type = string + default = "A" + description = "Also known as an Address record, is used to map a domain name to an IP address." +} + +variable "evaluate_target_health" { + type = bool + default = false + description = "whether or not Route 53 should perform health checks on the target of an alias record before responding to DNS queries." +} + +variable "transfer_server_id" { + type = string + default = "" + description = "The ID of the AWS Transfer Server" +} + +variable vpc_id { + type = string + default = "" + description = "The VPC ID Where VPC enpoint is configured" +} + +variable "tf_state_bucket_name" { + type = string + description = "The name of the S3 bucket where the Terraform state is stored aws_transfer_server" +} + +variable "tf_state_path" { + type = string + description = "The path within the S3 bucket where the Terraform state file is stored aws_transfer_server" +} + +variable "tf_state_region" { + type = string + description = "The name of the AWS region where the Terraform code is being executed aws_transfer_server" +} From a7e7c7e9b4978837831f9ad7eb4e336bad13c451 Mon Sep 17 00:00:00 2001 From: Bayron Carranza Date: Mon, 6 Mar 2023 12:23:43 -0600 Subject: [PATCH 36/36] remove second test to vpc endpoint by state --- .../README.md | 49 ------------------- .../main.tf | 35 ------------- .../outputs.tf | 24 --------- .../variables.tf | 48 ------------------ 4 files changed, 156 deletions(-) delete mode 100644 terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer-v2/README.md delete mode 100644 terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer-v2/main.tf delete mode 100644 terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer-v2/outputs.tf delete mode 100644 terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer-v2/variables.tf diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer-v2/README.md b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer-v2/README.md deleted file mode 100644 index 8e1819904..000000000 --- a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer-v2/README.md +++ /dev/null @@ -1,49 +0,0 @@ -## Requirements - -No requirements. - -## Providers - -| Name | Version | -|------|---------| -| [aws](#provider\_aws) | n/a | -| [terraform](#provider\_terraform) | n/a | - -## Modules - -| Name | Source | Version | -|------|--------|---------| -| [record](#module\_record) | ../record/ | n/a | - -## Resources - -| Name | Type | -|------|------| -| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source | -| [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source | -| [aws_vpc_endpoint.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc_endpoint) | data source | -| [terraform_remote_state.this](https://registry.terraform.io/providers/hashicorp/terraform/latest/docs/data-sources/remote_state) | data source | - -## Inputs - -| Name | Description | Type | Default | Required | -|------|-------------|------|---------|:--------:| -| [evaluate\_target\_health](#input\_evaluate\_target\_health) | whether or not Route 53 should perform health checks on the target of an alias record before responding to DNS queries. | `bool` | `false` | no | -| [record\_name](#input\_record\_name) | The name for the Route 53 record. | `string` | n/a | yes | -| [route53\_zone\_id](#input\_route53\_zone\_id) | The ID of the Route 53 zone where the record will be created. | `string` | n/a | yes | -| [tf\_state\_bucket\_name](#input\_tf\_state\_bucket\_name) | The name of the S3 bucket where the Terraform state is stored aws\_transfer\_server | `string` | n/a | yes | -| [tf\_state\_path](#input\_tf\_state\_path) | The path within the S3 bucket where the Terraform state file is stored aws\_transfer\_server | `string` | n/a | yes | -| [tf\_state\_region](#input\_tf\_state\_region) | The name of the AWS region where the Terraform code is being executed aws\_transfer\_server | `string` | n/a | yes | -| [transfer\_server\_id](#input\_transfer\_server\_id) | The ID of the AWS Transfer Server | `string` | `""` | no | -| [type](#input\_type) | Also known as an Address record, is used to map a domain name to an IP address. | `string` | `"A"` | no | -| [vpc\_id](#input\_vpc\_id) | The VPC ID Where VPC enpoint is configured | `string` | `""` | no | - -## Outputs - -| Name | Description | -|------|-------------| -| [fqdn](#output\_fqdn) | FQDN built using the zone domain and name. | -| [name](#output\_name) | The name for the Route 53 record. | -| [vpc\_endpoint\_dns\_name](#output\_vpc\_endpoint\_dns\_name) | Retrieve the DNS name associated with an AWS VPC Endpoint. | -| [vpc\_endpoint\_hosted\_zone\_id](#output\_vpc\_endpoint\_hosted\_zone\_id) | Retrieves the Zona ID name associated with the VPC Endpoint | -| [vpc\_endpoint\_id](#output\_vpc\_endpoint\_id) | ID of an AWS VPC Endpoint | diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer-v2/main.tf b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer-v2/main.tf deleted file mode 100644 index e1eb8cad1..000000000 --- a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer-v2/main.tf +++ /dev/null @@ -1,35 +0,0 @@ - -data "aws_caller_identity" "current" {} -data "aws_region" "current" {} - -data "terraform_remote_state" "this" { - backend = "s3" - config = { - bucket = var.tf_state_bucket_name - key = var.tf_state_path - region = var.tf_state_region - } -} - -# Get the VPC Endpoint ID for the Transfer Service -data "aws_vpc_endpoint" "this" { - # Remove quotes and new lines - id = data.terraform_remote_state.this.aws_transfer_server.default.instances.0.attributes.endpoint_details.0.vpc_endpoint_id - vpc_id = var.vpc_id - - depends_on = [ - data.local_file.get-vpc-endpoint-id-value - ] -} - -module "record" { - source = "../record/" - route53_zone_id = var.route53_zone_id - record_name = var.record_name - vpc_endpoint_dns_name = data.aws_vpc_endpoint.this.dns_entry[0].dns_name - vpc_endpoint_zone_id = data.aws_vpc_endpoint.this.dns_entry[0].hosted_zone_id - - depends_on = [ - data.aws_vpc_endpoint.this - ] -} \ No newline at end of file diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer-v2/outputs.tf b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer-v2/outputs.tf deleted file mode 100644 index 3e930a9dd..000000000 --- a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer-v2/outputs.tf +++ /dev/null @@ -1,24 +0,0 @@ -output "name" { - value = module.record.name - description = "The name for the Route 53 record." -} - -output "fqdn" { - value = module.record.fqdn - description = "FQDN built using the zone domain and name." -} - -output "vpc_endpoint_id" { - value = data.aws_vpc_endpoint.this.id - description = "ID of an AWS VPC Endpoint" -} - -output "vpc_endpoint_dns_name" { - value = data.aws_vpc_endpoint.this.dns_entry[0].dns_name - description = "Retrieve the DNS name associated with an AWS VPC Endpoint." -} - -output "vpc_endpoint_hosted_zone_id" { - value = data.aws_vpc_endpoint.this.dns_entry[0].hosted_zone_id - description = "Retrieves the Zona ID name associated with the VPC Endpoint" -} \ No newline at end of file diff --git a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer-v2/variables.tf b/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer-v2/variables.tf deleted file mode 100644 index 50383643a..000000000 --- a/terraform-modules/aws/route53/record-vpc-endpoint-sftp-transfer-v2/variables.tf +++ /dev/null @@ -1,48 +0,0 @@ -variable "route53_zone_id" { - description = "The ID of the Route 53 zone where the record will be created." - type = string -} - -variable "record_name" { - description = "The name for the Route 53 record." - type = string -} - -variable "type" { - type = string - default = "A" - description = "Also known as an Address record, is used to map a domain name to an IP address." -} - -variable "evaluate_target_health" { - type = bool - default = false - description = "whether or not Route 53 should perform health checks on the target of an alias record before responding to DNS queries." -} - -variable "transfer_server_id" { - type = string - default = "" - description = "The ID of the AWS Transfer Server" -} - -variable vpc_id { - type = string - default = "" - description = "The VPC ID Where VPC enpoint is configured" -} - -variable "tf_state_bucket_name" { - type = string - description = "The name of the S3 bucket where the Terraform state is stored aws_transfer_server" -} - -variable "tf_state_path" { - type = string - description = "The path within the S3 bucket where the Terraform state file is stored aws_transfer_server" -} - -variable "tf_state_region" { - type = string - description = "The name of the AWS region where the Terraform code is being executed aws_transfer_server" -}