|
| 1 | +param name string |
| 2 | +param location string = resourceGroup().location |
| 3 | +param tags object = {} |
| 4 | + |
| 5 | +param administratorLogin string |
| 6 | +@secure() |
| 7 | +param administratorLoginPassword string |
| 8 | + |
| 9 | +param coordinatorServerEdition string |
| 10 | +param coordinatorStorageQuotainMb int |
| 11 | +param coordinatorVCores int |
| 12 | +param databaseName string |
| 13 | +param nodeCount int |
| 14 | +param nodeVCores int |
| 15 | +param allowAzureIPsFirewall bool = false |
| 16 | +param allowAllIPsFirewall bool = false |
| 17 | +param allowedSingleIPs array = [] |
| 18 | +param postgresqlVersion string |
| 19 | + |
| 20 | +resource postgresCluster 'Microsoft.DBforPostgreSQL/serverGroupsv2@2023-03-02-preview' = { |
| 21 | + name: name |
| 22 | + location: location |
| 23 | + tags: tags |
| 24 | + properties: { |
| 25 | + administratorLogin: administratorLogin |
| 26 | + administratorLoginPassword: administratorLoginPassword |
| 27 | + coordinatorServerEdition: coordinatorServerEdition |
| 28 | + coordinatorStorageQuotaInMb: coordinatorStorageQuotainMb |
| 29 | + coordinatorVCores: coordinatorVCores |
| 30 | + postgresqlVersion: postgresqlVersion |
| 31 | + nodeCount: nodeCount |
| 32 | + nodeVCores: nodeVCores |
| 33 | + databaseName: databaseName |
| 34 | + } |
| 35 | + |
| 36 | + resource firewall_all 'firewallRules' = if (allowAllIPsFirewall) { |
| 37 | + name: 'allow-all-IPs' |
| 38 | + properties: { |
| 39 | + startIpAddress: '0.0.0.0' |
| 40 | + endIpAddress: '255.255.255.255' |
| 41 | + } |
| 42 | + } |
| 43 | + |
| 44 | + resource firewall_azure 'firewallRules' = if (allowAzureIPsFirewall) { |
| 45 | + name: 'allow-all-azure-internal-IPs' |
| 46 | + properties: { |
| 47 | + startIpAddress: '0.0.0.0' |
| 48 | + endIpAddress: '0.0.0.0' |
| 49 | + } |
| 50 | + } |
| 51 | + |
| 52 | + resource firewall_single 'firewallRules' = [for ip in allowedSingleIPs: { |
| 53 | + name: 'allow-single-${replace(ip, '.', '')}' |
| 54 | + properties: { |
| 55 | + startIpAddress: ip |
| 56 | + endIpAddress: ip |
| 57 | + } |
| 58 | + }] |
| 59 | + |
| 60 | +} |
| 61 | + |
| 62 | +output domainName string = postgresCluster.properties.serverNames[0].fullyQualifiedDomainName |
0 commit comments