Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: clarify what the template creates #11

Merged
merged 1 commit into from
Dec 5, 2024
Merged
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
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@

[![SCM Compliance](https://scm-compliance-api.radix.equinor.com/repos/equinor/terraform-backend/badge)](https://scm-compliance-api.radix.equinor.com/repos/equinor/terraform-backend/badge)

Bicep template that creates an Azure Storage account to store Terraform state files.

[![Deploy to Azure](https://docs.microsoft.com/en-us/azure/templates/media/deploy-to-azure.svg)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fequinor%2Fterraform-backend%2Fmain%2Fazuredeploy.json)

Bicep template that creates an Azure Storage account to store Terraform state files:

- Creates a storage account with the specified name.
- Configures the storage account according to security recommendations.
- Creates a storage container `tfstate`.
- Grants access to the storage account for specified user, group and service principals.
- Creates a read-only lock to prevent changes to the storage account.

## Prerequisites

- Sign up for an [Azure account](https://azure.microsoft.com/en-us/pricing/purchase-options/azure-account).
Expand Down Expand Up @@ -34,6 +40,8 @@ Bicep template that creates an Azure Storage account to store Terraform state fi
az group create --name tfstate
```

Requires Azure role `Contributor` at subscription.

1. Create a deployment at resource group from the template file:

```console
Expand All @@ -46,6 +54,8 @@ Bicep template that creates an Azure Storage account to store Terraform state fi
az deployment group create --name terraform-backend --resource-group tfstate --template-uri https://raw.githubusercontent.com/equinor/terraform-backend/refs/heads/main/azuredeploy.json --parameters storageAccountName=<STORAGE_ACCOUNT_NAME>
```

Requires Azure role `Owner` at resource group.

### Configure Terraform backend

1. Create a Terraform configuration file `main.tf` and add the following backend configuration:
Expand Down
Loading