generated from ministryofjustice/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8164 from ministryofjustice/feat/ap-ingestion-dat…
…async-nlb 🥡 DataSync continued
- Loading branch information
Showing
9 changed files
with
200 additions
and
21 deletions.
There are no files selected for viewing
This file contains 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
20 changes: 14 additions & 6 deletions
20
terraform/environments/analytical-platform-ingestion/datasync-agents.tf
This file contains 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 |
---|---|---|
@@ -1,8 +1,16 @@ | ||
# resource "aws_datasync_agent" "main" { | ||
# name = "${local.application_name}-${local.environment}-datasync" | ||
# ip_address = module.datasync_instance.private_ip | ||
resource "aws_datasync_agent" "main" { | ||
name = "${local.application_name}-${local.environment}-datasync" | ||
ip_address = data.dns_a_record_set.datasync_activation_nlb.addrs[0] | ||
|
||
# tags = local.tags | ||
subnet_arns = [module.connected_vpc.private_subnet_arns[0]] | ||
vpc_endpoint_id = module.connected_vpc_endpoints.endpoints["datasync"].id | ||
security_group_arns = [module.datasync_task_eni_security_group.security_group_arn] | ||
private_link_endpoint = data.aws_network_interface.datasync_vpc_endpoint.private_ip | ||
|
||
# depends_on = [module.datasync_instance] | ||
# } | ||
tags = local.tags | ||
|
||
depends_on = [ | ||
module.datasync_instance, | ||
module.datasync_activation_nlb_security_group | ||
] | ||
} |
This file contains 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 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
37 changes: 37 additions & 0 deletions
37
terraform/environments/analytical-platform-ingestion/network-load-balancers.tf
This file contains 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,37 @@ | ||
module "datasync_activation_nlb" { | ||
#checkov:skip=CKV_TF_1:Module registry does not support commit hashes for versions | ||
|
||
source = "terraform-aws-modules/alb/aws" | ||
version = "9.11.0" | ||
|
||
name = "datasync-activation" | ||
|
||
load_balancer_type = "network" | ||
vpc_id = module.connected_vpc.vpc_id | ||
subnets = [module.connected_vpc.public_subnets[0]] | ||
create_security_group = false | ||
security_groups = [module.datasync_activation_nlb_security_group.security_group_id] | ||
|
||
target_groups = { | ||
datasync = { | ||
name_prefix = "ds-" | ||
protocol = "TCP" | ||
port = 80 | ||
target_type = "ip" | ||
target_id = local.environment_configuration.datasync_instance_private_ip | ||
deregistration_delay = 10 | ||
} | ||
} | ||
|
||
listeners = { | ||
datasync = { | ||
port = 80 | ||
protocol = "TCP" | ||
forward = { | ||
target_group_key = "datasync" | ||
} | ||
} | ||
} | ||
|
||
tags = local.tags | ||
} |
This file contains 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
7 changes: 7 additions & 0 deletions
7
terraform/environments/analytical-platform-ingestion/scripts/get-ip-address.sh
This file contains 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,7 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Get IP address via Cloudflare | ||
ip="$(curl --silent https://cloudflare.com/cdn-cgi/trace | awk -F= '/ip=/{print $2}')" | ||
|
||
# Return it as a JSON object | ||
echo "{\"ip\": \"${ip}\"}" |
This file contains 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 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