page_title | subcategory | description |
---|---|---|
Spectro Cloud Provider |
The Spectro Cloud provider provides resources to interact with the Spectro Cloud management API (whether SaaS or on-prem). |
The Spectro Cloud provider provides resources to interact with Palette and Palette VerteX through Infrastructure as code. The provider supports both SaaS and on-prem deployments of Palette and Palette VerteX.
Palette brings the managed Kubernetes experience to users' own unique enterprise Kubernetes infrastructure stacks deployed in any public cloud, or private cloud environments. Palette allows users to not have to trade-off between flexibility and manageability. Palette provides a platform-as-a-service experience to users by automating the lifecycle of multiple Kubernetes clusters based on user-defined Kubernetes infrastructure stacks.
To get started with Palette, sign up for an account here. Use your Palette API key to authenticate. For more details on the authentication, navigate to the authentication section.
Create a providers.tf
file with the following:
terraform {
required_providers {
spectrocloud = {
version = ">= 0.1"
source = "spectrocloud/spectrocloud"
}
}
}
provider "spectrocloud" {
host = var.sc_host # Spectro Cloud endpoint (defaults to api.spectrocloud.com)
api_key = var.sc_api_key # API key (or specify with SPECTROCLOUD_APIKEY env var)
project_name = var.sc_project_name # Project name (e.g: Default)
}
Copy terraform.template.tfvars
file to a terraform.tfvars
file and modify its content:
##################################################################################
# Spectro Cloud credentials
##################################################################################
sc_host = "{Enter Spectro Cloud API Host}" #e.g: api.spectrocloud.com (for SaaS)
sc_api_key = "{Enter Spectro Cloud API Key}"
sc_project_name = "{Enter Spectro Cloud Project Name}" #e.g: Default
Be sure to populate the sc_host
, sc_api_key
, and other terraform vars.
Copy one of the resource configuration files (e.g: spectrocloud_cluster_profile) from the Resources documentation. Be sure to specify all required parameters.
Next, run terraform using:
terraform init && terraform apply
Detailed schema definitions for each resource are listed in the Resources menu on the left.
For an end-to-end example of provisioning Spectro Cloud resources, visit: Spectro Cloud E2E Examples.
Credentials and other configurations can be provided through environment variables. The following environment variables are availabe.
SPECTROCLOUD_HOST
SPECTROCLOUD_APIKEY
SPECTROCLOUD_TRACE
SPECTROCLOUD_RETRY_ATTEMPTS
You can use an API key to authenticate with Spectro Cloud. Visit the User Management API Key documentation to learn more about Spectro Cloud API keys.
export SPECTROCLOUD_APIKEY=5b7aad.........
provider "spectrocloud" {}
Starting with Terraform v1.5.0 and later, you can use an import
block to import resources into your state file.
Each resource type has its own specific requirements for the import process. We recommend you refer to the documentation for each resource to better understand the exact format of the id
and any other required parameters.
The import
block specifies the resource you want to import and its unique identifier with the following structure:
import {
to = <resource>.<name>
id = "<unique_identifier>"
}
<resource>
: The type of the resource you are importing.<name>
: A name you assign to the resource within your Terraform configuration.<unique_identifier>
: The ID of the resource you are importing. This can include additional context if required.
The following examples showcase how to import a resource. Some resource requires the context to be specified during the import action. The context refers to the Palette scope. Allowed values are either project
or tenant
.
When importing resources that require additional context, the id
is followed by a context, separated by a colon.
import {
to = spectrocloud_cluster_aks.example
id = "example_id:project"
}
You can also import a resource using the Terraform CLI and the import
command.
terraform import spectrocloud_cluster_aks.example example_id:project
Specify' tenant' after the colon if you want to import a resource at the tenant scope.
import {
to = spectrocloud_cluster_aks.example
id = "example_id:tenant"
}
Example of importing a resource with the tenant context through the Terraform CLI.
terraform import spectrocloud_cluster_aks.example example_id:tenant
~> Ensure you have tenant admin access when importing a resource at the tenant scope.
For resources that do not require additional context, the id
is the only provided argument. The following is an example of a resource that does not require the context and only provides the ID.
import {
to = spectrocloud_cluster_profile.example
id = "id"
}
Below is an example of using the Terraform CLI and the import
command without specifying the context.
terraform import spectrocloud_cluster_profile.example id
For questions or issues with the provider, open up an issue in the provider GitHub discussion board.
api_key
(String, Sensitive) The Spectro Cloud API key. Can also be set with theSPECTROCLOUD_APIKEY
environment variable.host
(String) The Spectro Cloud API host url. Can also be set with theSPECTROCLOUD_HOST
environment variable. Defaults to https://api.spectrocloud.comignore_insecure_tls_error
(Boolean) Ignore insecure TLS errors for Spectro Cloud API endpoints. Defaults to false.project_name
(String) The Palette project the provider will target. If no value is provided, theDefault
Palette project is used. The default value isDefault
.retry_attempts
(Number) Number of retry attempts. Can also be set with theSPECTROCLOUD_RETRY_ATTEMPTS
environment variable. Defaults to 10.trace
(Boolean) Enable HTTP request tracing. Can also be set with theSPECTROCLOUD_TRACE
environment variable. To enable Terraform debug logging, setTF_LOG=DEBUG
. Visit the Terraform documentation to learn more about Terraform debugging.