Skip to content

Commit

Permalink
Update example
Browse files Browse the repository at this point in the history
  • Loading branch information
saamalik committed Jan 17, 2021
1 parent e5f5e83 commit 366fc95
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 8 deletions.
20 changes: 20 additions & 0 deletions examples/resources/spectrocloud_cluster_profile/providers.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
terraform {
required_providers {
spectrocloud = {
version = ">= 0.1"
source = "spectrocloud/spectrocloud"
}
}
}

variable "sc_host" {}
variable "sc_username" {}
variable "sc_password" {}
variable "sc_project_name" {}

provider "spectrocloud" {
host = var.sc_host
username = var.sc_username
password = var.sc_password
project_name = var.sc_project_name
}
101 changes: 93 additions & 8 deletions examples/resources/spectrocloud_cluster_profile/resource.tf
Original file line number Diff line number Diff line change
@@ -1,14 +1,72 @@
resource "spectrocloud_cluster_profile" "cp-addon-azure" {
name = "cp-basic"
# If looking up a cluster profile instead of creating a new one
# data "spectrocloud_cluster_profile" "profile" {
# # id = <uid>
# name = var.cluster_cluster_profile_name
# }

# # Example of a Basic add-on profile
# resource "spectrocloud_cluster_profile" "cp-addon-vsphere" {
# name = "cp-basic"
# description = "basic cp"
# cloud = "vsphere"
# type = "add-on"
# pack {
# name = "spectro-byo-manifest"
# tag = "1.0.x"
# uid = "5faad584f244cfe0b98cf489"
# # layer = ""
# values = <<-EOT
# manifests:
# byo-manifest:
# contents: |
# # Add manifests here
# apiVersion: v1
# kind: Namespace
# metadata:
# labels:
# app: wordpress
# app3: wordpress3
# name: wordpress
# EOT
# }
# }


data "spectrocloud_pack" "byom" {
name = "spectro-byo-manifest"
# version = "1.0.x"
}

data "spectrocloud_pack" "csi" {
name = "csi-vsphere-volume"
# version = "1.0.x"
}

data "spectrocloud_pack" "cni" {
name = "cni-calico"
version = "3.16.0"
}

data "spectrocloud_pack" "k8s" {
name = "kubernetes"
version = "1.18.14"
}

data "spectrocloud_pack" "ubuntu" {
name = "ubuntu-vsphere"
# version = "1.0.x"
}

resource "spectrocloud_cluster_profile" "profile" {
name = "vsphere-picard-3"
description = "basic cp"
cloud = "azure"
type = "add-on"
cloud = "vsphere"
type = "cluster"

pack {
name = "spectro-byo-manifest"
tag = "1.0.x"
uid = "5faad584f244cfe0b98cf489"
# layer = ""
name = "spectro-byo-manifest"
tag = "1.0.x"
uid = data.spectrocloud_pack.byom.id
values = <<-EOT
manifests:
byo-manifest:
Expand All @@ -24,4 +82,31 @@ resource "spectrocloud_cluster_profile" "cp-addon-azure" {
EOT
}

pack {
name = "csi-vsphere-volume"
tag = "1.0.x"
uid = data.spectrocloud_pack.csi.id
values = data.spectrocloud_pack.csi.values
}

pack {
name = "cni-calico"
tag = "3.16.x"
uid = data.spectrocloud_pack.cni.id
values = data.spectrocloud_pack.cni.values
}

pack {
name = "kubernetes"
tag = "1.18.x"
uid = data.spectrocloud_pack.k8s.id
values = data.spectrocloud_pack.k8s.values
}

pack {
name = "ubuntu-vsphere"
tag = "LTS__18.4.x"
uid = data.spectrocloud_pack.ubuntu.id
values = data.spectrocloud_pack.ubuntu.values
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sc_host = "{enter host}"
sc_username = "{enter username}"
sc_password = "{enter password}"
sc_project_name = "{enter Project}"

0 comments on commit 366fc95

Please sign in to comment.