From 56c03109dd377a82050e35fbeed919a0c335d764 Mon Sep 17 00:00:00 2001 From: badra001 Date: Tue, 18 Jan 2022 11:41:34 -0500 Subject: [PATCH] update docs, add example endpoint --- examples/vpc-interface-endpoint/datasync.tf | 32 +++++++++++++++++++++ vpc-interface-endpoint/README.md | 11 +++++++ vpc-interface-endpoint/main.tf | 12 ++++++++ 3 files changed, 55 insertions(+) create mode 100644 examples/vpc-interface-endpoint/datasync.tf diff --git a/examples/vpc-interface-endpoint/datasync.tf b/examples/vpc-interface-endpoint/datasync.tf new file mode 100644 index 0000000..b600223 --- /dev/null +++ b/examples/vpc-interface-endpoint/datasync.tf @@ -0,0 +1,32 @@ +module "vpce_datasync" { + source = "git@github.e.it.census.gov:terraform-modules/aws-vpc-setup.git//vpc-interface-endpoint" + + service = "datasync" + private_dns_enabled = false + subnet_ids = tolist(data.aws_subnet_ids.subnets.ids) + + security_group_ids = [module.sg_datasync.this_security_group_id] + + vpc_id = local.vpc_id + vpc_full_name = var.vpc_full_name + vpc_environment = var.vpc_environment + + tags = local.common_tags +} + + +module "agent_host" { + source = "git@github.e.it.census.gov:terraform-modules/dns-lookup.git" + + hosts = [local.agent_hostname] + use_cidr_format = false +} + +resource "aws_datasync_agent" "agent" { + name = "enterprise1" + ip_address = element(module.agent_host.addresses_ipv4, 0) + security_group_arns = [module.sg_datasync.this_security_group_arn] + subnet_arns = [for k, v in data.aws_subnet.datasync_subnets : v.arn if k == local.datasync_agent_subnet_id] + vpc_endpoint_id = module.vpce_datasync.vpce_service_info.id + private_link_endpoint = module.vpce_datasync.vpce_service_info.subnet_interface_ip_map[local.datasync_agent_subnet_id] +} diff --git a/vpc-interface-endpoint/README.md b/vpc-interface-endpoint/README.md index 987c8f6..7a4db4e 100644 --- a/vpc-interface-endpoint/README.md +++ b/vpc-interface-endpoint/README.md @@ -26,6 +26,17 @@ module "vpce_secretsmanager" { tags = {} } ``` +# Outputs +This outputs an object with the following elements: + +* name: name of the VPC endpoint +* service\_name: name of the VPC endpoint service +* id: VPC endpoint ID +* dns\_entry: DNS name for the VPC endpoint +* subnet\_ids: list of subnet IDs on which the VPC endpoint resides +* network\_interface\_ids: List of network interface IDs (ENIs), one per subnet +* subnet\_interface\_id\_map: map of subnet id to network interface ID +* subnet\_interface\_ip\_map: map of subnet id to network interface IPv4 address ## Requirements diff --git a/vpc-interface-endpoint/main.tf b/vpc-interface-endpoint/main.tf index fa2f272..acde25a 100644 --- a/vpc-interface-endpoint/main.tf +++ b/vpc-interface-endpoint/main.tf @@ -27,6 +27,18 @@ * tags = {} * } * ``` +* # Outputs +* This outputs an object with the following elements: +* +* * name: name of the VPC endpoint +* * service_name: name of the VPC endpoint service +* * id: VPC endpoint ID +* * dns_entry: DNS name for the VPC endpoint +* * subnet_ids: list of subnet IDs on which the VPC endpoint resides +* * network_interface_ids: List of network interface IDs (ENIs), one per subnet +* * subnet_interface_id_map: map of subnet id to network interface ID +* * subnet_interface_ip_map: map of subnet id to network interface IPv4 address +* */ locals {