Skip to content

Commit

Permalink
CC-2437: Split Validation based on provider
Browse files Browse the repository at this point in the history
  • Loading branch information
SahidKhan89 committed Apr 2, 2024
1 parent c8e0d09 commit 6b95bfd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
19 changes: 17 additions & 2 deletions terraform/environments/ccms-ebs/ccms-certificates.tf
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ resource "aws_route53_record" "external_validation_core_vpc" {
# zone_id = local.cert_zone_id
# }

resource "aws_acm_certificate_validation" "external" {
count = local.is-production ? 1 : 1
resource "aws_acm_certificate_validation" "external_nonprod" {
count = local.is-production ? 0 : 1

depends_on = [
aws_route53_record.external_validation_core_network,
Expand All @@ -138,3 +138,18 @@ resource "aws_acm_certificate_validation" "external" {
create = "10m"
}
}

resource "aws_acm_certificate_validation" "external" {
count = local.is-production ? 1 : 0

depends_on = [
aws_route53_record.external_validation_core_network
]

certificate_arn = local.cert_arn
validation_record_fqdns = [for record in aws_route53_record.external_validation_core_network : record.fqdn]

timeouts {
create = "10m"
}
}
6 changes: 1 addition & 5 deletions terraform/environments/ccms-ebs/member-locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@ locals {
data.aws_subnet.public_subnets_c.id
]

cert_opts = local.environment == "production" ? [
{
domain_name : "ccms-ebs.service.justice.gov.uk",
}
] : tolist(aws_acm_certificate.external[0].domain_validation_options)
cert_opts = local.environment == "production" ? aws_acm_certificate.external-service[0].domain_validation_options : aws_acm_certificate.external[0].domain_validation_options
cert_arn = local.environment == "production" ? aws_acm_certificate.external-service[0].arn : aws_acm_certificate.external[0].arn
cert_zone_id = local.environment == "production" ? data.aws_route53_zone.application-zone.zone_id : data.aws_route53_zone.network-services.zone_id
}

0 comments on commit 6b95bfd

Please sign in to comment.