Skip to content
Snippets Groups Projects
Commit 29ced936 authored by František Řezníček's avatar František Řezníček
Browse files

feat: g1 to g2 migration IaaS code

parent d7c963a6
No related branches found
No related tags found
No related merge requests found
# e-INFRA CZ G1 to G2 cloud migration resources
You can find here G1 to G2 migration resources in [terraform](./general/terraform/) and shell [commandline](./general/commandline/).
\ No newline at end of file
......@@ -26,3 +26,7 @@ How does the basic infrastructure looks like?
* public floating ip address
![basic-infrastructure.png](/clouds/common/pictures/basic-infrastructure.png)
## G1 and G2 cloud differences
Inspect ([g1-prod-brno.sh.inc](./g1-prod-brno.sh.inc), [g2-prod-brno.sh.inc](./g2-prod-brno.sh.inc), [g2-prod-ostrava.sh.inc](./g2-prod-ostrava.sh.inc)) include shell files to see what needs to be changed.
\ No newline at end of file
......@@ -27,30 +27,18 @@ Terraform demonstrates [how to configure VM servers on creation with cloud-init]
e-INFRA.CZ OpenStack cloud distinguishes between two project types: personal and group
([more the topic](https://docs.e-infra.cz/compute/openstack/technical-reference/brno-site/get-access/#personal-project)).
Terraform demo code with additional variable file [`personal-projects.tfvars`](./personal-projects.tfvars) shows how to support both project types i.e. how to parametrize infrastructure definition with minimal code duplications.
There is thin terraform wrapper [`terraform.sh`](./terraform.sh) abstracting the fact which project type you are on. It is not necessary to use the [`terraform.sh`](./terraform.sh) wrapper when you keep in mind that additional terraform variables file [`personal-projects.tfvars`](./personal-projects.tfvars) has to be passed at plan step when you are on personal project.
Terraform demo code comes with terraform variable files (for instance [`personal-projects.tfvars`](./personal-projects.tfvars)) which show what has to be tuned for particular cloud and project type.
## Using the terraform demo
1. Clone the repository.
1. Load you OpenStack application credentials to environment variables `source project_openrc.sh.inc`
1. Override any infrastructure variables in [main.tf](main.tf) file if needed. Full set of variables can be found in [modules/common/variables.tf](modules/common/variables.tf).
1. In the [terraform root directory](/clouds/g2/ostrava/general/terraform) run following commands to initiate and validate environment
* `./terraform.sh validate-tools`
* `./terraform.sh detect-cloud`
* `./terraform.sh detect-project`
* `./terraform.sh init`
* `./terraform.sh validate`
1. In the [same directory](/clouds/g2/ostrava/general/terraform) run commands to deploy cloud infrastructure
* `./terraform.sh plan --out plan`
* `./terraform.sh apply plan`
1. Once you need to change the infrastructure, first modify the infrastructure declaration and repeat above steps to deploy changes.
1. Cloud resources can be deleted with `./terraform.sh destroy`.
> You may use terraform directly without the [`terraform.sh`](./terraform.sh) wrapper, but then keep in your mind that just for personal project type you should pass additional variable file [`personal-projects.tfvars`](./personal-projects.tfvars) at plan step (i.e. `terraform plan --out personal-project.plan --var-file=personal-projects.tfvars`)
Detailed terminal transcripts show how to run terraform demo inside personal project ([with](./terraform-2tier_public_bastion_private_vm_farm-personal-project-wrapper.log) / [without the wrapper](./terraform-2tier_public_bastion_private_vm_farm-personal-project-no-wrapper.log)) as well as under group project([with](./terraform-2tier_public_bastion_private_vm_farm-group-project-wrapper.log) / [without the wrapper](./terraform-2tier_public_bastion_private_vm_farm-group-project-no-wrapper.log)).
1. Override any infrastructure variables in [main.tf](main.tf) file if needed. Full set of variables can be found in [modules/common/variables.tf](/clouds/common/general/terraform/modules/common/variables.tf).
1. In the [terraform root directory](/clouds/g2/ostrava/general/terraform) run following command `./terraform-demo.sh <cloud-environment-name>` (for instance `g2-prod-brno`)
Detailed terminal transcripts can be found in [logs/](./logs/) subdirectory..
## Access to the VM nodes
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment