Skip to content

Commit

Permalink
Add example and documentation on using remote state
Browse files Browse the repository at this point in the history
  • Loading branch information
frittentheke committed Mar 13, 2022
1 parent d2655be commit a1c8631
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ Ensure that the `OS_CLOUD` environment variable is unset otherwise the value of
Now we can verify everything with the `plan` step: `terraform plan` if everything looks fine just apply the changes: `terraform apply`
After the creation of the instances run `./scripts/check_connection.sh` to check that all instances are reachable with the ssh key.


### Remote state

Terraform state is stored locally by default. The `main.tf` contains the required backend config snippet to enable remote state with a single command.
This could be useful if you have to hand over the training environment to someone else.

## Sending Mails

Ensure that the [Gmail API](https://developers.google.com/gmail/api/quickstart/python#step_1_turn_on_the) is activated.
Expand Down
13 changes: 13 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@ provider "openstack" {
cloud = var.cloud
}

## REMOTE STATE
# terraform {
# backend "swift" {}
# }

# Run this to set the required backend options:
#-------------------------------------------------
# terraform init \
# -backend-config="cloud=training-lf-kubernetes" \
# -backend-config="container=training-lf-kubernetes-terraform-state" \
# -backend-config="archive_container=training-lf-kubernetes-terraform-state-archive" \
# -backend-config="state_name=terraform-$TRAINER_NAME.stat"

module "student_workspace" {
source = "./modules/student_workspace"
students = var.students
Expand Down

0 comments on commit a1c8631

Please sign in to comment.