Skip to content

Commit

Permalink
Merge pull request #1153 from weaveworks/docs-add-nov29
Browse files Browse the repository at this point in the history
Adds a starter docs page on Azure
  • Loading branch information
Lauri Apple authored Nov 29, 2023
2 parents 7b76782 + 2f5e10a commit 5cf81dd
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions docs/use_tf_controller/with-azure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
## Use TF-Controller with Azure

This content was [provided](https://github.com/weaveworks/tf-controller/issues/561) by users [@mingmingshiliyu](https://github.com/mingmingshiliyu) and [@maciekdude](https://github.com/maciekdude).

Use the OIDC flag and explicitly point to the token. Due to a bug in AzureRM 3.44.x, use version 3.47.x or later.

Set env variables on the runner pod:

```
- name: ARM_USE_OIDC
value: "true"
- name: ARM_OIDC_TOKEN_FILE_PATH
value: "/var/run/secrets/azure/tokens/azure-identity-token"
```

Example yaml:

```yaml
apiVersion: infra.contrib.fluxcd.io/v1alpha1
kind: Terraform
metadata:
name: terraformhello
namespace: default
spec:
tfstate:
forceUnlock: auto
backendConfig:
customConfiguration: |
backend "azurerm" {
resource_group_name = "l"
storage_account_name = ""
container_name = "tfstate"
key = "helloworld.tfstate"
use_oidc = true
}
interval: 1m
serviceAccountName: service_account_registered_in_aad
approvePlan: auto
destroy: true
path: ./tests/fixture
sourceRef:
kind: GitRepository
name: terraformhello
namespace: flux-system
runnerPodTemplate:
spec:
image: azure_cli_runner.xxx
env:
- name: ARM_USE_OIDC
value: "true"
- name: ARM_SUBSCRIPTION_ID
value: ""
- name: ARM_TENANT_ID
value: ""
- name: ARM_CLIENT_ID
value: ""
- name: ARM_OIDC_TOKEN_FILE_PATH
value: "/var/run/secrets/azure/tokens/azure-identity-token"
```
Import existing resources to a tfstate file stored on a storage account.

0 comments on commit 5cf81dd

Please sign in to comment.