README.md 1.26 KB
Newer Older
Vibhuti Sharma [Microsoft]'s avatar
Vibhuti Sharma [Microsoft] committed
1
2
# Required environment variables
export ARM_TENANT_ID=""
Vibhuti Sharma [Microsoft]'s avatar
nit    
Vibhuti Sharma [Microsoft] committed
3

Vibhuti Sharma [Microsoft]'s avatar
Vibhuti Sharma [Microsoft] committed
4
5
6
7
export ARM_SUBSCRIPTION_ID=""

## Terraform-Principal
export ARM_CLIENT_ID=""
Vibhuti Sharma [Microsoft]'s avatar
nit    
Vibhuti Sharma [Microsoft] committed
8

Vibhuti Sharma [Microsoft]'s avatar
Vibhuti Sharma [Microsoft] committed
9
10
11
12
export ARM_CLIENT_SECRET=""

## Terraform State Storage Account Key
export TF_VAR_remote_state_account=""
Vibhuti Sharma [Microsoft]'s avatar
nit    
Vibhuti Sharma [Microsoft] committed
13

Vibhuti Sharma [Microsoft]'s avatar
Vibhuti Sharma [Microsoft] committed
14
export TF_VAR_remote_state_container=""
Vibhuti Sharma [Microsoft]'s avatar
nit    
Vibhuti Sharma [Microsoft] committed
15

Vibhuti Sharma [Microsoft]'s avatar
Vibhuti Sharma [Microsoft] committed
16
17
18
19
20
21
22
export ARM_ACCESS_KEY=""

# This configures terraform to leverage a remote backend that will help you and your team keep consistent state
terraform init -backend-config "storage_account_name=${TF_VAR_remote_state_account}" -backend-config "container_name=${TF_VAR_remote_state_container}"

# Execute the following commands to set up your terraform workspace
TF_WORKSPACE="<name>-mr-workspace"
Vibhuti Sharma [Microsoft]'s avatar
nit    
Vibhuti Sharma [Microsoft] committed
23

Vibhuti Sharma [Microsoft]'s avatar
Vibhuti Sharma [Microsoft] committed
24
25
terraform workspace new $TF_WORKSPACE || terraform workspace select $TF_WORKSPACE

Vibhuti Sharma [Microsoft]'s avatar
Vibhuti Sharma [Microsoft] committed
26
27
> Manually create a custom variable file to use for template configuration and edit as appropriate and desired.

Vibhuti Sharma [Microsoft]'s avatar
Vibhuti Sharma [Microsoft] committed
28
In the custom.tfvars file manually configure your specific settings by looking at the terraform.tfvars file for reference.
Vibhuti Sharma [Microsoft]'s avatar
Vibhuti Sharma [Microsoft] committed
29
30
31
32
33
34
35
36
37
38
39
40
41

# See what terraform will try to deploy without actually deploying
terraform plan -var-file custom.tfvars

# Execute a deployment
terraform apply -var-file custom.tfvars

# Destroy resources and tear down deployment. Only do this if you want to destroy your deployment.
terraform destroy