SHIFT-WIKI - Sjoerd Hooft's InFormation Technology
This WIKI is my personal documentation blog. Please enjoy it and feel free to reach out through blue sky if you have a question, remark, improvement or observation. See below for the latest additions, or use the search or tags to browse for content.
Terraform in Azure DevOps
Summary: On this page I'll show you how to use an azure devops pipeline to deploy azure resources using terraform.
Date: 2 February 2025
The topics covered are:
- Using a service principal to authenticate to Azure
- Setting up a remote backend for your tfstate file
- Using a federated service principal to authenticate to Azure
- Using the Azure DevOps Pipeline Extension
Terraform in Azure Cloud Shell
Summary: In this post I'll show you a few basic terraform commands and configuration files. If you're trying to learn terraform on azure this is an easy and fast tutorial to get started.
Date: 11 January 2025
We'll cover the following topics:
- Setup the main.tf file with the azurerm provider configuration and the resource group
- We will create terraform files for a vnet and a subnet
- We will create a vm with a ip address in the subnet
- We will have terraform create a random password for the vm
- We will figure out where to find the password
- At the end we will manually create an additional subnet and have the vm use it
In the end we will use terraform destroy
to remove all resources.
Terraform AWS WebServer
Summary: This is a terraform deployment for an EC2 instance with a security group and the loading of user data.
Date: Around 2021
Refactor: 26 January 2025: Checked links and formatting.
- Create a EC2 web server and output the public IP
- Create a security group for the webserver opening port 80 and 443
- Run a script (user data) on the webserver
Terraform and AWS IAM
Summary: IAM policies can be troublesome to configure with terrafom, but luckily you can use the AWS web console to configure the policy with all the permissions you need. Read on to find out how to deploy them with terraform.
Date: Around 2019
Refactor: 13 January 2025: Checked links and formatting.
When working with policies it's best to create the JSON policy file using the console. You can go to IAM, go to policies, create a policy, configure it, and when you've added all the permissions you need, go to the JSON tab.
We'll use this one as an example, a policy that allows all EC2 actions:
{ "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": "ec2:*", "Resource": "*" } ] }