Skip to content

Commit

Permalink
refactor: Update Azure deployment workflow for importing existing res…
Browse files Browse the repository at this point in the history
…ources
  • Loading branch information
Raj committed Aug 6, 2024
1 parent 171a8d6 commit ce94c97
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/azuredeploy.terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,8 @@ jobs:
working-directory: ./infra

# Import existing resources
- name: Import Resource Group
run: terraform import azurerm_resource_group.example /subscriptions/${{ secrets.AZURE_SUBSCRIPTION_ID }}/resourceGroups/${{ secrets.HELLOWORLD_RESOURCE_GROUP_NAME }}
working-directory: ./infra

- name: Import Static Web App
run: terraform import azurerm_static_web_app.example /subscriptions/${{ secrets.AZURE_SUBSCRIPTION_ID }}/resourceGroups/${{ secrets.HELLOWORLD_RESOURCE_GROUP_NAME }}/providers/Microsoft.Web/staticSites/${{ vars.STATIC_WEB_APP_NAME }}
run: terraform import -var="resource_group_name=${{ secrets.HELLOWORLD_RESOURCE_GROUP_NAME }}" azurerm_static_web_app.example /subscriptions/${{ secrets.AZURE_SUBSCRIPTION_ID }}/resourceGroups/${{ secrets.HELLOWORLD_RESOURCE_GROUP_NAME }}/providers/Microsoft.Web/staticSites/${{ vars.STATIC_WEB_APP_NAME }}
working-directory: ./infra

# Apply Terraform
Expand Down
9 changes: 2 additions & 7 deletions infra/azuredeploy.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,9 @@ variable "resource_group_name" {
type = string
}

resource "azurerm_resource_group" "example" {
name = var.resource_group_name
location = "East Asia"
}

resource "azurerm_static_web_app" "example" {
name = var.staticSites_name
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
location = "East Asia"
resource_group_name = var.resource_group_name
sku_tier = "Free"
}

0 comments on commit ce94c97

Please sign in to comment.