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 issues with DNS not auto-provisioning #71

Closed
wants to merge 8 commits into from
Closed
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
6 changes: 3 additions & 3 deletions .github/workflows/instance-deploy-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,20 +119,20 @@ jobs:
acrName: onlinestorecontainerregistry
acrUsername: ${{ secrets.ACR_USERNAME }}
acrPassword: ${{ secrets.ACR_TOKEN }}
containerAppName: onlinestore-api
containerAppName: prod-onlinestore-api
imageToDeploy: onlinestorecontainerregistry.azurecr.io/onlinestore-api:${{ github.sha }}
location: 'East US'
resourceGroup: ${{ env.resource_group_name }}
targetPort: 8080
environmentVariables: OTEL_EXPORTER_OTLP_ENDPOINT=http://onlinestore-monitoring:18889
environmentVariables: OTEL_EXPORTER_OTLP_ENDPOINT=http://prod-onlinestore-monitoring:18889
- name: Deploy website
uses: azure/container-apps-deploy-action@v1
with:
yamlConfigPath: .github/workflows/config/container-environment-config.yaml
acrName: onlinestorecontainerregistry
acrUsername: ${{ secrets.ACR_USERNAME }}
acrPassword: ${{ secrets.ACR_TOKEN }}
containerAppName: onlinestore-website
containerAppName: prod-onlinestore-website
imageToDeploy: onlinestorecontainerregistry.azurecr.io/onlinestore-website:${{ github.sha }}
location: 'East US'
resourceGroup: ${{ env.resource_group_name }}
Expand Down
16 changes: 9 additions & 7 deletions .github/workflows/instance-deploy-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
TF_VAR_environment: ${{ github.head_ref }}
TF_VAR_acr_username: ${{ secrets.ACR_USERNAME }}
TF_VAR_acr_password: ${{ secrets.ACR_TOKEN }}
TF_VAR_website_dns_subdomain: ${{ github.head_ref }}-site
TF_VAR_website_dns_subdomain: ${{ github.head_ref }}-website
TF_VAR_api_dns_subdomain: ${{ github.head_ref }}-api
TF_VAR_monitoring_dns_subdomain: ${{ github.head_ref }}-monitoring
- name: Terraform Apply
Expand All @@ -71,9 +71,9 @@ jobs:
TF_VAR_environment: ${{ github.head_ref }}
TF_VAR_acr_username: ${{ secrets.ACR_USERNAME }}
TF_VAR_acr_password: ${{ secrets.ACR_TOKEN }}
TF_VAR_website_dns_subdomain: ${{ github.head_ref }}
TF_VAR_api_dns_subdomain: api
TF_VAR_monitoring_dns_subdomain: monitoring
TF_VAR_website_dns_subdomain: ${{ github.head_ref }}-website
TF_VAR_api_dns_subdomain: ${{ github.head_ref }}-api
TF_VAR_monitoring_dns_subdomain: ${{ github.head_ref }}-monitoring
- name: Save terraform outputs
shell: bash
run: |
Expand Down Expand Up @@ -114,22 +114,24 @@ jobs:
- name: Deploy api
uses: azure/container-apps-deploy-action@v1
with:
yamlConfigPath: .github/workflows/config/container-environment-config.yaml
acrName: onlinestorecontainerregistry
acrUsername: ${{ secrets.ACR_USERNAME }}
acrPassword: ${{ secrets.ACR_TOKEN }}
containerAppName: onlinestore-api
containerAppName: ${{ github.head_ref }}-onlinestore-api
imageToDeploy: onlinestorecontainerregistry.azurecr.io/onlinestore-api:${{ github.sha }}
location: 'East US'
resourceGroup: ${{ env.resource_group_name }}
targetPort: 8080
environmentVariables: OTEL_EXPORTER_OTLP_ENDPOINT=http://onlinestore-monitoring:18889
environmentVariables: OTEL_EXPORTER_OTLP_ENDPOINT=http://${{ github.head_ref }}-onlinestore-monitoring:18889
- name: Deploy website
uses: azure/container-apps-deploy-action@v1
with:
yamlConfigPath: .github/workflows/config/container-environment-config.yaml
acrName: onlinestorecontainerregistry
acrUsername: ${{ secrets.ACR_USERNAME }}
acrPassword: ${{ secrets.ACR_TOKEN }}
containerAppName: onlinestore-website
containerAppName: ${{ github.head_ref }}-onlinestore-website
imageToDeploy: onlinestorecontainerregistry.azurecr.io/onlinestore-website:${{ github.sha }}
location: 'East US'
resourceGroup: ${{ env.resource_group_name }}
Expand Down
6 changes: 3 additions & 3 deletions terraform/instance/container_apps.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ data "azurerm_container_app_environment" "apps" {
}

resource "azurerm_container_app" "api" {
name = "${var.name}-api"
name = "${lower(var.environment)}-${var.name}-api"
container_app_environment_id = data.azurerm_container_app_environment.apps.id
resource_group_name = azurerm_resource_group.instance.name
revision_mode = "Single"
Expand Down Expand Up @@ -39,7 +39,7 @@ resource "azurerm_container_app" "api" {
}

resource "azurerm_container_app" "website" {
name = "${var.name}-website"
name = "${lower(var.environment)}-${var.name}-website"
container_app_environment_id = data.azurerm_container_app_environment.apps.id
resource_group_name = azurerm_resource_group.instance.name
revision_mode = "Single"
Expand Down Expand Up @@ -74,7 +74,7 @@ resource "azurerm_container_app" "website" {
}

resource "azurerm_container_app" "monitoring" {
name = "${var.name}-monitoring"
name = "${lower(var.environment)}-${var.name}-monitoring"
container_app_environment_id = data.azurerm_container_app_environment.apps.id
resource_group_name = azurerm_resource_group.instance.name
revision_mode = "Single"
Expand Down
3 changes: 0 additions & 3 deletions terraform/instance/dns.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ resource "azurerm_dns_txt_record" "api" {
resource "azurerm_container_app_custom_domain" "api" {
name = trimsuffix(trimprefix(azurerm_dns_txt_record.api.fqdn, "asuid."), ".")
container_app_id = azurerm_container_app.api.id
certificate_binding_type = "SniEnabled"

depends_on = [
azurerm_dns_txt_record.api,
Expand Down Expand Up @@ -57,7 +56,6 @@ resource "azurerm_dns_txt_record" "website" {
resource "azurerm_container_app_custom_domain" "website" {
name = trimsuffix(trimprefix(azurerm_dns_txt_record.website.fqdn, "asuid."), ".")
container_app_id = azurerm_container_app.website.id
certificate_binding_type = "SniEnabled"

depends_on = [
azurerm_dns_txt_record.website,
Expand Down Expand Up @@ -90,7 +88,6 @@ resource "azurerm_dns_txt_record" "monitoring" {
resource "azurerm_container_app_custom_domain" "monitoring" {
name = trimsuffix(trimprefix(azurerm_dns_txt_record.monitoring.fqdn, "asuid."), ".")
container_app_id = azurerm_container_app.monitoring.id
certificate_binding_type = "SniEnabled"

depends_on = [
azurerm_dns_txt_record.monitoring,
Expand Down
Loading