Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: restrict container apps to apim ip #448

Merged
merged 1 commit into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .azure/applications/web-api-eu/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ param imageTag string
param environment string
@minLength(3)
param location string
@minLength(3)
param apimIp string

@minLength(3)
@secure()
Expand Down Expand Up @@ -64,6 +66,7 @@ module containerApp '../../modules/containerApp/main.bicep' = {
location: location
envVariables: containerAppEnvVars
containerAppEnvId: containerAppEnvironment.id
apimIp: apimIp
}
}

Expand Down
1 change: 1 addition & 0 deletions .azure/applications/web-api-eu/staging.bicepparam
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ using './main.bicep'

param environment = 'staging'
param location = 'norwayeast'
param apimIp = '51.13.86.131'
param imageTag = readEnvironmentVariable('IMAGE_TAG')

// secrets
Expand Down
1 change: 1 addition & 0 deletions .azure/applications/web-api-eu/test.bicepparam
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ using './main.bicep'

param environment = 'test'
param location = 'norwayeast'
param apimIp = '51.120.88.69'
param imageTag = readEnvironmentVariable('IMAGE_TAG')

// secrets
Expand Down
3 changes: 3 additions & 0 deletions .azure/applications/web-api-so/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ param imageTag string
param environment string
@minLength(3)
param location string
@minLength(3)
param apimIp string

@minLength(3)
@secure()
Expand Down Expand Up @@ -68,6 +70,7 @@ module containerApp '../../modules/containerApp/main.bicep' = {
location: location
envVariables: containerAppEnvVars
containerAppEnvId: containerAppEnvironment.id
apimIp: apimIp
}
}

Expand Down
1 change: 1 addition & 0 deletions .azure/applications/web-api-so/staging.bicepparam
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ using './main.bicep'

param environment = 'staging'
param location = 'norwayeast'
param apimIp = '51.13.86.131'
param imageTag = readEnvironmentVariable('IMAGE_TAG')

// secrets
Expand Down
1 change: 1 addition & 0 deletions .azure/applications/web-api-so/test.bicepparam
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ using './main.bicep'

param environment = 'test'
param location = 'norwayeast'
param apimIp = '51.120.88.69'
param imageTag = readEnvironmentVariable('IMAGE_TAG')

// secrets
Expand Down
9 changes: 8 additions & 1 deletion .azure/modules/containerApp/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ param envVariables array = []
param port int = 8080
param name string
param image string
param apimIp string

param containerAppEnvId string

Expand Down Expand Up @@ -30,7 +31,13 @@ var probes = [
var ingress = {
targetPort: port
external: true
ipSecurityRestrictions: []
ipSecurityRestrictions: [
{
name: 'apim'
action: 'Allow'
ipAddressRange: apimIp
}
]
}

resource containerApp 'Microsoft.App/containerApps@2023-05-01' = {
Expand Down
Loading