Terraform is an infrastructure-as-code (IaC) tool, created by HashiCorp Terraform by HashiCorp, that allows users to define and manage their cloud and on-prem resources in declarative, human-readable configuration files. These files can be versioned, reused or shared.
Terraform creates and manages resources through the APIs.
To be able to use terraform provider, Terraform must be installed on the user’s computer. Installation guide for various operating systems can be found under the official HashiCorp installation page.
The STACKIT Terraform Provider offers developers the possibility to manage their STACKIT infrastructure using Terraform.
You can find it here:
To install this provider:
Copy and paste this code into your Terraform configuration:
terraform {
required_providers {
stackit = {
source = "stackitcloud/stackit"
version = "x.x.x"
}
}
}
provider "stackit" {
# Configuration options
}
CODE
- Replace the version in
version = "x.x.x"
with the latest one. - Run
terraform init
.
The resources are the key components to define the details of a resource and map them to the API operations. STACKIT Terraform Provider, supports a lot of different resources. A full list of supported resources can be found in this link.
A typical resource definition looks like following:
resource "stackit_ske_cluster" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example"
kubernetes_version = "x.x"
node_pools = [
{
name = "np-example"
machine_type = "x.x"
os_version = "x.x.x"
minimum = "2"
maximum = "3"
availability_zones = ["eu01-3"]
}
]
maintenance = {
enable_kubernetes_version_updates = true
enable_machine_image_version_updates = true
start = "01:00:00Z"
end = "02:00:00Z"
}
}
CODE
Check the examples for more details.