Skip to content

Comments

[NDR-213] Add mTLS api gateway#401

Merged
megan-bower4 merged 15 commits intomainfrom
NDR-213
Sep 12, 2025
Merged

[NDR-213] Add mTLS api gateway#401
megan-bower4 merged 15 commits intomainfrom
NDR-213

Conversation

@megan-bower4
Copy link
Contributor

No description provided.

@chrisbloe chrisbloe changed the title NDR-213 Add mTLS api gateway [NDR-213] Add mTLS api gateway Aug 28, 2025
@megan-bower4 megan-bower4 marked this pull request as ready for review September 2, 2025 11:44
bucket = local.truststore_bucket_id
key = var.ca_pem_filename
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This truststore object needs to be manually created and in place before deploying

@github-actions
Copy link

Report for environment: ndr-dev

Terraform Initialization ⚙️success

Initialization Output

Initializing the backend...

Successfully configured the backend "s3"! Terraform will automatically
use this backend unless the backend configuration changes.
Initializing modules...
- access-audit-alarm in modules/lambda_alarms
- access-audit-alarm-topic in modules/sns
- access-audit-gateway in modules/gateway
- access-audit-lambda in modules/lambda
- access_audit_dynamodb_table in modules/dynamo_db
- alarm_state_history_table in modules/dynamo_db
- api_endpoint_url_ssm_parameter in modules/ssm_parameter
- auth_session_dynamodb_table in modules/dynamo_db
- auth_state_dynamodb_table in modules/dynamo_db
- authoriser-alarm in modules/lambda_alarms
- authoriser-alarm-topic in modules/sns
- authoriser-lambda in modules/lambda
- back-channel-logout-gateway in modules/gateway
- back_channel_logout_alarm in modules/lambda_alarms
- back_channel_logout_alarm_topic in modules/sns
- back_channel_logout_lambda in modules/lambda
- bulk-upload-alarm in modules/lambda_alarms
- bulk-upload-alarm-topic in modules/sns
- bulk-upload-lambda in modules/lambda
- bulk-upload-metadata-alarm in modules/lambda_alarms
- bulk-upload-metadata-alarm-topic in modules/sns
- bulk-upload-metadata-lambda in modules/lambda
- bulk-upload-report-alarm in modules/lambda_alarms
- bulk-upload-report-alarm-topic in modules/sns
- bulk-upload-report-lambda in modules/lambda
- bulk_upload_metadata_preprocessor_lambda in modules/lambda
- bulk_upload_report_dynamodb_table in modules/dynamo_db
Downloading registry.terraform.io/cloudstoragesec/cloud-storage-security/aws 1.8.8+css9.02.000 for cloud_storage_security...
- cloud_storage_security in .terraform/modules/cloud_storage_security
- cloudfront-distribution-lg in modules/cloudfront
- cloudfront_edge_dynamodb_table in modules/dynamo_db
- cloudfront_firewall_waf_v2 in modules/firewall_waf_v2
- create-doc-ref-lambda in modules/lambda
- create-token-gateway in modules/gateway
- create-token-lambda in modules/lambda
- create_doc_alarm in modules/lambda_alarms
- create_doc_alarm_topic in modules/sns
- create_document_reference_gateway in modules/gateway
- create_token-alarm in modules/lambda_alarms
- create_token-alarm_topic in modules/sns
- data-collection-alarm in modules/lambda_alarms
- data-collection-alarm-topic in modules/sns
- data-collection-lambda in modules/lambda
- delete-doc-ref-gateway in modules/gateway
- delete-doc-ref-lambda in modules/lambda
- delete-document-object-alarm in modules/lambda_alarms
- delete-document-object-alarm-topic in modules/sns
- delete-document-object-lambda in modules/lambda
- delete_doc_alarm in modules/lambda_alarms
- delete_doc_alarm_topic in modules/sns
- document-manifest-job-gateway in modules/gateway
- document-manifest-job-lambda in modules/lambda
- document-status-check-alarm in modules/lambda_alarms
- document-status-check-alarm-topic in modules/sns
- document-status-check-gateway in modules/gateway
- document-status-check-lambda in modules/lambda
- document_manifest_alarm in modules/lambda_alarms
- document_manifest_alarm_topic in modules/sns
- document_reference_dynamodb_table in modules/dynamo_db
- document_upload_check_lambda in modules/lambda
- edge-presign-lambda in modules/lambda_edge
- edge_presign_alarm in modules/lambda_alarms
- edge_presign_alarm_topic in modules/sns
- feature-flags-gateway in modules/gateway
- feature-flags-lambda in modules/lambda
- feature_flags_alarm in modules/lambda_alarms
- feature_flags_alarm_topic in modules/sns
- fhir_document_reference_gateway in modules/gateway
- fhir_document_reference_mtls_gateway in modules/gateway
- firewall_waf_v2 in modules/firewall_waf_v2
- firewall_waf_v2_api in modules/firewall_waf_v2
- generate-document-manifest-alarm in modules/lambda_alarms
- generate-document-manifest-alarm-topic in modules/sns
- generate-document-manifest-lambda in modules/lambda
- generate-lloyd-george-stitch-alarm in modules/lambda_alarms
- generate-lloyd-george-stitch-alarm-topic in modules/sns
- generate-lloyd-george-stitch-lambda in modules/lambda
- get-doc-fhir-lambda in modules/lambda
- get-report-by-ods-alarm in modules/lambda_alarms
- get-report-by-ods-alarm-topic in modules/sns
- get-report-by-ods-gateway in modules/gateway
- get-report-by-ods-lambda in modules/lambda
- global_sqs_age_alarm_topic in modules/sns
- im-alerting-lambda in modules/lambda
- lambda-layer-alerting in modules/lambda_layers
- lambda-layer-core in modules/lambda_layers
- lambda-layer-data in modules/lambda_layers
- lambda-layer-reports in modules/lambda_layers
- lloyd-george-stitch-gateway in modules/gateway
- lloyd-george-stitch-lambda in modules/lambda
- lloyd-george-stitch_alarm in modules/lambda_alarms
- lloyd-george-stitch_topic in modules/sns
- lloyd_george_reference_dynamodb_table in modules/dynamo_db
- login_redirect-alarm_topic in modules/sns
- login_redirect_alarm in modules/lambda_alarms
- login_redirect_lambda in modules/lambda
- logout-gateway in modules/gateway
- logout_alarm in modules/lambda_alarms
- logout_alarm_topic in modules/sns
- logout_lambda in modules/lambda
- manage-nrl-pointer-alarm in modules/lambda_alarms
- manage-nrl-pointer-alarm-topic in modules/sns
- manage-nrl-pointer-lambda in modules/lambda
- mns-dlq-alarm-topic in modules/sns
- mns-notification-alarm in modules/lambda_alarms
- mns-notification-alarm-topic in modules/sns
- mns-notification-lambda in modules/lambda
- mns_encryption_key in modules/kms
- mtls_api_endpoint_url_ssm_parameter in modules/ssm_parameter
- ndr-app-config in modules/app_config
- ndr-bulk-staging-store in modules/s3
- ndr-docker-ecr-data-collection in modules/ecr
- ndr-docker-ecr-ui in modules/ecr
- ndr-document-store in modules/s3
- ndr-ecs-container-port-ssm-parameter in modules/ssm_parameter
- ndr-ecs-fargate-app in modules/ecs
- ndr-ecs-fargate-data-collection in modules/ecs
- ndr-feedback-mailbox in modules/ses
- ndr-lloyd-george-store in modules/s3
- ndr-truststore in modules/s3
- ndr-vpc-ui in modules/vpc
- ndr-zip-request-store in modules/s3
- nhs-oauth-token-generator-alarm in modules/lambda_alarms
- nhs-oauth-token-generator-alarm-topic in modules/sns
- nhs-oauth-token-generator-lambda in modules/lambda
- nrl-dlq-alarm-topic in modules/sns
- pdf-stitching-alarm-topic in modules/sns
- pdf-stitching-lambda in modules/lambda
- pdf-stitching-lambda-alarms in modules/lambda_alarms
- pdm-document-store in modules/s3
- pdm_dynamodb_table in modules/dynamo_db
- post-document-references-fhir-lambda in modules/lambda
- route53_fargate_ui in modules/route53
- search-document-references-fhir-lambda in modules/lambda
- search-document-references-gateway in modules/gateway
- search-document-references-lambda in modules/lambda
- search-patient-details-gateway in modules/gateway
- search-patient-details-lambda in modules/lambda
- search_doc_alarm in modules/lambda_alarms
- search_doc_alarm_topic in modules/sns
- search_patient_alarm in modules/lambda_alarms
- search_patient_alarm_topic in modules/sns
- send-feedback-alarm in modules/lambda_alarms
- send-feedback-alarm-topic in modules/sns
- send-feedback-gateway in modules/gateway
- send-feedback-lambda in modules/lambda
- sns_encryption_key in modules/kms
- sqs-lg-bulk-upload-invalid-queue in modules/sqs
- sqs-lg-bulk-upload-metadata-queue in modules/sqs
- sqs-mns-notification-queue in modules/sqs
- sqs-nrl-queue in modules/sqs
- sqs-stitching-queue in modules/sqs
- sqs_alarm_lambda_topic in modules/sns
- statistical-report-alarm in modules/lambda_alarms
- statistical-report-alarm-topic in modules/sns
- statistical-report-lambda in modules/lambda
- statistical-reports-store in modules/s3
- statistics_dynamodb_table in modules/dynamo_db
- stitch_metadata_reference_dynamodb_table in modules/dynamo_db
- stitching-dlq-alarm-topic in modules/sns
- toggle-bulk-upload-lambda in modules/lambda
- unstitched_lloyd_george_reference_dynamodb_table in modules/dynamo_db
- update-upload-state-gateway in modules/gateway
- update-upload-state-lambda in modules/lambda
- update_upload_state_alarm in modules/lambda_alarms
- update_upload_state_alarm_topic in modules/sns
- virus_scan_result_alarm in modules/lambda_alarms
- virus_scan_result_alarm_topic in modules/sns
- virus_scan_result_gateway in modules/gateway
- virus_scan_result_lambda in modules/lambda
- zip_store_reference_dynamodb_table in modules/dynamo_db
Initializing provider plugins...
- terraform.io/builtin/terraform is built in to Terraform
- Finding latest version of hashicorp/random...
- Finding latest version of hashicorp/time...
- Finding hashicorp/aws versions matching ">= 4.0.0, ~> 5.0"...
- Finding hashicorp/awscc versions matching ">= 0.72.1, ~> 1.0"...
- Finding latest version of hashicorp/archive...
- Installing hashicorp/time v0.13.1...
- Installed hashicorp/time v0.13.1 (signed by HashiCorp)
- Installing hashicorp/aws v5.100.0...
- Installed hashicorp/aws v5.100.0 (signed by HashiCorp)
- Installing hashicorp/awscc v1.56.0...
- Installed hashicorp/awscc v1.56.0 (signed by HashiCorp)
- Installing hashicorp/archive v2.7.1...
- Installed hashicorp/archive v2.7.1 (signed by HashiCorp)
- Installing hashicorp/random v3.7.2...
- Installed hashicorp/random v3.7.2 (signed by HashiCorp)
Terraform has created a lock file .terraform.lock.hcl to record the provider
selections it made above. Include this file in your version control repository
so that Terraform can guarantee to make the same selections by default when
you run "terraform init" in the future.

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.

Terraform Validation 🤖success

Validation Output

Success! The configuration is valid.


Terraform Plan 📖success

Show Plan (27 to add, 4 to change, 1 to destroy)


Note: Objects have changed outside of Terraform

Terraform detected the following changes made outside of Terraform since the
last "terraform apply" which may have affected this plan:

  # module.edge-presign-lambda.aws_lambda_function.lambda has changed
  ~ resource "aws_lambda_function" "lambda" {
        id                             = "ndr-dev_EdgePresignLambda"
      ~ qualified_arn                  = "arn:aws:lambda:us-east-1:[REDACTED_AWS_ACCOUNT_ID]:function:ndr-dev_EdgePresignLambda:342" -> "arn:aws:lambda:us-east-1:[REDACTED_AWS_ACCOUNT_ID]:function:ndr-dev_EdgePresignLambda:343"
        tags                           = {}
        # (28 unchanged attributes hidden)

        # (3 unchanged blocks hidden)
    }


Unless you have made equivalent changes to your configuration, or ignored the
relevant attributes using ignore_changes, the following plan may include
actions to undo or respond to these changes.

─────────────────────────────────────────────────────────────────────────────

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create
  ~ update in-place
+/- create replacement and then destroy

Terraform will perform the following actions:

  # aws_api_gateway_base_path_mapping.api_mapping_mtls will be created
  + resource "aws_api_gateway_base_path_mapping" "api_mapping_mtls" {
      + api_id      = (known after apply)
      + domain_name = "mtls.ndr-dev.access-request-fulfilment.patient-deductions.nhs.uk"
      + id          = (known after apply)
      + stage_name  = "dev"
    }

  # aws_api_gateway_deployment.ndr_api_deploy must be replaced
+/- resource "aws_api_gateway_deployment" "ndr_api_deploy" {
      ~ created_date  = "2025-09-12T09:20:47Z" -> (known after apply)
      ~ execution_arn = "arn:aws:execute-api:eu-west-2:[REDACTED_AWS_ACCOUNT_ID]:ccy0v3rve9/" -> (known after apply)
      ~ id            = "8dd31m" -> (known after apply)
      ~ invoke_url    = "[REDACTED_API_GATEWAY_URL]" -> (known after apply)
      ~ variables     = {
          - "deployed_at" = "2025-09-12T09:20:47Z"
        } -> (known after apply) # forces replacement
        # (2 unchanged attributes hidden)
    }

  # aws_api_gateway_deployment.ndr_api_deploy_mtls will be created
  + resource "aws_api_gateway_deployment" "ndr_api_deploy_mtls" {
      + created_date  = (known after apply)
      + execution_arn = (known after apply)
      + id            = (known after apply)
      + invoke_url    = (known after apply)
      + rest_api_id   = (known after apply)
      + variables     = (known after apply)
    }

  # aws_api_gateway_domain_name.custom_api_domain_mtls will be created
  + resource "aws_api_gateway_domain_name" "custom_api_domain_mtls" {
      + arn                                    = (known after apply)
      + certificate_upload_date                = (known after apply)
      + cloudfront_domain_name                 = (known after apply)
      + cloudfront_zone_id                     = (known after apply)
      + domain_name                            = "mtls.ndr-dev.access-request-fulfilment.patient-deductions.nhs.uk"
      + domain_name_id                         = (known after apply)
      + id                                     = (known after apply)
      + ownership_verification_certificate_arn = (known after apply)
      + regional_certificate_arn               = "arn:aws:acm:eu-west-2:[REDACTED_AWS_ACCOUNT_ID]:certificate/01445932-05bf-4711-a214-e7336b18b213"
      + regional_domain_name                   = (known after apply)
      + regional_zone_id                       = (known after apply)
      + security_policy                        = "TLS_1_2"
      + tags_all                               = {
          + "Environment" = "dev"
          + "Owner"       = "nhse/ndr-team"
          + "Workspace"   = "ndr-dev"
        }

      + endpoint_configuration {
          + ip_address_type = (known after apply)
          + types           = [
              + "REGIONAL",
            ]
        }

      + mutual_tls_authentication {
          + truststore_uri     = "s3://ndr-dev-ndr-truststore/ndr-truststore.pem"
          + truststore_version = "oxWRuOO0gsF2fd8edhOywQ9oxW.9DzjF"
        }
    }

  # aws_api_gateway_gateway_response.bad_gateway_response_mtls will be created
  + resource "aws_api_gateway_gateway_response" "bad_gateway_response_mtls" {
      + id                  = (known after apply)
      + response_parameters = {
          + "gatewayresponse.header.Access-Control-Allow-Credentials" = "'true'"
          + "gatewayresponse.header.Access-Control-Allow-Headers"     = "'Content-Type,X-Amz-Date,Authorization,X-Auth,X-Api-Key,X-Amz-Security-Token,X-Auth-Cookie,Accept'"
          + "gatewayresponse.header.Access-Control-Allow-Methods"     = "'*'"
          + "gatewayresponse.header.Access-Control-Allow-Origin"      = "'https://ndr-dev.access-request-fulfilment.patient-deductions.nhs.uk'"
        }
      + response_templates  = {
          + "application/json" = "{"message":$context.error.messageString}"
        }
      + response_type       = "DEFAULT_5XX"
      + rest_api_id         = (known after apply)
    }

  # aws_api_gateway_gateway_response.unauthorised_response_mtls will be created
  + resource "aws_api_gateway_gateway_response" "unauthorised_response_mtls" {
      + id                  = (known after apply)
      + response_parameters = {
          + "gatewayresponse.header.Access-Control-Allow-Credentials" = "'true'"
          + "gatewayresponse.header.Access-Control-Allow-Headers"     = "'Content-Type,X-Amz-Date,Authorization,X-Auth,X-Api-Key,X-Amz-Security-Token,X-Auth-Cookie,Accept'"
          + "gatewayresponse.header.Access-Control-Allow-Methods"     = "'*'"
          + "gatewayresponse.header.Access-Control-Allow-Origin"      = "'https://ndr-dev.access-request-fulfilment.patient-deductions.nhs.uk'"
        }
      + response_templates  = {
          + "application/json" = "{"message":$context.error.messageString}"
        }
      + response_type       = "DEFAULT_4XX"
      + rest_api_id         = (known after apply)
    }

  # aws_api_gateway_integration.get_doc_fhir_lambda_integration will be created
  + resource "aws_api_gateway_integration" "get_doc_fhir_lambda_integration" {
      + cache_namespace         = (known after apply)
      + connection_type         = "INTERNET"
      + http_method             = "GET"
      + id                      = (known after apply)
      + integration_http_method = "POST"
      + passthrough_behavior    = (known after apply)
      + resource_id             = (known after apply)
      + rest_api_id             = (known after apply)
      + timeout_milliseconds    = 29000
      + type                    = "AWS_PROXY"
      + uri                     = "arn:aws:apigateway:eu-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:eu-west-2:[REDACTED_AWS_ACCOUNT_ID]:function:ndr-dev_GetDocumentReference/invocations"
    }

  # aws_api_gateway_integration.post_doc_fhir_lambda_integration will be created
  + resource "aws_api_gateway_integration" "post_doc_fhir_lambda_integration" {
      + cache_namespace         = (known after apply)
      + connection_type         = "INTERNET"
      + http_method             = "POST"
      + id                      = (known after apply)
      + integration_http_method = "POST"
      + passthrough_behavior    = (known after apply)
      + resource_id             = (known after apply)
      + rest_api_id             = (known after apply)
      + timeout_milliseconds    = 29000
      + type                    = "AWS_PROXY"
      + uri                     = "arn:aws:apigateway:eu-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:eu-west-2:[REDACTED_AWS_ACCOUNT_ID]:function:ndr-dev_PostDocumentReferencesFHIR/invocations"
    }

  # aws_api_gateway_integration.search_doc_fhir_lambda_integration will be created
  + resource "aws_api_gateway_integration" "search_doc_fhir_lambda_integration" {
      + cache_namespace         = (known after apply)
      + connection_type         = "INTERNET"
      + http_method             = "GET"
      + id                      = (known after apply)
      + integration_http_method = "POST"
      + passthrough_behavior    = (known after apply)
      + resource_id             = (known after apply)
      + rest_api_id             = (known after apply)
      + timeout_milliseconds    = 29000
      + type                    = "AWS_PROXY"
      + uri                     = "arn:aws:apigateway:eu-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:eu-west-2:[REDACTED_AWS_ACCOUNT_ID]:function:ndr-dev_SearchDocumentReferencesFHIR/invocations"
    }

  # aws_api_gateway_method.get_document_reference_mtls will be created
  + resource "aws_api_gateway_method" "get_document_reference_mtls" {
      + api_key_required   = true
      + authorization      = "NONE"
      + http_method        = "GET"
      + id                 = (known after apply)
      + request_parameters = {
          + "method.request.path.id" = true
        }
      + resource_id        = (known after apply)
      + rest_api_id        = (known after apply)
    }

  # aws_api_gateway_method_settings.mtls_api_gateway_stage will be created
  + resource "aws_api_gateway_method_settings" "mtls_api_gateway_stage" {
      + id          = (known after apply)
      + method_path = "*/*"
      + rest_api_id = (known after apply)
      + stage_name  = "dev"

      + settings {
          + cache_data_encrypted                       = (known after apply)
          + cache_ttl_in_seconds                       = (known after apply)
          + caching_enabled                            = (known after apply)
          + data_trace_enabled                         = true
          + logging_level                              = "INFO"
          + metrics_enabled                            = true
          + require_authorization_for_cache_control    = (known after apply)
          + throttling_burst_limit                     = -1
          + throttling_rate_limit                      = -1
          + unauthorized_cache_control_header_strategy = (known after apply)
        }
    }

  # aws_api_gateway_resource.get_document_reference_mtls will be created
  + resource "aws_api_gateway_resource" "get_document_reference_mtls" {
      + id          = (known after apply)
      + parent_id   = (known after apply)
      + path        = (known after apply)
      + path_part   = "{id}"
      + rest_api_id = (known after apply)
    }

  # aws_api_gateway_rest_api.ndr_doc_store_api_mtls will be created
  + resource "aws_api_gateway_rest_api" "ndr_doc_store_api_mtls" {
      + api_key_source               = (known after apply)
      + arn                          = (known after apply)
      + binary_media_types           = (known after apply)
      + created_date                 = (known after apply)
      + description                  = "Document store API with mTLS enabled"
      + disable_execute_api_endpoint = true
      + execution_arn                = (known after apply)
      + id                           = (known after apply)
      + minimum_compression_size     = (known after apply)
      + name                         = "ndr-dev_DocStoreApiMtls"
      + policy                       = (known after apply)
      + root_resource_id             = (known after apply)
      + tags                         = {
          + "Name" = "ndr-dev_DocStoreApiMtls"
        }
      + tags_all                     = {
          + "Environment" = "dev"
          + "Name"        = "ndr-dev_DocStoreApiMtls"
          + "Owner"       = "nhse/ndr-team"
          + "Workspace"   = "ndr-dev"
        }

      + endpoint_configuration {
          + ip_address_type  = (known after apply)
          + types            = [
              + "REGIONAL",
            ]
          + vpc_endpoint_ids = (known after apply)
        }
    }

  # aws_api_gateway_stage.ndr_api will be updated in-place
  ~ resource "aws_api_gateway_stage" "ndr_api" {
      ~ deployment_id         = "8dd31m" -> (known after apply)
        id                    = "ags-ccy0v3rve9-dev"
        tags                  = {}
        # (14 unchanged attributes hidden)
    }

  # aws_api_gateway_stage.ndr_api_mtls will be created
  + resource "aws_api_gateway_stage" "ndr_api_mtls" {
      + arn                  = (known after apply)
      + deployment_id        = (known after apply)
      + execution_arn        = (known after apply)
      + id                   = (known after apply)
      + invoke_url           = (known after apply)
      + rest_api_id          = (known after apply)
      + stage_name           = "dev"
      + tags_all             = {
          + "Environment" = "dev"
          + "Owner"       = "nhse/ndr-team"
          + "Workspace"   = "ndr-dev"
        }
      + web_acl_arn          = (known after apply)
      + xray_tracing_enabled = false
    }

  # aws_api_gateway_usage_plan.api_key_pdm will be updated in-place
  ~ resource "aws_api_gateway_usage_plan" "api_key_pdm" {
        id           = "8yvge9"
        name         = "ndr-dev_pdm-usage-plan"
        tags         = {}
        # (4 unchanged attributes hidden)

      - api_stages {
          - api_id = "ccy0v3rve9" -> null
          - stage  = "dev" -> null
        }
      + api_stages {
          + api_id = (known after apply)
          + stage  = "dev"
        }
    }

  # aws_cloudwatch_log_group.mtls_api_gateway_stage will be created
  + resource "aws_cloudwatch_log_group" "mtls_api_gateway_stage" {
      + arn               = (known after apply)
      + id                = (known after apply)
      + log_group_class   = (known after apply)
      + name              = (known after apply)
      + name_prefix       = (known after apply)
      + retention_in_days = 0
      + skip_destroy      = false
      + tags_all          = {
          + "Environment" = "dev"
          + "Owner"       = "nhse/ndr-team"
          + "Workspace"   = "ndr-dev"
        }
    }

  # aws_lambda_permission.lambda_permission_get_mtls_api will be created
  + resource "aws_lambda_permission" "lambda_permission_get_mtls_api" {
      + action              = "lambda:InvokeFunction"
      + function_name       = "arn:aws:lambda:eu-west-2:[REDACTED_AWS_ACCOUNT_ID]:function:ndr-dev_GetDocumentReference"
      + id                  = (known after apply)
      + principal           = "apigateway.amazonaws.com"
      + source_arn          = (known after apply)
      + statement_id        = "AllowAPImTLSGatewayInvoke"
      + statement_id_prefix = (known after apply)
    }

  # aws_lambda_permission.lambda_permission_post_mtls_api will be created
  + resource "aws_lambda_permission" "lambda_permission_post_mtls_api" {
      + action              = "lambda:InvokeFunction"
      + function_name       = "arn:aws:lambda:eu-west-2:[REDACTED_AWS_ACCOUNT_ID]:function:ndr-dev_PostDocumentReferencesFHIR"
      + id                  = (known after apply)
      + principal           = "apigateway.amazonaws.com"
      + source_arn          = (known after apply)
      + statement_id        = "AllowAPImTLSGatewayInvoke"
      + statement_id_prefix = (known after apply)
    }

  # aws_lambda_permission.lambda_permission_search_mtls_api will be created
  + resource "aws_lambda_permission" "lambda_permission_search_mtls_api" {
      + action              = "lambda:InvokeFunction"
      + function_name       = "arn:aws:lambda:eu-west-2:[REDACTED_AWS_ACCOUNT_ID]:function:ndr-dev_SearchDocumentReferencesFHIR"
      + id                  = (known after apply)
      + principal           = "apigateway.amazonaws.com"
      + source_arn          = (known after apply)
      + statement_id        = "AllowMtlsApiGatewayInvoke"
      + statement_id_prefix = (known after apply)
    }

  # aws_route53_record.ndr_mtls_api_record will be created
  + resource "aws_route53_record" "ndr_mtls_api_record" {
      + allow_overwrite = (known after apply)
      + fqdn            = (known after apply)
      + id              = (known after apply)
      + name            = "mtls.ndr-dev.access-request-fulfilment.patient-deductions.nhs.uk"
      + type            = "A"
      + zone_id         = "Z03876441EL64PCVENJO8"

      + alias {
          + evaluate_target_health = true
          + name                   = (known after apply)
          + zone_id                = (known after apply)
        }
    }

  # module.fhir_document_reference_mtls_gateway.aws_api_gateway_integration.preflight_integration will be created
  + resource "aws_api_gateway_integration" "preflight_integration" {
      + cache_namespace      = (known after apply)
      + connection_type      = "INTERNET"
      + http_method          = "OPTIONS"
      + id                   = (known after apply)
      + passthrough_behavior = (known after apply)
      + request_templates    = {
          + "application/json" = jsonencode(
                {
                  + statusCode = 200
                }
            )
        }
      + resource_id          = (known after apply)
      + rest_api_id          = (known after apply)
      + timeout_milliseconds = 29000
      + type                 = "MOCK"
    }

  # module.fhir_document_reference_mtls_gateway.aws_api_gateway_integration_response.preflight_integration_response will be created
  + resource "aws_api_gateway_integration_response" "preflight_integration_response" {
      + http_method         = "OPTIONS"
      + id                  = (known after apply)
      + resource_id         = (known after apply)
      + response_parameters = {
          + "method.response.header.Access-Control-Allow-Credentials" = "'true'"
          + "method.response.header.Access-Control-Allow-Headers"     = "'Content-Type,X-Amz-Date,Authorization,X-Auth,Cookie,X-Api-Key,X-Amz-Security-Token,X-Auth-Cookie,Accept'"
          + "method.response.header.Access-Control-Allow-Methods"     = "'POST, GET'"
          + "method.response.header.Access-Control-Allow-Origin"      = "'*'"
        }
      + rest_api_id         = (known after apply)
      + status_code         = "200"
    }

  # module.fhir_document_reference_mtls_gateway.aws_api_gateway_method.preflight_method will be created
  + resource "aws_api_gateway_method" "preflight_method" {
      + api_key_required = false
      + authorization    = "NONE"
      + http_method      = "OPTIONS"
      + id               = (known after apply)
      + resource_id      = (known after apply)
      + rest_api_id      = (known after apply)
    }

  # module.fhir_document_reference_mtls_gateway.aws_api_gateway_method.proxy_method["GET"] will be created
  + resource "aws_api_gateway_method" "proxy_method" {
      + api_key_required = true
      + authorization    = "NONE"
      + http_method      = "GET"
      + id               = (known after apply)
      + resource_id      = (known after apply)
      + rest_api_id      = (known after apply)
        # (1 unchanged attribute hidden)
    }

  # module.fhir_document_reference_mtls_gateway.aws_api_gateway_method.proxy_method["POST"] will be created
  + resource "aws_api_gateway_method" "proxy_method" {
      + api_key_required = true
      + authorization    = "NONE"
      + http_method      = "POST"
      + id               = (known after apply)
      + resource_id      = (known after apply)
      + rest_api_id      = (known after apply)
        # (1 unchanged attribute hidden)
    }

  # module.fhir_document_reference_mtls_gateway.aws_api_gateway_method_response.preflight_method_response will be created
  + resource "aws_api_gateway_method_response" "preflight_method_response" {
      + http_method         = "OPTIONS"
      + id                  = (known after apply)
      + resource_id         = (known after apply)
      + response_models     = {
          + "application/json" = "Empty"
        }
      + response_parameters = {
          + "method.response.header.Access-Control-Allow-Credentials" = true
          + "method.response.header.Access-Control-Allow-Headers"     = true
          + "method.response.header.Access-Control-Allow-Methods"     = true
          + "method.response.header.Access-Control-Allow-Origin"      = true
        }
      + rest_api_id         = (known after apply)
      + status_code         = "200"
    }

  # module.fhir_document_reference_mtls_gateway.aws_api_gateway_resource.gateway_resource will be created
  + resource "aws_api_gateway_resource" "gateway_resource" {
      + id          = (known after apply)
      + parent_id   = (known after apply)
      + path        = (known after apply)
      + path_part   = "DocumentReference"
      + rest_api_id = (known after apply)
    }

  # module.mtls_api_endpoint_url_ssm_parameter.aws_ssm_parameter.secret will be created
  + resource "aws_ssm_parameter" "secret" {
      + arn            = (known after apply)
      + data_type      = (known after apply)
      + description    = "mTLS api endpoint URL for dev"
      + has_value_wo   = (known after apply)
      + id             = (known after apply)
      + insecure_value = (known after apply)
      + key_id         = (known after apply)
      + name           = "/ndr/ndr-dev/ndr-dev_ApiEndpointMtls"
      + tags           = {
          + "Name" = "ndr-dev-ssm"
        }
      + tags_all       = {
          + "Environment" = "dev"
          + "Name"        = "ndr-dev-ssm"
          + "Owner"       = "nhse/ndr-team"
          + "Workspace"   = "ndr-dev"
        }
      + tier           = (known after apply)
      + type           = "SecureString"
      + value          = (sensitive value)
      + value_wo       = (write-only attribute)
      + version        = (known after apply)
    }

  # module.ndr-ecs-fargate-app.aws_ecs_task_definition.ndr_ecs_task will be updated in-place
  ~ resource "aws_ecs_task_definition" "ndr_ecs_task" {
        id                       = "ndr-dev-task-app-cluster"
        tags                     = {}
      ~ tags_all                 = {
          + "Environment" = "dev"
          + "Owner"       = "nhse/ndr-team"
          + "Workspace"   = "ndr-dev"
        }
        # (16 unchanged attributes hidden)
    }

  # module.ndr-ecs-fargate-data-collection[0].aws_ecs_task_definition.ndr_ecs_task will be updated in-place
  ~ resource "aws_ecs_task_definition" "ndr_ecs_task" {
        id                       = "ndr-dev-task-data-collection"
        tags                     = {}
      ~ tags_all                 = {
          + "Environment" = "dev"
          + "Owner"       = "nhse/ndr-team"
          + "Workspace"   = "ndr-dev"
        }
        # (16 unchanged attributes hidden)
    }

Plan: 27 to add, 4 to change, 1 to destroy.

@megan-bower4 megan-bower4 merged commit fd4cd6f into main Sep 12, 2025
7 checks passed
@megan-bower4 megan-bower4 deleted the NDR-213 branch September 12, 2025 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants