Skip to content

A sample repo demonstrating a http api deployment on azure over multi-az

License

Notifications You must be signed in to change notification settings

haripraghash/resilientazureapi

Repository files navigation

.github/workflows/deploy.yml

resilientazureapi

A sample repo demonstrating a http api deployment on azure over multi-az

Deployment view

Getting Started

Prerequisites

Installation

git clone https://github.com/haripraghash/resilientazureapi.git
cd resilientazureapi/infrastructure

Quickstart

There are different ways to authenticate with the Azure provider via Terraform. This example uses a Service Principal with a Client Secret to authenticate.

az login
az account set -s <subscription_id>
az ad sp create-for-rbac --role="Contributor" --scopes="/subscriptions/<your-subscription-id>"

export ARM_SUBSCRIPTION_ID=<subscription-id>
export ARM_CLIENT_ID=<app-id>
export ARM_CLIENT_SECRET=<password>
export ARM_TENANT_ID=<tenant-id>

terraform init
terraform validate
terraform plan -var-file="dev.tfvars"
terraform apply -var-file="dev.tfvars"

TF with remote state on Azure

terraform init \
      -backend-config="storage_account_name=<remote storage acc name>" \
      -backend-config="container_name=<remote container name>" \
      -backend-config="key=<BLOB FILE NAME>" \
      -backend-config="access_key=<storage access key>"

Github Actions config

Testing after deployment

The API sits behind an Azure Front Door. AFD is not deployed to save costs. AFD only allows requests those are compliant with RFC standards.

curl -d "" -X POST https://aa-eun-dev-availableapi-afd.azurefd.net/api/CreateTimestamp

API Documentation

API documention is exposed as swagger at https://aa-eun-dev-availableapi-afd.azurefd.net/api/swagger/ui

About

A sample repo demonstrating a http api deployment on azure over multi-az

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published