Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Commit

Permalink
DTSPO-115 Store send-grid API key in vault (#710)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Jacomb committed Nov 3, 2020
1 parent a879b9d commit 214b2cb
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 16 deletions.
2 changes: 1 addition & 1 deletion infrastructure/.terraform-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.13.2
0.13.5
21 changes: 21 additions & 0 deletions infrastructure/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,24 @@ data "azurerm_key_vault" "sscs_key_vault" {
name = "${local.azureVaultName}"
resource_group_name = local.azureVaultName
}

data "azurerm_key_vault" "send_grid" {
provider = azurerm.send-grid

name = var.env != "prod" ? "sendgridnonprod" : "sendgridprod"
resource_group_name = var.env != "prod" ? "SendGrid-nonprod" : "SendGrid-prod"
}

data "azurerm_key_vault_secret" "send_grid_api_key" {
provider = azurerm.send-grid


key_vault_id = data.azurerm_key_vault.send_grid.id
name = "sscs-password"
}

resource "azurerm_key_vault_secret" "sendgrid_api_key" {
key_vault_id = data.azurerm_key_vault.sscs_key_vault.id
name = "sendgrid-api-key"
value = data.azurerm_key_vault_secret.send_grid_api_key.value
}
1 change: 1 addition & 0 deletions infrastructure/prod.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
send_grid_subscription = "8999dec3-0104-4a27-94ee-6588559729d1"
7 changes: 6 additions & 1 deletion infrastructure/state.tf → infrastructure/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@ terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 2.25"
version = "~> 2.34"
}
random = {
source = "hashicorp/random"
}
}
}

provider "azurerm" {
alias = "send-grid"
features {}
}
16 changes: 2 additions & 14 deletions infrastructure/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,12 @@ variable "location" {
variable "env" {
}

variable "ilbIp" {}

variable "subscription" {}

variable "capacity" {
default = "1"
}

variable "common_tags" {
type = map(string)
}

variable "appinsights_instrumentation_key" {
description = "Instrumentation key of the App Insights instance this webapp should use. Module will create own App Insights resource if this is not provided"
default = ""
}

variable "appinsights_location" {
default = "West Europe"
description = "Location for Application Insights"
variable "send_grid_subscription" {
default = "1c4f0704-a29e-403d-b719-b90c34ef14c9"
}

0 comments on commit 214b2cb

Please sign in to comment.