Skip to content
Draft
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
57 changes: 57 additions & 0 deletions .github/workflows/azure-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Deploy Azure infrastructure

on:
workflow_dispatch:
push:
branches:
- main
paths:
- .github/workflows/azure-deploy.yaml
- infrastructure/**
pull_request:
paths:
- .github/workflows/azure-deploy.yaml
- infrastructure/**

concurrency: ${{ github.workflow }}

env:
ARM_USE_OIDC: true
ARM_USE_AZUREAD: true
ARM_TENANT_ID: c8698f43-ee75-4717-aa8a-d54328dbbe5f
ARM_SUBSCRIPTION_ID: 0c78b338-b4f9-4c41-81ca-a4e9d7ea186d
ARM_CLIENT_ID:

permissions:
id-token: write
contents: read

jobs:
plan:
runs-on: ubuntu-latest
defaults:
run:
working-directory: infrastructure
steps:

- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4

- name: Setup Terraform
uses: hashicorp/setup-terraform@a1502cd9e758c50496cc9ac5308c4843bcd56d36 # v3

- name: Terraform Init
run: terraform init

- name: Terraform Plan
run: terraform plan -input=false -out=plan

- name: Add plan to summary
run: |
echo '```terraform' >> $GITHUB_STEP_SUMMARY
terraform-bin show -no-color plan >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY

- name: Terraform Apply
if: github.ref == 'refs/heads/main'
run: terraform apply plan
4 changes: 4 additions & 0 deletions infrastructure/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
resource "azurerm_resource_group" "main" {
name = "turplanlegger-rg"
location = "norwayeast"
}
19 changes: 19 additions & 0 deletions infrastructure/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "3.91.0"
}
}

backend "azurerm" {
resource_group_name = "turplanlegger-terraform-rg"
storage_account_name = "turplanleggerterraformst"
container_name = "state"
key = "turplanlegger-fastapi.tfstate"
}
}

provider "azurerm" {
features {}
}