-
Notifications
You must be signed in to change notification settings - Fork 376
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
feat: add public ip address support for /res/api-management/service
#1795
Conversation
@@ -0,0 +1,86 @@ | |||
name: "avm.ptn.security-center" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beware, PR invaders
@@ -1532,39 +1551,6 @@ A list of availability zones denoting where the resource needs to come from. | |||
|
|||
_None_ | |||
|
|||
## Notes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just doublecheckinf if this was intended. You're more than welcome to remove these notes that originally came from CARML. Just want to make sure you did know about them 😉
@@ -129,6 +128,9 @@ param products array = [] | |||
@description('Optional. Subscriptions.') | |||
param subscriptions array = [] | |||
|
|||
@description('Optional. Public Standard SKU IP V4 based IP address to be associated with Virtual Network deployed service in the region. Supported only for Developer and Premium SKU being deployed in Virtual Network.') | |||
param publicIpAddressId string = '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, to be explicit, we'd call this publicIpAddressResourceId
. That being said, the parameter sohuld probably be nullable, as the pipeline seems to not like the ''
as a value
@@ -141,7 +143,7 @@ var identity = !empty(managedIdentities) | |||
? { | |||
type: (managedIdentities.?systemAssigned ?? false) | |||
? (!empty(managedIdentities.?userAssignedResourceIds ?? {}) ? 'SystemAssigned,UserAssigned' : 'SystemAssigned') | |||
: (!empty(managedIdentities.?userAssignedResourceIds ?? {}) ? 'UserAssigned' : 'None') | |||
: (!empty(managedIdentities.?userAssignedResourceIds ?? {}) ? 'UserAssigned' : null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change? It seems to bring back the RP warning
/home/runner/work/bicep-registry-modules/bicep-registry-modules/avm/res/api-management/service/main.bicep(142,16) : Warning BCP321: Expected a value of type "string" but the provided value is of type "'SystemAssigned' | 'SystemAssigned,UserAssigned' | 'UserAssigned' | null".
publisherEmail: '[email protected]' | ||
publisherName: '${namePrefix}-az-amorg-x-001' | ||
} | ||
module testDeployment '../../../main.bicep' = [for iteration in [ 'init', 'idem' ]: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beware, you're not using the latest Bicep version which is why every Bicep file (& JSON file) got re-formatted / updated.
Please upgrade to the latest (check bicep --version
) and run Set-AVMModule -Recurse
on the root folder path of this module again :)
@description('VNet name') | ||
param vnetName string = 'VNet' | ||
|
||
@description('Address prefix') | ||
param vnetAddressPrefix string = '10.0.0.0/16' | ||
|
||
@description('Subnet Prefix') | ||
param subnetPrefix string = '10.0.0.0/24' | ||
|
||
@description('Subnet Name') | ||
param subnetName string = 'Subnet' | ||
|
||
@description('DNS Prefix') | ||
param dnsLabelPrefix string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This and the next is just a recommendation to align with other test cases. Feel free to reject if you prefer the original implementation 😉
The rationale is that some inner resources like the subnet name or network properties don't need to be globally unique. Hence there is no need to have them as parameters.
The same could be set for, for example the VNETName, but these we usually pass in regardless to have a single location where one could find all the main resource names (with namePrefix & all).
@description('VNet name') | |
param vnetName string = 'VNet' | |
@description('Address prefix') | |
param vnetAddressPrefix string = '10.0.0.0/16' | |
@description('Subnet Prefix') | |
param subnetPrefix string = '10.0.0.0/24' | |
@description('Subnet Name') | |
param subnetName string = 'Subnet' | |
@description('DNS Prefix') | |
param dnsLabelPrefix string | |
@description('Required. The DNS prefix for the Public IP') | |
param publicIpDnsLabelPrefix string | |
@description('Required. The name of the Virtual Network to create.') | |
param virtualNetworkName string | |
@description('Required. The name of the NSG to create.') | |
param networkSecurityGroupName string | |
var addressPrefix = '10.0.0.0/16' |
resource vnet 'Microsoft.Network/virtualNetworks@2023-04-01' = { | ||
name: vnetName | ||
location: location | ||
properties: { | ||
addressSpace: { | ||
addressPrefixes: [ | ||
vnetAddressPrefix | ||
] | ||
} | ||
subnets: [ | ||
{ | ||
name: subnetName | ||
properties: { | ||
addressPrefix: subnetPrefix | ||
networkSecurityGroup: { | ||
id: nsg.id | ||
} | ||
serviceEndpoints: [ | ||
{ | ||
service: 'Microsoft.Storage' | ||
} | ||
{ | ||
service: 'Microsoft.Sql' | ||
} | ||
{ | ||
service: 'Microsoft.KeyVault' | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
} | ||
|
||
resource nsg 'Microsoft.Network/networkSecurityGroups@2020-06-01' = { | ||
name: 'testNSG' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For rationale, see other comment.
resource vnet 'Microsoft.Network/virtualNetworks@2023-04-01' = { | |
name: vnetName | |
location: location | |
properties: { | |
addressSpace: { | |
addressPrefixes: [ | |
vnetAddressPrefix | |
] | |
} | |
subnets: [ | |
{ | |
name: subnetName | |
properties: { | |
addressPrefix: subnetPrefix | |
networkSecurityGroup: { | |
id: nsg.id | |
} | |
serviceEndpoints: [ | |
{ | |
service: 'Microsoft.Storage' | |
} | |
{ | |
service: 'Microsoft.Sql' | |
} | |
{ | |
service: 'Microsoft.KeyVault' | |
} | |
] | |
} | |
} | |
] | |
} | |
} | |
resource nsg 'Microsoft.Network/networkSecurityGroups@2020-06-01' = { | |
name: 'testNSG' | |
resource vnet 'Microsoft.Network/virtualNetworks@2023-04-01' = { | |
name: virtualNetworkName | |
location: location | |
properties: { | |
addressSpace: { | |
addressPrefixes: [ | |
addressPrefix | |
] | |
} | |
subnets: [ | |
{ | |
name: 'default' | |
properties: { | |
addressPrefix: cidrSubnet(addressPrefix, 24, 0) | |
networkSecurityGroup: { | |
id: nsg.id | |
} | |
serviceEndpoints: [ | |
{ | |
service: 'Microsoft.Storage' | |
} | |
{ | |
service: 'Microsoft.Sql' | |
} | |
{ | |
service: 'Microsoft.KeyVault' | |
} | |
] | |
} | |
} | |
] | |
} | |
} | |
resource nsg 'Microsoft.Network/networkSecurityGroups@2020-06-01' = { | |
name: networkSecurityGroupName |
publicIPAllocationMethod: 'Static' | ||
publicIPAddressVersion: 'IPv4' | ||
dnsSettings: { | ||
domainNameLabel: dnsLabelPrefix |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See other comment
domainNameLabel: dnsLabelPrefix | |
domainNameLabel: publicIpDnsLabelPrefix |
@@ -41,6 +41,8 @@ module nestedDependencies 'dependencies.bicep' = { | |||
params: { | |||
managedIdentityName: 'dep-${namePrefix}-msi-${serviceShort}' | |||
location: resourceLocation | |||
publicIPName: 'dep-${namePrefix}-pip-${serviceShort}' | |||
dnsLabelPrefix: 'dep-${namePrefix}-dnsprefix-${uniqueString(deployment().name, resourceLocation)}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dnsLabelPrefix: 'dep-${namePrefix}-dnsprefix-${uniqueString(deployment().name, resourceLocation)}' | |
publicIpDnsLabelPrefix: 'dep-${namePrefix}-dnsprefix-${uniqueString(deployment().name, resourceLocation)}' |
/res/api-management/service
/res/api-management/service
Been a bit busy, but thank you for all the recommendations @AlexanderSehr -- I didn't do a thorough review of the way this was set up during the CARML -> AVM migraiton so there are still a lot of relics from CARML. I will make the changes you suggested. I'm still working on fixing the max test deployment which includes creating a publicIP. have been running into issues with it and have even raised an Azure support ticket. I'm still working on my branch so there will be more updates coming |
I am going to re-do this whole pull request now that I have my local branches sorted out and the commits cleaned up. Stay tuned... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @tony-box is this PR still valid or should we close it as superseded?
closing this PR which will be superceeded by #2453 |
Description
Closes #1104
Adds APIM support for PublicIPAddress
Pipeline Reference
Type of Change
version.json
:version.json
.version.json
.Checklist
Set-AVMModule
locally to generate the supporting module files.