This is just a quickstart for using Terraform on OpenStack-based cloud of Mail.Ru Cloud Solutions. It performs the following actions:
- Create network and subnet
- Create router
- Create keypair
- Create security group
- Create VM instance with non-ephemeral disk
- Apply cloud config which creates a new user and installs nginx
- Assign Floating IP to the instance
- Execute bootstrap scrpits during instance provisioning over ssh
Optionally, you can enable cloud config by uncommenting corresponding line in the main.tf
Name | Description |
---|---|
README.md | This file, obviously |
demo_rsa, demo_rsa.pub | SSH keypair, only to be used for this demonstration |
terraform.tf | The terraform manifest with all defined resources |
variables.tf | Variables that you can change or set default values |
terraform-openrc.sh | should be run initially to setup username, tenant and password |
terraform.tfstate, terraform.tfstate.backup | tfstate and tfstate.backup so that terraform can keep track on changes |
- Make sure you have installed Terraform
- Get your OpenStack API credentials by requesting them at https://help.mail.ru/mcs/supporthttps://help.mail.ru/mcs/support)
- Run the terraform-openrc.sh script. It will ask about username, tenant and password.
- Then run "terraform plan". If that fails, make sure you've used the correct credentials (run terraform-openrc.sh again)
- Last, run "terraform apply" to install all the infrastructure, described in the terraform.tf
$ ./terraform-openrc.sh
[...]
$ terraform init (if it is the first time you run terraform)
$ terraform plan
$ terraform apply
You should now have a fully working environment with everything described in the beginning of this README.