Skip to content

Commit

Permalink
use le key
Browse files Browse the repository at this point in the history
  • Loading branch information
arealmaas committed Aug 5, 2024
1 parent 6bb39d0 commit a184d02
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .azure/infrastructure/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ param sourceKeyVaultResourceGroup string
@minLength(3)
param sourceKeyVaultName string

@description('SSH secret key for the ssh jumper')
@secure()
@minLength(3)
param sourceKeyVaultSshJumperSshSecretKey string

import { Sku as KeyVaultSku } from '../modules/keyvault/create.bicep'
param keyVaultSku KeyVaultSku

Expand Down Expand Up @@ -59,6 +64,7 @@ var secrets = {
sourceKeyVaultSubscriptionId: sourceKeyVaultSubscriptionId
sourceKeyVaultResourceGroup: sourceKeyVaultResourceGroup
sourceKeyVaultName: sourceKeyVaultName
sourceKeyVaultSshSecretKey: sourceKeyVaultSshJumperSshSecretKey
}

var namePrefix = 'dp-be-${environment}'
Expand Down Expand Up @@ -161,6 +167,7 @@ module sshJumper '../modules/ssh-jumper/main.bicep' = {
srcKeyVaultName: secrets.sourceKeyVaultName
srcKeyVaultSubId: secrets.sourceKeyVaultSubscriptionId
srcKeyVaultRGNName: secrets.sourceKeyVaultResourceGroup
srcKeyVaultSshSecretKey: secrets.sourceKeyVaultSshSecretKey
}
}

Expand Down
1 change: 1 addition & 0 deletions .azure/infrastructure/production.bicepparam
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ param dialogportenPgAdminPassword = readEnvironmentVariable('PG_ADMIN_PASSWORD')
param sourceKeyVaultSubscriptionId = readEnvironmentVariable('SOURCE_KEY_VAULT_SUBSCRIPTION_ID')
param sourceKeyVaultResourceGroup = readEnvironmentVariable('SOURCE_KEY_VAULT_RESOURCE_GROUP')
param sourceKeyVaultName = readEnvironmentVariable('SOURCE_KEY_VAULT_NAME')
param sourceKeyVaultSshJumperSshSecretKey = readEnvironmentVariable('SOURCE_KEY_VAULT_SSH_JUMPER_SSH_SECRET_KEY')

// SKUs
param keyVaultSku = {
Expand Down
1 change: 1 addition & 0 deletions .azure/infrastructure/soak.bicepparam
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ param dialogportenPgAdminPassword = readEnvironmentVariable('PG_ADMIN_PASSWORD')
param sourceKeyVaultSubscriptionId = readEnvironmentVariable('SOURCE_KEY_VAULT_SUBSCRIPTION_ID')
param sourceKeyVaultResourceGroup = readEnvironmentVariable('SOURCE_KEY_VAULT_RESOURCE_GROUP')
param sourceKeyVaultName = readEnvironmentVariable('SOURCE_KEY_VAULT_NAME')
param sourceKeyVaultSshJumperSshSecretKey = readEnvironmentVariable('SOURCE_KEY_VAULT_SSH_JUMPER_SSH_SECRET_KEY')

// SKUs
param keyVaultSku = {
Expand Down
1 change: 1 addition & 0 deletions .azure/infrastructure/staging.bicepparam
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ param dialogportenPgAdminPassword = readEnvironmentVariable('PG_ADMIN_PASSWORD')
param sourceKeyVaultSubscriptionId = readEnvironmentVariable('SOURCE_KEY_VAULT_SUBSCRIPTION_ID')
param sourceKeyVaultResourceGroup = readEnvironmentVariable('SOURCE_KEY_VAULT_RESOURCE_GROUP')
param sourceKeyVaultName = readEnvironmentVariable('SOURCE_KEY_VAULT_NAME')
param sourceKeyVaultSshJumperSshSecretKey = readEnvironmentVariable('SOURCE_KEY_VAULT_SSH_JUMPER_SSH_SECRET_KEY')

// SKUs
param keyVaultSku = {
Expand Down
1 change: 1 addition & 0 deletions .azure/infrastructure/test.bicepparam
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ param dialogportenPgAdminPassword = readEnvironmentVariable('PG_ADMIN_PASSWORD')
param sourceKeyVaultSubscriptionId = readEnvironmentVariable('SOURCE_KEY_VAULT_SUBSCRIPTION_ID')
param sourceKeyVaultResourceGroup = readEnvironmentVariable('SOURCE_KEY_VAULT_RESOURCE_GROUP')
param sourceKeyVaultName = readEnvironmentVariable('SOURCE_KEY_VAULT_NAME')
param sourceKeyVaultSshJumperSshSecretKey = readEnvironmentVariable('SOURCE_KEY_VAULT_SSH_JUMPER_SSH_SECRET_KEY')

// SKUs
param keyVaultSku = {
Expand Down
7 changes: 5 additions & 2 deletions .azure/modules/ssh-jumper/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ param srcKeyVaultSubId string
@description('The resource group name of the source Key Vault')
param srcKeyVaultRGNName string

@description('The SSH secret key to be used to get the ssh key for the virtual machine')
@secure()
param srcKeyVaultSshSecretKey string

var name = '${namePrefix}-jumper'

resource srcKeyVaultResource 'Microsoft.KeyVault/vaults@2023-07-01' existing = {
Expand Down Expand Up @@ -86,8 +90,7 @@ module virtualMachine '../../modules/virtualMachine/main.bicep' = {
name: name
params: {
name: name
// todo: remove hardcoded environment, use naming convention here.
sshKeyData: srcKeyVaultResource.getSecret('dialogportenJumperTestSSH')
sshKeyData: srcKeyVaultResource.getSecret(srcKeyVaultSshSecretKey)
location: location
tags: tags
hardwareProfile: {
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/action-deploy-infra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ on:
required: true
AZURE_SOURCE_KEY_VAULT_RESOURCE_GROUP:
required: true
AZURE_SOURCE_KEY_VAULT_SSH_JUMPER_SSH_SECRET_KEY:
required: true

inputs:
region:
Expand Down Expand Up @@ -98,6 +100,7 @@ jobs:
SOURCE_KEY_VAULT_SUBSCRIPTION_ID: ${{ secrets.AZURE_SOURCE_KEY_VAULT_SUBSCRIPTION_ID }}
SOURCE_KEY_VAULT_RESOURCE_GROUP: ${{ secrets.AZURE_SOURCE_KEY_VAULT_RESOURCE_GROUP }}
SOURCE_KEY_VAULT_NAME: ${{ secrets.AZURE_SOURCE_KEY_VAULT_NAME }}
SOURCE_KEY_VAULT_SSH_JUMPER_SSH_SECRET_KEY: ${{ secrets.AZURE_SOURCE_KEY_VAULT_SSH_JUMPER_SSH_SECRET_KEY }}
with:
scope: subscription
template: ./.azure/infrastructure/main.bicep
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-cd-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ jobs:
AZURE_SOURCE_KEY_VAULT_NAME: ${{ secrets.AZURE_SOURCE_KEY_VAULT_NAME }}
AZURE_SOURCE_KEY_VAULT_SUBSCRIPTION_ID: ${{ secrets.AZURE_SOURCE_KEY_VAULT_SUBSCRIPTION_ID }}
AZURE_SOURCE_KEY_VAULT_RESOURCE_GROUP: ${{ secrets.AZURE_SOURCE_KEY_VAULT_RESOURCE_GROUP }}
AZURE_SOURCE_KEY_VAULT_SSH_JUMPER_SSH_SECRET_KEY: ${{ secrets.AZURE_SOURCE_KEY_VAULT_SSH_JUMPER_SSH_SECRET_KEY }}
with:
environment: test
region: norwayeast
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-cd-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ jobs:
AZURE_SOURCE_KEY_VAULT_NAME: ${{ secrets.AZURE_SOURCE_KEY_VAULT_NAME }}
AZURE_SOURCE_KEY_VAULT_SUBSCRIPTION_ID: ${{ secrets.AZURE_SOURCE_KEY_VAULT_SUBSCRIPTION_ID }}
AZURE_SOURCE_KEY_VAULT_RESOURCE_GROUP: ${{ secrets.AZURE_SOURCE_KEY_VAULT_RESOURCE_GROUP }}
AZURE_SOURCE_KEY_VAULT_SSH_JUMPER_SSH_SECRET_KEY: ${{ secrets.AZURE_SOURCE_KEY_VAULT_SSH_JUMPER_SSH_SECRET_KEY }}
with:
environment: test
region: norwayeast
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-cd-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
AZURE_SOURCE_KEY_VAULT_NAME: ${{ secrets.AZURE_SOURCE_KEY_VAULT_NAME }}
AZURE_SOURCE_KEY_VAULT_SUBSCRIPTION_ID: ${{ secrets.AZURE_SOURCE_KEY_VAULT_SUBSCRIPTION_ID }}
AZURE_SOURCE_KEY_VAULT_RESOURCE_GROUP: ${{ secrets.AZURE_SOURCE_KEY_VAULT_RESOURCE_GROUP }}
AZURE_SOURCE_KEY_VAULT_SSH_JUMPER_SSH_SECRET_KEY: ${{ secrets.AZURE_SOURCE_KEY_VAULT_SSH_JUMPER_SSH_SECRET_KEY }}
with:
environment: staging
region: norwayeast
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/dispatch-infrastructure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
AZURE_SOURCE_KEY_VAULT_NAME: ${{ secrets.AZURE_SOURCE_KEY_VAULT_NAME }}
AZURE_SOURCE_KEY_VAULT_SUBSCRIPTION_ID: ${{ secrets.AZURE_SOURCE_KEY_VAULT_SUBSCRIPTION_ID }}
AZURE_SOURCE_KEY_VAULT_RESOURCE_GROUP: ${{ secrets.AZURE_SOURCE_KEY_VAULT_RESOURCE_GROUP }}
AZURE_SOURCE_KEY_VAULT_SSH_JUMPER_SSH_SECRET_KEY: ${{ secrets.AZURE_SOURCE_KEY_VAULT_SSH_JUMPER_SSH_SECRET_KEY }}
with:
environment: ${{ inputs.environment }}
region: norwayeast
Expand Down

0 comments on commit a184d02

Please sign in to comment.