diff --git a/namespaces/live.cloud-platform.service.justice.gov.uk/visit-someone-in-prison-backend-svc-staging/resources/appinsights.tf b/namespaces/live.cloud-platform.service.justice.gov.uk/visit-someone-in-prison-backend-svc-staging/resources/appinsights.tf new file mode 100644 index 00000000000..902c0e65c1f --- /dev/null +++ b/namespaces/live.cloud-platform.service.justice.gov.uk/visit-someone-in-prison-backend-svc-staging/resources/appinsights.tf @@ -0,0 +1,16 @@ +data "aws_ssm_parameter" "application_insights_key" { + # var.environment should be set to one of dev, preprod or prod + # otherwise the key has to be hard-coded e.g. key-preprod if environment set to 'pre-production'. + name = "/application_insights/key-dev" +} + +resource "kubernetes_secret" "application-insights" { + metadata { + name = "application-insights" + namespace = var.namespace + } + data = { + APPINSIGHTS_INSTRUMENTATIONKEY = data.aws_ssm_parameter.application_insights_key.value + APPLICATIONINSIGHTS_CONNECTION_STRING = "InstrumentationKey=${data.aws_ssm_parameter.application_insights_key.value}" + } +}