Skip to content

Commit

Permalink
Add Cloudflare DNS records
Browse files Browse the repository at this point in the history
  • Loading branch information
russdaygh committed Apr 25, 2024
1 parent a741bab commit f7f33e9
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/DeployBranchPush.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ jobs:
AZURE_STATIC_WEB_APPS_API_TOKEN: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
TERRAFORM_STATE_ACCESS_KEY: ${{ secrets.TERRAFORM_STATE_ACCESS_KEY }}
CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
4 changes: 3 additions & 1 deletion .github/workflows/DeployEverything.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ on:
required: true
CLOUDFLARE_TOKEN:
required: true
CLOUDFLARE_ACCOUNT_ID:
required: true

env:
AZURE_WEBAPP_PACKAGE_PATH: PocketDDD.Server.WebAPI/publish
Expand Down Expand Up @@ -42,7 +44,7 @@ jobs:
- run: |
terraform init -backend-config="key=${{ inputs.env }}.terraform.tfstate"
terraform apply -auto-approve --var-file ../tfvars/${{ inputs.env }}.tfvars
terraform apply -auto-approve -var-file ../tfvars/${{ inputs.env }}.tfvars -var 'cloudflare_account_id=${{ secrets.CLOUDFLARE_ACCOUNT_ID }}'
env:
ARM_ACCESS_KEY: ${{ secrets.TERRAFORM_STATE_ACCESS_KEY }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/DeployMainBranch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ jobs:
AZURE_STATIC_WEB_APPS_API_TOKEN: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
TERRAFORM_STATE_ACCESS_KEY: ${{ secrets.TERRAFORM_STATE_ACCESS_KEY }}
CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
13 changes: 13 additions & 0 deletions terraform/blazor_client.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,16 @@ resource "azurerm_key_vault_secret" "blazor_client_deployment_token" {
value = azurerm_static_web_app.blazor-client.api_key
key_vault_id = azurerm_key_vault.key_vault.id
}

resource "cloudflare_zone" "dns_zone" {
account_id = var.cloudflare_account_id
zone = "dddsouthwest.com"
}

resource "cloudflare_record" "example" {
zone_id = cloudflare_zone.dns_zone.id
name = "pocketddd"
value = azurerm_static_web_app.blazor-client.default_host_name
type = "CNAME"
ttl = 3600
}
5 changes: 5 additions & 0 deletions terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,8 @@ variable "client_sku_size" {
nullable = false
type = string
}

variable "cloudflare_account_id" {
nullable = false
type = string
}

0 comments on commit f7f33e9

Please sign in to comment.