All infrastructure deployment within kaos is done via Terraform Infrastructure as Code (IaC).
Terraform enables you to safely and predictably create, change, and improve infrastructure. It is an open source tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned. More detailed information can be found here.
kaos can be deployed in the following environments.
The installation of Terraform can be followed based on a variety of platforms (Windows, macOS, Linux). A successful installation will yield the following response.
$ terraform
Usage: terraform [--version] [--help] <command> [args]
The available commands for execution are listed below.
The most common, useful commands are shown first, followed by
less common or more advanced commands. If you're just getting
started with Terraform, stick with the common commands. For the
other commands, please read the help and docs before usage.
Common commands:
apply Builds or changes infrastructure
console Interactive console for Terraform interpolations
# ...
The most crucial aspect of running Terraform is its state file. Terraform uses this state to create plans and make changes to your infrastructure. Prior to any operation, Terraform does a refresh to update the state with the real infrastructure.
$ terraform init
Initializing modules...
Initializing the backend...
Initializing provider plugins...
Terraform has been successfully initialized!
You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.
Deployment within Terraform is run in two stages.
-
terraform plan
- This command allows creation of an execution plan. Terraform performs a refresh, unless explicitly disabled, and then determines what actions are necessary to achieve the desired state specified in the configuration files. This command is a convenient way to check whether the execution plan for a set of changes matches your expectations without making any changes to real resources or to the state.
-
terraform apply
- This command applies required changes to reach the desired state of the configuration, or the pre-determined set of actions generated by a terraform plan execution plan.
The entire infrastructure can be deployed by running the following.
$ terraform plan
$ terraform apply
Individual parts of the total infrastructure can be deployed with targets. Detailed explanation can be found here.
$ terraform plan -target <resource_name>
$ terraform apply -target <resource_name>