Terraform module for Spotinst provider resource spotinst_ocean_gke_import
Installation of the Ocean controller is required by this resource. You can accomplish this by using the spotinst/terraform-ocean-kubernetes-controller module. The kubernetes provider will need to be initilaized before calling the ocean-controller module as follows:
module "ocean-gcp-k8s" {
source = "spotinst/ocean-gcp-k8s/spotinst"
...
}
# Data Resources for kubernetes provider
#initialize the kubernetes provider with access to the specific cluster
provider "kubernetes" {
host = "https://${data.google_container_cluster.gke.endpoint}"
token = data.google_client_config.default.access_token
cluster_ca_certificate = base64decode(data.google_container_cluster.gke.master_auth[0].cluster_ca_certificate)
}
### data resources ###
data "google_client_config" "default" {}
#Retrieve cluster info to get instance group URLS
data "google_container_cluster" "gke" {
name = var.cluster_name
location = var.location
}
##################
module "kubernetes-controller" {
source = "spotinst/kubernetes-controller/ocean"
# Credentials.
spotinst_account = var.spotinst_account
spotinst_token = var.spotinst_token
# Configuration.
cluster_identifier = module.ocean-gcp-k8s.ocean_controller_id
tolerations = []
}
~> You must configure the same cluster_identifier
both for the Ocean controller and for the spotinst_ocean_gke_import
resource.
NOTE: If you would like to create a programmatic user and token for use with the Ocean controller pod review this example.
#Create Ocean cluster - Import existing GKE cluster
module "ocean-gcp-k8s" {
source = "spotinst/ocean-gcp-k8s/spotinst"
# Credentials.
cluster_name = var.cluster_name
location = var.location
}
Name | Version |
---|---|
spotinst/spotinst | >= 1.96.0 |
hashicorp/gcp |
ocean-gcp-k8s
- Creates Ocean Clusterocean-gcp-k8s-vng
- (Optional) Add custom virtual node groups with custom configs Dococean-controller
- Create and installs Spot Ocean controller pod Doc
If you're new to Spot and want to get started, please checkout our Getting Started guide, available on the Spot Documentation website.
We use GitHub issues for tracking bugs and feature requests. Please use these community resources for getting help:
- Ask a question on Stack Overflow and tag it with terraform-spotinst.
- Join our Spot community on Slack.
- Open an issue.
Please see the contribution guidelines.