Getting Started with Kosmos Terraform Provider

Download Kosmos Terraform provider

Download the appropriate file for your OS and architecture. The following are currently supported:

Note: Access to these files is only allowed from certain source networks (Suwon office, Joyent VPN, SPC Network).

Extract the files terraform-provider-kosmos to your ~/Downloads folder.

Create the appropriate directory to store the provider

Linux

export RELEASE=0.14.0
mkdir -p ~/.terraform.d/plugins/local/samsung/kosmos/${RELEASE}/linux_amd64
cp terraform-provider-kosmos ~/.terraform.d/plugins/local/samsung/kosmos/${RELEASE}/linux_amd64/terraform-provider-kosmos_v${RELEASE}

macOS

export RELEASE=0.14.0
mkdir -p ~/.terraform.d/plugins/local/samsung/kosmos/${RELEASE}/darwin_arm64
cp terraform-provider-kosmos ~/.terraform.d/plugins/local/samsung/kosmos/${RELEASE}/darwin_arm64/terraform-provider-kosmos_v${RELEASE}

Important: macOS Code Signing

macOS Gatekeeper blocks unsigned binaries. You must ad-hoc sign the provider after copying:

codesign -s - ~/.terraform.d/plugins/local/samsung/kosmos/${RELEASE}/darwin_arm64/terraform-provider-kosmos_v${RELEASE}

Without this step, terraform plan will fail with “Failed to read any lines from plugin’s stdout”.

Windows

$RELEASE="0.14.0"
New-Item $ENV:APPDATA\terraform.d\plugins\local\samsung\kosmos\${RELEASE}\ -Name "windows_amd64" -ItemType "directory"
Move-Item terraform-provider-kosmos.exe $ENV:APPDATA\terraform.d\plugins\local\samsung\kosmos\${RELEASE}\windows_amd64\terraform-provider-kosmos_v${RELEASE}.exe

Create a main.tf that references the provider

terraform {
  required_providers {
    kosmos = {
      source = "local/samsung/kosmos"
      version = ">= 0.14.0"
    }
  }
}

provider "kosmos" {
  accesskey = ""
  endpoint = "https://console.kosmos.spcplatform.com"
}

resource "kosmos_fleets" "fleet-1" {
  name = "fleet-1"
}

Optional

  • accesskey (String): Access key for Kosmos API. May also be provided via KOSMOS_ACCESS_KEY environment variable.

  • endpoint (String): Endpoint for Kosmos API. May also be provided via KOSMOS_ENDPOINT environment variable.

  • insecure (Boolean): True/False, to skip TLS verification.

Initialize Terraform

terraform init

Verify the provider version

terraform version

Output:

Terraform v0.14.0
on linux_amd64
+ provider local/samsung/kosmos v0.14.0

Next Steps

Now that you have the Kosmos Terraform provider installed, you can create Kubernetes clusters:

Cloud ProviderGuide
Amazon Web Services (EKS)Create EKS Cluster using Terraform
Google Cloud Platform (GKE)Create GKE Cluster using Terraform
Microsoft Azure (AKS)Create AKS Cluster using Terraform
Samsung Private Cloud (MKS)Create MKS Cluster using Terraform

For all available Terraform modules and downloads, see the Terraform Artifacts page.

Edit this page on GitHub