Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/paulbouwer/terraform-azure-quickstarts-samples
Reference Azure Terraform templates for the most common Azure deployment patterns.
https://github.com/paulbouwer/terraform-azure-quickstarts-samples
azure quickstarts terraform
Last synced: 2 months ago
JSON representation
Reference Azure Terraform templates for the most common Azure deployment patterns.
- Host: GitHub
- URL: https://github.com/paulbouwer/terraform-azure-quickstarts-samples
- Owner: paulbouwer
- License: mit
- Created: 2017-04-20T22:40:50.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-04-20T22:53:06.000Z (over 7 years ago)
- Last Synced: 2024-08-03T22:19:43.284Z (5 months ago)
- Topics: azure, quickstarts, terraform
- Language: HCL
- Homepage:
- Size: 29.3 KB
- Stars: 25
- Watchers: 3
- Forks: 47
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - paulbouwer/terraform-azure-quickstarts-samples - Reference Azure Terraform templates for the most common Azure deployment patterns. (HCL)
README
# Terraform - Azure Quickstarts
## Overview
Reference Azure Terraform templates for the most common Azure deployment patterns.
## Azure Authentication
The following arguments are required to authenticate against the AzureRM Provider:
- **subscription_id** - The subscription ID to use. It can also be sourced from the *ARM_SUBSCRIPTION_ID* environment variable.
- **client_id** - The client ID to use. It can also be sourced from the *ARM_CLIENT_ID* environment variable.
- **client_secret** - The client secret to use. It can also be sourced from the *ARM_CLIENT_SECRET* environment variable.
- **tenant_id** - The tenant ID to use. It can also be sourced from the *ARM_TENANT_ID* environment variable.
- **environment** - (Optional) The cloud environment to use. It can also be sourced from the *ARM_ENVIRONMENT* environment variable. Supported values are:
- public (default)
- usgovernment
- german
- china## Obtaining the Azure Authentication details
Authenticate using the [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli).
```
> az login
```If you have multiple Azure Subscriptions, their details will be returned by the `az login` command. Set the `SUBSCRIPTION_ID` environment variable to hold the value of the returned `id` field from the Subscription you want to use.
Set the Subscription that you want to use for this session.
```
> az account set --subscription="${SUBSCRIPTION_ID}"
```## Subscription and Tenant Details
Query the account to get the Subscription Id and Tenant Id values.
```
> az account show --query "{subscriptionId:id, tenantId:tenantId}"
```## Create Azure Credentials
It is advisable to create separate credentials for Terraform. These can be created as follows:
```
az ad sp create-for-rbac --role="Contributor" --scopes="/subscriptions/${SUBSCRIPTION_ID}"
```This will output your client_id, client_secret (password), sp_name, and tenant. Take note of the **client_id** and **client_secret**.
You can confirm your credentials (service principal) by opening a new shell and run the following commands substituting in the returned values for **sp_name**, **client_secret**, and **tenant**:
```
> az login --service-principal -u SP_NAME -p CLIENT_SECRET --tenant TENANT
> az vm list-sizes --location westus
```### Environment Variables
Set the following environment variables from the values you have obtained:
- ARM_SUBSCRIPTION_ID
- ARM_CLIENT_ID
- ARM_CLIENT_SECRET
- ARM_TENANT_ID