Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: updated hello-universe-tutorial for PDE #45

Merged
merged 2 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*.tfstate
*.tfstate.*
*.terraform.lock.hcl
*.terraform.tfvars


# Node Modules
Expand Down
70 changes: 35 additions & 35 deletions terraform/hello-universe-tf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,54 +5,54 @@ The code is intended to be used with the tutorial and as a result may not execut

## Requirements

| Name | Version |
|------|---------|
| <a name="requirement_spectrocloud"></a> [spectrocloud](#requirement\_spectrocloud) | >= 0.11.1 |
| Name | Version |
| --------------------------------------------------------------------------------- | --------- |
| <a name="requirement_spectrocloud"></a> [spectrocloud](#requirement_spectrocloud) | >= 0.21.6 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_spectrocloud"></a> [spectrocloud](#provider\_spectrocloud) | 0.11.1 |
| Name | Version |
| --------------------------------------------------------------------------- | ------- |
| <a name="provider_spectrocloud"></a> [spectrocloud](#provider_spectrocloud) | 0.21.6 |

## Modules

No modules.

## Resources

| Name | Type |
|------|------|
| [spectrocloud_application.scenario-1](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/application) | resource |
| [spectrocloud_application.scenario-2](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/application) | resource |
| [spectrocloud_application_profile.hello-universe-complete](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/application_profile) | resource |
| [spectrocloud_application_profile.hello-universe-ui](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/application_profile) | resource |
| [spectrocloud_virtual_cluster.cluster-1](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/virtual_cluster) | resource |
| [spectrocloud_virtual_cluster.cluster-2](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/virtual_cluster) | resource |
| [spectrocloud_cluster_group.beehive](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cluster_group) | data source |
| [spectrocloud_pack_simple.container_pack](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack_simple) | data source |
| [spectrocloud_pack_simple.postgres_service](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack_simple) | data source |
| [spectrocloud_registry.public_registry](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/registry) | data source |
| Name | Type |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
| [spectrocloud_application.scenario-1](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/application) | resource |
| [spectrocloud_application.scenario-2](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/application) | resource |
| [spectrocloud_application_profile.hello-universe-complete](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/application_profile) | resource |
| [spectrocloud_application_profile.hello-universe-ui](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/application_profile) | resource |
| [spectrocloud_virtual_cluster.cluster-1](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/virtual_cluster) | resource |
| [spectrocloud_virtual_cluster.cluster-2](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/virtual_cluster) | resource |
| [spectrocloud_cluster_group.cluster-group](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cluster_group) | data source |
| [spectrocloud_pack_simple.container_pack](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack_simple) | data source |
| [spectrocloud_pack_simple.postgres_service](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack_simple) | data source |
| [spectrocloud_registry.public_registry](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/registry) | data source |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_cluster-group-name"></a> [cluster-group-name](#input\_cluster-group-name) | The name of the cluster group to use for the virtual cluster | `string` | `"beehive"` | no |
| <a name="input_database-name"></a> [database-name](#input\_database-name) | The name of the database | `string` | `"counter"` | no |
| <a name="input_database-ssl-mode"></a> [database-ssl-mode](#input\_database-ssl-mode) | The SSL mode to use for the database | `string` | `"require"` | no |
| <a name="input_database-user"></a> [database-user](#input\_database-user) | The name of the database user | `string` | `"pguser"` | no |
| <a name="input_database-version"></a> [database-version](#input\_database-version) | The version of Postgres to use | `string` | `"14"` | no |
| <a name="input_enable-second-scenario"></a> [enable-second-scenario](#input\_enable-second-scenario) | Whether to enable the second scenario | `bool` | `false` | no |
| <a name="input_multiple_container_images"></a> [multiple\_container\_images](#input\_multiple\_container\_images) | The name of the container images to use for the virtual cluster in a multiple scenario | `map(string)` | <pre>{<br> "api": "ghcr.io/spectrocloud/hello-universe-api:1.0.8",<br> "ui": "ghcr.io/spectrocloud/hello-universe:1.0.12"<br>}</pre> | no |
| <a name="input_scenario-one-cluster-name"></a> [scenario-one-cluster-name](#input\_scenario-one-cluster-name) | The name of the cluster to use for the virtual cluster | `string` | `"cluster-1"` | no |
| <a name="input_scenario-two-cluster-name"></a> [scenario-two-cluster-name](#input\_scenario-two-cluster-name) | The name of the cluster to use for the virtual cluster in the second scenario | `string` | `"cluster-2"` | no |
| <a name="input_single-container-image"></a> [single-container-image](#input\_single-container-image) | The name of the container image to use for the virtual cluster in a single scenario | `string` | `"ghcr.io/spectrocloud/hello-universe:1.0.12"` | no |
| <a name="input_tags"></a> [tags](#input\_tags) | The default tags to apply to Palette resources | `list(string)` | <pre>[<br> "spectro-cloud-education",<br> "app:hello-universe",<br> "repository:spectrocloud/tutorials/",<br> "terraform_managed:true"<br>]</pre> | no |
| <a name="input_token"></a> [token](#input\_token) | The anonymous token to use for the Spectro Cloud API | `string` | `null` | no |
| Name | Description | Type | Default | Required |
| ------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------- | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------: |
| <a name="input_cluster-group-name"></a> [cluster-group-name](#input_cluster-group-name) | The name of the cluster group to use for the virtual cluster | `string` | n/a | yes |
| <a name="input_database-name"></a> [database-name](#input_database-name) | The name of the database | `string` | `"counter"` | no |
| <a name="input_database-ssl-mode"></a> [database-ssl-mode](#input_database-ssl-mode) | The SSL mode to use for the database | `string` | `"require"` | no |
| <a name="input_database-user"></a> [database-user](#input_database-user) | The name of the database user | `string` | `"pguser"` | no |
| <a name="input_database-version"></a> [database-version](#input_database-version) | The version of Postgres to use | `string` | `"14"` | no |
| <a name="input_enable-second-scenario"></a> [enable-second-scenario](#input_enable-second-scenario) | Whether to enable the second scenario | `bool` | `false` | no |
| <a name="input_multiple_container_images"></a> [multiple_container_images](#input_multiple_container_images) | The name of the container images to use for the virtual cluster in a multiple scenario | `map(string)` | <pre>{<br> "api": "ghcr.io/spectrocloud/hello-universe-api:1.0.8",<br> "ui": "ghcr.io/spectrocloud/hello-universe:1.0.12"<br>}</pre> | no |
| <a name="input_scenario-one-cluster-name"></a> [scenario-one-cluster-name](#input_scenario-one-cluster-name) | The name of the cluster to use for the virtual cluster | `string` | `"cluster-1"` | no |
| <a name="input_scenario-two-cluster-name"></a> [scenario-two-cluster-name](#input_scenario-two-cluster-name) | The name of the cluster to use for the virtual cluster in the second scenario | `string` | `"cluster-2"` | no |
| <a name="input_single-container-image"></a> [single-container-image](#input_single-container-image) | The name of the container image to use for the virtual cluster in a single scenario | `string` | `"ghcr.io/spectrocloud/hello-universe:1.0.12"` | no |
| <a name="input_tags"></a> [tags](#input_tags) | The default tags to apply to Palette resources | `list(string)` | <pre>[<br> "spectro-cloud-education",<br> "app:hello-universe",<br> "repository:spectrocloud/tutorials/",<br> "terraform_managed:true",<br> "tutorial:hello-universe-tf"<br>]</pre> | no |
| <a name="input_token"></a> [token](#input_token) | The anonymous token to use for the Spectro Cloud API | `string` | `"931A3B02-8DCC-543F-A1B2-69423D1A0B94"` | no |

## Outputs

| Name | Description |
|------|-------------|
| <a name="output_Advisory"></a> [Advisory](#output\_Advisory) | n/a |
| Name | Description |
| ----------------------------------------------------------- | ----------- |
| <a name="output_Advisory"></a> [Advisory](#output_Advisory) | n/a |
12 changes: 7 additions & 5 deletions terraform/hello-universe-tf/application.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ resource "spectrocloud_application" "scenario-1" {
application_profile_uid = spectrocloud_application_profile.hello-universe-ui.id

config {
cluster_name = spectrocloud_virtual_cluster.cluster-1.name
cluster_uid = spectrocloud_virtual_cluster.cluster-1.id
cluster_name = spectrocloud_virtual_cluster.cluster-1.name
cluster_uid = spectrocloud_virtual_cluster.cluster-1.id
cluster_context = "project"
}
tags = concat(var.tags, ["scenario-1"])

Expand All @@ -30,13 +31,14 @@ resource "spectrocloud_application" "scenario-2" {
application_profile_uid = spectrocloud_application_profile.hello-universe-complete[0].id

config {
cluster_name = spectrocloud_virtual_cluster.cluster-2[0].name
cluster_uid = spectrocloud_virtual_cluster.cluster-2[0].id
cluster_name = spectrocloud_virtual_cluster.cluster-2[0].name
cluster_uid = spectrocloud_virtual_cluster.cluster-2[0].id
cluster_context = "project"
}
tags = concat(var.tags, ["scenario-2"])

timeouts {
create = "10m"
update = "10m"
}
}
}
6 changes: 3 additions & 3 deletions terraform/hello-universe-tf/data.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Copyright (c) Spectro Cloud
# SPDX-License-Identifier: Apache-2.0

data "spectrocloud_cluster_group" "beehive" {
data "spectrocloud_cluster_group" "cluster-group" {
name = var.cluster-group-name
context = "system"
context = "project"
}

data "spectrocloud_registry" "public_registry" {
Expand All @@ -22,4 +22,4 @@ data "spectrocloud_pack_simple" "postgres_service" {
type = "operator-instance"
version = "1.8.2"
registry_uid = data.spectrocloud_registry.public_registry.id
}
}
9 changes: 4 additions & 5 deletions terraform/hello-universe-tf/inputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

variable "cluster-group-name" {
type = string
default = "beehive"
description = "The name of the cluster group to use for the virtual cluster"
}

Expand All @@ -22,15 +21,15 @@ variable "scenario-two-cluster-name" {
variable "single-container-image" {
type = string
description = "The name of the container image to use for the virtual cluster in a single scenario"
default = "ghcr.io/spectrocloud/hello-universe:1.0.12"
default = "ghcr.io/spectrocloud/hello-universe:1.1.3"
}

variable "multiple_container_images" {
type = map(string)
description = "The name of the container images to use for the virtual cluster in a multiple scenario"
default = {
ui = "ghcr.io/spectrocloud/hello-universe:1.0.12"
api = "ghcr.io/spectrocloud/hello-universe-api:1.0.8"
ui = "ghcr.io/spectrocloud/hello-universe:1.1.3"
api = "ghcr.io/spectrocloud/hello-universe-api:1.0.12"
}
}

Expand Down Expand Up @@ -80,4 +79,4 @@ variable "tags" {
"terraform_managed:true",
"tutorial:hello-universe-tf"
]
}
}
4 changes: 2 additions & 2 deletions terraform/hello-universe-tf/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
terraform {
required_providers {
spectrocloud = {
version = ">= 0.11.1"
version = ">= 0.21.6"
source = "spectrocloud/spectrocloud"
}
}
Expand All @@ -13,4 +13,4 @@ terraform {
provider "spectrocloud" {
// API key set though the environment variable SPECTROCLOUD_APIKEY
project_name = "Default"
}
}
6 changes: 3 additions & 3 deletions terraform/hello-universe-tf/virutal-clusters.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# ##########################################
resource "spectrocloud_virtual_cluster" "cluster-1" {
name = var.scenario-one-cluster-name
cluster_group_uid = data.spectrocloud_cluster_group.beehive.id
cluster_group_uid = data.spectrocloud_cluster_group.cluster-group.id

resources {
max_cpu = 4
Expand All @@ -33,7 +33,7 @@ resource "spectrocloud_virtual_cluster" "cluster-2" {
count = var.enable-second-scenario == true ? 1 : 0

name = var.scenario-two-cluster-name
cluster_group_uid = data.spectrocloud_cluster_group.beehive.id
cluster_group_uid = data.spectrocloud_cluster_group.cluster-group.id

resources {
max_cpu = 8
Expand All @@ -50,4 +50,4 @@ resource "spectrocloud_virtual_cluster" "cluster-2" {
create = "15m"
delete = "15m"
}
}
}
Loading