Skip to content

michalchecinski/terraform-azure-functions-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Azure Functions Python and Terraform

Build Status

📝 Overview

This is my pet project using Terraform and python with Azure Functions. I want to try out new technologies and tools that I don't use on a daily basis in my job.

👩‍💻 Technologies

As you may read in the title of this project uses mainly two things: Azure Functions to host Python functions and Terraform as an IaC (Infrastructure as a Code) tool.

🚀 CI/CD

CI/CD is based on the Azure Pipelines. You can find pipeline definitions in the azure-pipelines folder in this repo. That folder contains:

  • PR check pipeline - for PR validation purposes. Azure DevOps view can be found here: PR check pipeline link;
  • deployment pipeline - for CD of this project to the Azure environment. Azure DevOps view can be found here: CD pipeline link

Also CD pipeline uses Azure Pipeline Environments to report status of deployment: DevEnv deployment view in Azure DevOps Pipelines

⚙ Project Setup

If you want to setup the project on your own computer and try to play with it locally, you need to do a couple of things:

  1. Clone this repo to your machine.
  2. Install terraform and az cli on your machine.
  3. Run az login command and login to your Azure account.
  4. Create a Azure Storage Account for Terraform state using tfstate_storage_setup.sh script.
  5. Set the ARM_ACCESS_KEY environment variable to the storage access key that you got from script output from the previous point of this guide.
  6. Change a name of the storage in the main.tf file in the 9th line from tfstate6671 to a name that you got from script output from the 3rd point of this guide.
  7. Go to a src/infrastructure folder, eg. cd src/infrastructure.
  8. Run a couple of Terraform commands:
terraform init
terraform plan # This will output the changes on the Azure env that terraform will make
terrafrom apply -auto-approve

Now you have prepared the Azure environment to start hacking.

Next thing is to publish Azure Functions to Azure Function App that was created. For this I highly recommend using VS Code with Azure functions extension as this is the easiest approach. You can stick to this Microsoft Tutorial: Create and deploy serverless Azure Functions in Python with Visual Studio Code.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published