-
Notifications
You must be signed in to change notification settings - Fork 0
Dns record opzet wat gestroomlijnd #144
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5fccede
Deployment van de dns records wat netter opgezet
mvdevries ce4f0ce
CNames gefixt
mvdevries 1c89fc1
Null checks toegvoegd
mvdevries fb690c8
Merge branch 'main' into feature/dns-records-cleanup
mvdevries abdac7f
Batch size toegevoegd aan frontdoor
mvdevries 9d2c983
DNS zones per domeinnaam in frontdoor zetten
mvdevries 00148ca
Comments van Alex gefixt
mvdevries fddbaf1
Hostname bijgwerkt naar een type
mvdevries File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| using './website.bicep' | ||
|
|
||
| param resourceGroupSuffix = 'main' | ||
| param application = 'dotnet' | ||
| param hostnames = [ | ||
| { | ||
| dnsZoneName: 'xprtz.nl' | ||
| hostname: '' | ||
| } | ||
| { | ||
| dnsZoneName: 'xprtz.nl' | ||
| hostname: 'www' | ||
| } | ||
| { | ||
| dnsZoneName: 'xprtz.cloud' | ||
| hostname: '' | ||
| } | ||
| { | ||
| dnsZoneName: 'xprtz.cloud' | ||
| hostname: 'www' | ||
| } | ||
| { | ||
| dnsZoneName: 'xprtz.net' | ||
| hostname: '' | ||
| } | ||
| { | ||
| dnsZoneName: 'xprtz.net' | ||
| hostname: 'www' | ||
| } | ||
| ] | ||
| param imageHostname = { | ||
| dnsZoneName: 'xprtz.nl' | ||
| hostname: 'images' | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,11 @@ | ||
| @export() | ||
| type domainsType = { | ||
| rootDomain: string | ||
| subDomain: string | ||
| fullDomain: string | ||
| type hostnameType = { | ||
| dnsZoneName: string | ||
| hostname: string | ||
| } | ||
|
|
||
| @export() | ||
| type validationTokenType = { | ||
| domain: domainsType | ||
| hostname: hostnameType | ||
| validationToken: string | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| import { hostnameType } from './types.bicep' | ||
|
|
||
| targetScope = 'subscription' | ||
|
|
||
| @description('The suffix for the resource group, typically \'main\' for production or a specific identifier for non-production environments.') | ||
| param resourceGroupSuffix string | ||
| @description('The name of the application, used to prefix resource names.') | ||
| param application string | ||
| @description('List of hostnames to be configured for the website.') | ||
| param hostnames hostnameType[] | ||
| @description('Hostname for the images domain, used for static content.') | ||
| param imageHostname hostnameType | ||
|
|
||
| var isProd = endsWith(resourceGroupSuffix, 'main') | ||
|
|
||
| var sharedValues = json(loadTextContent('shared-values.json')) | ||
| var infrastructureResourceGroup = resourceGroup( | ||
| sharedValues.subscriptionIds.xprtz, | ||
| sharedValues.resourceGroups.infrastructure | ||
| ) | ||
|
|
||
| var resourceGroupPrefix = 'rg-xprtzbv-website-${application}' | ||
| var resourceGroupName = isProd ? resourceGroupPrefix : '${resourceGroupPrefix}-${resourceGroupSuffix}' | ||
| resource websiteResourceGroup 'Microsoft.Resources/resourceGroups@2024-03-01' = { | ||
| location: deployment().location | ||
| name: resourceGroupName | ||
| } | ||
|
|
||
| module storageAccountModule 'modules/storageAccount.bicep' = { | ||
| scope: websiteResourceGroup | ||
| name: 'storageAccountDeploy-${application}' | ||
| params: { | ||
| app: application | ||
| } | ||
| } | ||
|
|
||
| module frontDoorSettings 'modules/frontdoor.bicep' = if (isProd) { | ||
| scope: infrastructureResourceGroup | ||
| name: 'frontDoorSettingsDeploy-${application}' | ||
| params: { | ||
| frontDoorOriginHost: storageAccountModule.outputs.storageAccountHost | ||
| frontDoorProfileName: sharedValues.frontDoorProfileName | ||
| application: application | ||
| hostnames: hostnames | ||
| } | ||
| } | ||
|
|
||
| @batchSize(1) | ||
| module dnsSettings 'modules/dns.bicep' = [for hostname in hostnames: if (isProd) { | ||
| scope: infrastructureResourceGroup | ||
| name: 'dnsSettingsDeploy-${hostname.hostname}-${hostname.dnsZoneName}-${application}' | ||
| params: { | ||
| hostname: hostname | ||
| frontDoorEndpointId: frontDoorSettings!.outputs.frontDoorEndpointId | ||
| frontDoorHostname: frontDoorSettings!.outputs.frontDoorHostname | ||
| validationToken: filter( | ||
| frontDoorSettings!.outputs.frontDoorCustomDomainValidationTokens, | ||
| validation => validation.hostname.hostname == hostname.hostname && validation.hostname.dnsZoneName == hostname.dnsZoneName | ||
| )[0] | ||
| } | ||
| } | ||
| ] | ||
|
|
||
| module imagesFrontDoorSettings 'modules/frontdoor-images.bicep' = if (isProd) { | ||
| scope: infrastructureResourceGroup | ||
| name: 'imagesFrontDoorSettingsDeploy-${application}' | ||
| params: { | ||
| storageAccountName: storageAccountModule!.outputs.storageAccountName | ||
| storageAccountResourceGroup: websiteResourceGroup.name | ||
| frontDoorProfileName: sharedValues.frontDoorProfileName | ||
| application: application | ||
| rootDomain: imageHostname.dnsZoneName | ||
| subDomain: imageHostname.hostname | ||
| } | ||
| } | ||
|
|
||
| module imagesDnsSettings 'modules/dns.bicep' = if (isProd) { | ||
| scope: infrastructureResourceGroup | ||
| name: 'imagesDnsSettingsDeploy-${application}' | ||
| params: { | ||
| hostname: imageHostname | ||
| frontDoorEndpointId: imagesFrontDoorSettings!.outputs.frontDoorEndpointId | ||
| frontDoorHostname: imagesFrontDoorSettings!.outputs.frontDoorHostname | ||
| validationToken: { | ||
| hostname: imageHostname | ||
| validationToken: imagesFrontDoorSettings!.outputs.frontDoorCustomDomainValidationToken | ||
| } | ||
| } | ||
| } | ||
|
|
||
| output storageAccountName string = storageAccountModule.outputs.storageAccountName | ||
| output resourceGroupName string = websiteResourceGroup.name | ||
| output applicationFqdn string = isProd ? 'https://${hostnames[0].dnsZoneName}/' : storageAccountModule.outputs.storageAccountFqdn | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.