Skip to content

Commit

Permalink
update terraform provider from local to backend azure
Browse files Browse the repository at this point in the history
  • Loading branch information
anaiscalza committed Jan 19, 2024
1 parent ef95457 commit e2eead9
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
17 changes: 16 additions & 1 deletion deployement/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,18 @@ jq
- export $(grep -v '^#' .env | xargs)

# ENABLE AN AZURE STORAGE TFSTATE

- RESOURCE_GROUP_NAME=rg-rtw-tfstate
- CONTAINER_NAME=rtw-tfstate
- STORAGE_ACCOUNT_NAME=rtwtfstate18005
- az group create --name $RESOURCE_GROUP_NAME --location westus3
- az storage account create --resource-group $RESOURCE_GROUP_NAME --name $STORAGE_ACCOUNT_NAME --sku Standard_LRS --encryption-services blob
- az storage container create --name $CONTAINER_NAME --account-name $STORAGE_ACCOUNT_NAME
- ACCOUNT_KEY=$(az storage account keys list --resource-group $RESOURCE_GROUP_NAME --account-name $STORAGE_ACCOUNT_NAME --query '[0].value' -o tsv)
- export ARM_ACCESS_KEY=$ACCOUNT_KEY

# FOR DEPLOYING DATASTORE
Already actions secret:
- ARM_ACCESS_KEY (necessary for terraform)
- ACCESS_TOKEN
- ORG_NAME
- REPO_NAME
Expand Down Expand Up @@ -66,6 +74,9 @@ Already actions secret:


# FOR DEPLOYING AKS
Already actions secret:
- ARM_ACCESS_KEY (necessary for terraform)

- az login

- echo -n $ACR_ID > ./acr_id.txt
Expand Down Expand Up @@ -109,6 +120,7 @@ Already actions secret:
- FUSIONAUTH_DATABASE_USERNAME
- FUSIONAUTH_DATABASE_PASSWORD

- az login
- az aks get-credentials --resource-group $AKS_RESOURCE_GROUP_NAME --name $KUBERNETES_CLUSTER_NAME
- kubectl get nodes
- DATABASE_URL=jdbc:postgresql://${POSTGRESQL_FQDN}:5432/fusionauth
Expand All @@ -126,6 +138,7 @@ Already actions secret:
Already actions secret:
- default_clientSecret

- az login
- az aks get-credentials --resource-group $AKS_RESOURCE_GROUP_NAME --name $KUBERNETES_CLUSTER_NAME
- kubectl get nodes

Expand Down Expand Up @@ -158,6 +171,7 @@ Already actions secret:
- kubectl apply -f ingress.yaml

# K8S services update after image only (execpt ingress and fusionauth)
- az login
- az aks get-credentials --resource-group $AKS_RESOURCE_GROUP_NAME --name $KUBERNETES_CLUSTER_NAME
- kubectl get nodes

Expand All @@ -175,6 +189,7 @@ Already actions secret:
- kubectl rollout restart deploy servicename

# K8S services update after K8S yaml file update (execpt ingress and fusionauth)
- az login
- az aks get-credentials --resource-group $AKS_RESOURCE_GROUP_NAME --name $KUBERNETES_CLUSTER_NAME
- kubectl get nodes

Expand Down
8 changes: 8 additions & 0 deletions deployement/aks-deployment/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ terraform {
version = "0.9.1"
}
}

backend "azurerm" {
resource_group_name = "rg-rtw-tfstate"
storage_account_name = "rtwtfstate18005"
container_name = "rtw-tfstate"
key = "terraform.tfstate"
}

}

provider "azurerm" {
Expand Down
6 changes: 6 additions & 0 deletions deployement/datastore-deployment/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ terraform {
version = "0.9.1"
}
}
backend "azurerm" {
resource_group_name = "rg-rtw-tfstate"
storage_account_name = "rtwtfstate18005"
container_name = "rtw-tfstate"
key = "datastore.tfstate"
}
}

provider "azurerm" {
Expand Down

0 comments on commit e2eead9

Please sign in to comment.