From d525fc61e4af07f37dd90778d935bea92eb2bab4 Mon Sep 17 00:00:00 2001 From: Lenny Chen <55669665+lennessyy@users.noreply.github.com> Date: Tue, 14 Nov 2023 08:31:35 -0800 Subject: [PATCH] fix: added new tools such as oras and awscli, and script to check for and delete packer cache (#24) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: added script to check for and delete packer cache * fix: added new tools such as oras and awscli, updated Terraform files * Apply suggestions from code review Co-authored-by: Karl Cardenas * Update edge/vmware/clone_vm_template/delete-packer-cache.sh change error output destination * fix: added new tools such as oras and awscli, updated Terraform files… (#25) * fix: added new tools such as oras and awscli, updated Terraform files to include OCI registries * chore: updated the template and documentation * docs: minor update to the terraform.tfvars file * docs: minor update to the terraform.tfvars file --------- Co-authored-by: Karl Cardenas --------- Co-authored-by: Lenny Chen Co-authored-by: Karl Cardenas Co-authored-by: caroldelwing --- Dockerfile | 9 ++- docs/docker.md | 4 +- .../clone_vm_template/delete-packer-cache.sh | 22 ++++++ terraform/pack-tf/README.md | 42 +++++++----- terraform/pack-tf/cluster.tf | 20 +++--- terraform/pack-tf/data.tf | 49 +++++++++----- terraform/pack-tf/inputs.tf | 50 +++++++++++--- terraform/pack-tf/outputs.tf | 2 +- terraform/pack-tf/profile.tf | 67 ++++++++----------- terraform/pack-tf/provider.tf | 6 +- terraform/pack-tf/terraform.tfvars | 8 ++- 11 files changed, 177 insertions(+), 102 deletions(-) create mode 100644 edge/vmware/clone_vm_template/delete-packer-cache.sh diff --git a/Dockerfile b/Dockerfile index 53e1a32..e4d08f0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,6 +18,7 @@ ADD static/defaults/registry-config.yml etc/spectro/config.yml ARG PALETTE_CLI_VERSION ARG PALETTE_EDGE_VERSION ARG PACKER_VERSION=1.9.4 +ARG ORAS_VERSION=1.0.0 ENV REGISTRY_LOG_LEVEL=info ENV REGISTRY_AUTH=htpasswd @@ -29,7 +30,7 @@ COPY --from=server /etc/spectro/config.yml /etc/spectro/config.yml RUN adduser -H -u 1002 -D appuser appuser && \ apk update && \ - apk add --no-cache bash curl git terraform openssl jq bind-tools wget ca-certificates nano + apk add --no-cache bash curl git terraform openssl jq bind-tools wget ca-certificates nano aws-cli xorriso govc RUN wget https://software.spectrocloud.com/spectro-registry/cli/v$PALETTE_CLI_VERSION/linux/spectro && \ mv spectro /usr/local/bin/spectro && \ @@ -50,13 +51,17 @@ RUN wget https://software.spectrocloud.com/spectro-registry/cli/v$PALETTE_CLI_V wget https://software.spectrocloud.com/stylus/v$PALETTE_EDGE_VERSION/cli/linux/palette-edge && \ mv palette-edge /usr/local/bin/palette-edge && \ chmod +x /usr/local/bin/palette-edge && \ + wget https://github.com/oras-project/oras/releases/download/v${ORAS_VERSION}/oras_${ORAS_VERSION}_linux_amd64.tar.gz && \ + mkdir -p oras-install/ && \ + tar -zxf oras_${ORAS_VERSION}_*.tar.gz -C oras-install/ && \ + mv oras-install/oras /usr/local/bin/ && \ + rm -rf oras_${ORAS_VERSION}_*.tar.gz oras-install/ && \ git clone https://github.com/spectrocloud/CanvOS.git && \ rm -rf /var/cache/apk/* ADD https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_amd64.zip /usr/local/sbin/ RUN unzip /usr/local/sbin/packer_${PACKER_VERSION}_linux_amd64.zip -d /usr/local/sbin && \ rm -rf /usr/local/sbin/packer_${PACKER_VERSION}_linux_amd64.zip -RUN apk add xorriso govc EXPOSE 5000 CMD ["/bin/bash"] \ No newline at end of file diff --git a/docs/docker.md b/docs/docker.md index 9aa7a27..77277e7 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -40,6 +40,8 @@ The Docker image includes the following tools. | `nano` | A text editior for Unix-like computing systems or operating environments using a command line interface| | `packer` | Hashicorp Image Builder for building Edge Native images | | `GOVC` | Tool for interracting with VMware Vsphere via API | +| `aws-cli` | AWS command-line interface | +| `oras` | Tool for pushing and pulling OCI artifacts to and from OCI registries| ### Spectro Cloud Pack Registry Server @@ -63,5 +65,5 @@ If you are wanting to build the docker image locally you must provide the the bu ```shell -docker build --build-arg PALETTE_VERSION=4.0.1 --build-arg PALETTE_CLI_VERSION=4.0.1 --build-arg PALETTE_EDGE_VERSION=3.4.3 --build-arg PACKER_VERSION=1.9.4 -t tutorials . +docker build --build-arg PALETTE_VERSION=4.0.2 --build-arg PALETTE_CLI_VERSION=4.0.1 --build-arg PALETTE_EDGE_VERSION=3.4.3 --build-arg PACKER_VERSION=1.9.4 -t tutorials . ``` \ No newline at end of file diff --git a/edge/vmware/clone_vm_template/delete-packer-cache.sh b/edge/vmware/clone_vm_template/delete-packer-cache.sh new file mode 100644 index 0000000..725627d --- /dev/null +++ b/edge/vmware/clone_vm_template/delete-packer-cache.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +source /edge/vmware/clone_vm_template/setenv.sh + +# Check if the packer cache exists +CACHE_EXISTS=$(govc datastore.ls -ds=$vcenter_datastore /packer_cache 2>&1) + +if [ -z "$CACHE_EXISTS" ]; then + echo "Existing packer cache not found. Nothing to delete." +else + # Cache exists, attempt to delete it + govc datastore.rm -ds=$vcenter_datastore /packer_cache + RESULT=$? + if [ $RESULT -eq 0 ]; then + echo "Deleted previous packer cache." + exit 0 + else + echo "Failed to delete packer cache." + exit 1 + fi +fi + diff --git a/terraform/pack-tf/README.md b/terraform/pack-tf/README.md index 4bbc10b..038c38c 100644 --- a/terraform/pack-tf/README.md +++ b/terraform/pack-tf/README.md @@ -3,30 +3,33 @@ This folder contains the demo code for the [Create and Deploy a Custom Add-On Pack](https://docs.spectrocloud.com/registries-and-packs/create-pack) tutorial. Use the code in this directory with the tutorial. + +To get started, review the [prerequisites](#prerequisites). Next, follow the steps in the tutorial to deploy the cluster and custom add-on pack. + Use the [terraform.tfvars](./terraform.tfvars) file to provide the required variables. Once you populate the variables, you can deploy the cluster and custom add-on pack. + ## Prerequisites You will need the following things before getting started: -1. Spectro Cloud API key generated from the Palette. +1. A Palette API key. 2. A cloud account added to your Palette project settings. -3. An SSH key created in the region where you will deploy the cluster. - -Note that the Terraform code, when executed, will deploy the resources to the **AWS** cloud service provider. -To deploy your resource to Azure or Google Cloud, use the specific layer details outlined in the **Cloud Service Provider Configurations** section below. +3. An AWS Key pair or SSH key created in the region where you will deploy the cluster. +> [!NOTE] +> This Terraform code will deploy the resources specified in the template to **AWS**. -## Cloud Service Provider Configurations -The code uses the data resources, the core infrastructure layers, defined in the **data.tf** to deploy the `spectrocloud_cluster_profile.profile` resource to the AWS. Here are the pack details for each infrastructure layer. -### AWS Config +## Requirements | Name | Version | |------|---------| -| [spectrocloud](#requirement\_spectrocloud) | >= 0.11.1 | +| [aws](#requirement\_aws) | ~> 5.0 | +| [spectrocloud](#requirement\_spectrocloud) | >= 0.16.1 | ## Providers | Name | Version | |------|---------| -| [spectrocloud](#provider\_spectrocloud) | >= 0.11.1 | +| [aws](#provider\_aws) | 5.25.0 | +| [spectrocloud](#provider\_spectrocloud) | 0.16.1 | ## Modules @@ -38,6 +41,7 @@ No modules. |------|------| | [spectrocloud_cluster_aws.cluster](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_aws) | resource | | [spectrocloud_cluster_profile.profile](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | +| [aws_availability_zones.available](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/availability_zones) | data source | | [spectrocloud_cloudaccount_aws.account](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cloudaccount_aws) | data source | | [spectrocloud_pack.cni](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | | [spectrocloud_pack.csi](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | @@ -47,21 +51,25 @@ No modules. | [spectrocloud_pack.ubuntu](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | | [spectrocloud_registry.hellouniverseregistry](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/registry) | data source | | [spectrocloud_registry.public_registry](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/registry) | data source | +| [spectrocloud_registry_oci.hellouniverseregistry](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/registry_oci) | data source | ## Inputs | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| -| [aws\_region\_name](#input\_aws\_region\_name) | Choose the AWS region. | `string` | n/a | yes | -| [cluster\_cloud\_account\_aws\_name](#input\_cluster\_cloud\_account\_aws\_name) | Choose the AWS account integrated with Spektro Palette. | `string` | n/a | yes | -| [cluster\_name](#input\_cluster\_name) | Give the cluster a name. | `string` | `"pack-tutorial-cluster"` | no | -| [cluster\_profile\_description](#input\_cluster\_profile\_description) | Provide a description. | `string` | `"My cluster profile as part of the packs tutorial."` | no | -| [cluster\_profile\_name](#input\_cluster\_profile\_name) | Give the cluster-profile a name. | `string` | `"pack-tutorial-profile"` | no | +| [aws\_az\_names](#input\_aws\_az\_names) | Provide a list of AWS Availability Zones. For example: ['us-east-1a', 'us-east-1b', 'us-east-1c'] | `list(string)` | `[]` | no | +| [aws\_region\_name](#input\_aws\_region\_name) | Specify the AWS region where you want to deploy the cluster. | `string` | n/a | yes | +| [cluster\_cloud\_account\_aws\_name](#input\_cluster\_cloud\_account\_aws\_name) | Specify the AWS account integrated with Palette. Use the same name as the one used in the Palette project settings. | `string` | n/a | yes | +| [cluster\_name](#input\_cluster\_name) | The name of the cluster. | `string` | `"pack-tutorial-cluster"` | no | +| [cluster\_profile\_description](#input\_cluster\_profile\_description) | Provide a description of the cluster profile. | `string` | `"My cluster profile as part of the packs tutorial."` | no | +| [cluster\_profile\_name](#input\_cluster\_profile\_name) | The name of the cluster profile. | `string` | `"pack-tutorial-profile"` | no | | [custom\_addon\_pack](#input\_custom\_addon\_pack) | Custom add-on pack name. | `string` | `"hellouniverse"` | no | | [custom\_addon\_pack\_version](#input\_custom\_addon\_pack\_version) | Custom add-on pack version. | `string` | `"1.0.0"` | no | -| [private\_pack\_registry](#input\_private\_pack\_registry) | Private pack registry server name. | `string` | `"private-pack-registry"` | no | -| [ssh\_key\_name](#input\_ssh\_key\_name) | Choose the AWS region. | `string` | n/a | yes | +| [instance\_type](#input\_instance\_type) | Specify the AWS instance type. | `string` | `"m4.xlarge"` | no | +| [private\_pack\_registry](#input\_private\_pack\_registry) | The name of the private pack registry server. | `string` | n/a | yes | +| [ssh\_key\_name](#input\_ssh\_key\_name) | Specify the AWS Keypair available in the AWS region where you want to deploy the cluster. | `string` | n/a | yes | | [tags](#input\_tags) | The default tags to apply to Palette resources | `list(string)` |
[
"spectro-cloud-education",
"app:hello-universe",
"terraform_managed:true"
]
| no | +| [use\_oci\_registry](#input\_use\_oci\_registry) | Set the use of OCI registry to true or false. If you are not using an OCI registry, set this value to false. | `bool` | `true` | no | ## Outputs diff --git a/terraform/pack-tf/cluster.tf b/terraform/pack-tf/cluster.tf index e48e8ab..776cc71 100644 --- a/terraform/pack-tf/cluster.tf +++ b/terraform/pack-tf/cluster.tf @@ -1,14 +1,14 @@ resource "spectrocloud_cluster_aws" "cluster" { - name = var.cluster_name - tags = var.tags - cloud_account_id = data.spectrocloud_cloudaccount_aws.account.id - depends_on = [spectrocloud_cluster_profile.profile] + name = var.cluster_name + tags = var.tags + cloud_account_id = data.spectrocloud_cloudaccount_aws.account.id + depends_on = [spectrocloud_cluster_profile.profile] cloud_config { - ssh_key_name = var.ssh_key_name + ssh_key_name = var.ssh_key_name region = var.aws_region_name } - + cluster_profile { id = spectrocloud_cluster_profile.profile.id } @@ -32,9 +32,9 @@ resource "spectrocloud_cluster_aws" "cluster" { control_plane_as_worker = true name = "master-pool" count = 1 - instance_type = "m4.large" + instance_type = var.instance_type disk_size_gb = 60 - azs = ["us-east-2a"] + azs = local.azs } ############################## @@ -48,8 +48,8 @@ resource "spectrocloud_cluster_aws" "cluster" { } name = "worker-basic" count = 1 - instance_type = "m5.large" - azs = ["us-east-2a"] + instance_type = var.instance_type + azs = local.azs } } \ No newline at end of file diff --git a/terraform/pack-tf/data.tf b/terraform/pack-tf/data.tf index 785e78b..79071ea 100644 --- a/terraform/pack-tf/data.tf +++ b/terraform/pack-tf/data.tf @@ -2,7 +2,7 @@ # Data resources for the profile #################################### data "spectrocloud_registry" "public_registry" { - name = "Public Repo" + name = "Public Repo" } #################################### @@ -12,26 +12,26 @@ data "spectrocloud_registry" "public_registry" { # Refer to the "Cloud Service Provider Configurations" section in the README for more details. #################################### data "spectrocloud_pack" "ubuntu" { - name = "ubuntu-aws" - version = "20.04" + name = "ubuntu-aws" + version = "22.04" registry_uid = data.spectrocloud_registry.public_registry.id } data "spectrocloud_pack" "k8s" { - name = "kubernetes" - version = "1.24.10" + name = "kubernetes" + version = "1.28.2" registry_uid = data.spectrocloud_registry.public_registry.id } data "spectrocloud_pack" "cni" { - name = "cni-calico" - version = "3.25.0" + name = "cni-calico" + version = "3.26.1" registry_uid = data.spectrocloud_registry.public_registry.id } data "spectrocloud_pack" "csi" { - name = "csi-aws-ebs" - version = "1.16.0" + name = "csi-aws-ebs" + version = "1.22.0" registry_uid = data.spectrocloud_registry.public_registry.id } @@ -39,18 +39,27 @@ data "spectrocloud_pack" "csi" { # Add-On Layers #################################### data "spectrocloud_pack" "spectro-proxy" { - name = "spectro-proxy" - version = "1.3.0" - type = "spectro" + name = "spectro-proxy" + version = "1.4.1" + type = "spectro" + registry_uid = data.spectrocloud_registry.public_registry.id } +# Select the correct registry (OCI or non-OCI) + data "spectrocloud_pack" "hellouniverse" { - name = var.custom_addon_pack - version = var.custom_addon_pack_version - registry_uid = data.spectrocloud_registry.hellouniverseregistry.id + name = var.custom_addon_pack + version = var.custom_addon_pack_version + registry_uid = var.use_oci_registry ? data.spectrocloud_registry_oci.hellouniverseregistry[0].id : data.spectrocloud_registry.hellouniverseregistry[0].id } data "spectrocloud_registry" "hellouniverseregistry" { + count = var.use_oci_registry ? 0 : 1 + name = var.private_pack_registry +} + +data "spectrocloud_registry_oci" "hellouniverseregistry" { + count = var.use_oci_registry ? 1 : 0 name = var.private_pack_registry } @@ -58,5 +67,11 @@ data "spectrocloud_registry" "hellouniverseregistry" { # Data resources for the cluster #################################### data "spectrocloud_cloudaccount_aws" "account" { - name = var.cluster_cloud_account_aws_name -} \ No newline at end of file + name = var.cluster_cloud_account_aws_name +} + + +#################################### +# AWS +#################################### +data "aws_availability_zones" "available" {} \ No newline at end of file diff --git a/terraform/pack-tf/inputs.tf b/terraform/pack-tf/inputs.tf index 5926c96..b3d415c 100644 --- a/terraform/pack-tf/inputs.tf +++ b/terraform/pack-tf/inputs.tf @@ -1,57 +1,80 @@ variable "cluster_profile_name" { type = string - description = "Give the cluster-profile a name." + description = "The name of the cluster profile." default = "pack-tutorial-profile" } variable "cluster_profile_description" { type = string - description = "Provide a description." + description = "Provide a description of the cluster profile." default = "My cluster profile as part of the packs tutorial." } variable "cluster_name" { type = string - description = "Give the cluster a name." + description = "The name of the cluster." default = "pack-tutorial-cluster" } + +variable "instance_type" { + type = string + description = "Specify the AWS instance type." + default = "m4.xlarge" +} + # ToDo: Provide a value for the variable below. The value will be the actual cloud account name added to your Palette project settings. variable "cluster_cloud_account_aws_name" { type = string - description = "Choose the AWS account integrated with Spektro Palette." + description = "Specify the AWS account integrated with Palette. Use the same name as the one used in the Palette project settings." } # ToDo: Provide a value for the variable below. The value will be one of the [AWS regions](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.RegionsAndAvailabilityZones.html) -# The tutorial example uses "us-east-2" region. +# The tutorial example uses "us-east-1" region. variable "aws_region_name" { type = string - description = "Choose the AWS region." + description = "Specify the AWS region where you want to deploy the cluster." +} + +# ToDo: Provide a value for the variable below. The value will be one of the [AWS Availability Zones](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.RegionsAndAvailabilityZones.html) +# The tutorial example uses "us-east-1a" availability zone. +variable "aws_az_names" { + type = list(string) + description = "Provide a list of AWS Availability Zones. For example: ['us-east-1a', 'us-east-1b', 'us-east-1c']" + default = [] } # ToDo: Provide a value for the variable below. The value will be the SSH key created in the AWS region where you will deploy the cluster. variable "ssh_key_name" { type = string - description = "Choose the AWS region." + description = "Specify the AWS Keypair available in the AWS region where you want to deploy the cluster." } # ToDo: Provide the name of your private registry server. # The tutorial example uses "private-pack-registry". variable "private_pack_registry" { type = string - description = "Private pack registry server name." + description = "The name of the private pack registry server." } variable "custom_addon_pack" { type = string description = "Custom add-on pack name." - default = "hellouniverse" + default = "hellouniverse" } variable "custom_addon_pack_version" { type = string description = "Custom add-on pack version." - default = "1.0.0" + default = "1.0.0" +} + +# ToDo: Set the use of OCI registry to true or false. +# The default value is set as true. +variable "use_oci_registry" { + type = bool + description = "Set the use of OCI registry to true or false. If you are not using an OCI registry, set this value to false." + default = true } variable "tags" { @@ -59,5 +82,10 @@ variable "tags" { description = "The default tags to apply to Palette resources" # Value and key must be 63 characters or less, must start and end with an alphanumeric character, and can contain only alphanumeric characters, dots, dashes or underscores. # Slashes `\` are not allowed. - default = ["spectro-cloud-education", "app:hello-universe", "terraform_managed:true"] + default = ["spectro-cloud-education", "app:hello-universe", "terraform_managed:true"] +} + +locals { + # Check if the user has provided a list of AWS Availability Zones. If not, use the first AZ from the list of available AZs in the region. + azs = length(var.aws_az_names) != 0 ? var.aws_az_names : slice(data.aws_availability_zones.available.names, 0, 1) } \ No newline at end of file diff --git a/terraform/pack-tf/outputs.tf b/terraform/pack-tf/outputs.tf index 057ef90..919a1b3 100644 --- a/terraform/pack-tf/outputs.tf +++ b/terraform/pack-tf/outputs.tf @@ -1,5 +1,5 @@ output "Advisory" { - value = <<-EOT + value = <<-EOT It takes between one to three minutes for DNS to properly resolve the public load balancer URL. We recommend waiting a few moments before clicking on the service URL to prevent the browser from caching an unresolved DNS request. diff --git a/terraform/pack-tf/profile.tf b/terraform/pack-tf/profile.tf index b76637b..3b9bb3b 100644 --- a/terraform/pack-tf/profile.tf +++ b/terraform/pack-tf/profile.tf @@ -3,39 +3,39 @@ resource "spectrocloud_cluster_profile" "profile" { name = var.cluster_profile_name description = var.cluster_profile_description tags = var.tags - cloud = "aws" # Possible values: "aws", "azure", "gcp" - type = "cluster" # Possible values: "cluster", "add-on" + cloud = "aws" # Possible values: "aws", "azure", "gcp" + type = "cluster" # Possible values: "cluster", "add-on" ############################ # Core layers ############################ # Packs below have a static name and tag value. Refer to the HubbleAPI collection before changing these value. pack { - name = "ubuntu-aws" - tag = "LTS__20.4.x" - uid = data.spectrocloud_pack.ubuntu.id - values = data.spectrocloud_pack.ubuntu.values + name = "ubuntu-aws" + tag = "LTS__22.4.x" + uid = data.spectrocloud_pack.ubuntu.id + values = data.spectrocloud_pack.ubuntu.values } pack { - name = "kubernetes" - tag = "1.24.x" - uid = data.spectrocloud_pack.k8s.id - values = data.spectrocloud_pack.k8s.values + name = "kubernetes" + tag = "1.28.x" + uid = data.spectrocloud_pack.k8s.id + values = data.spectrocloud_pack.k8s.values } pack { - name = "cni-calico" - tag = "3.25.x" - uid = data.spectrocloud_pack.cni.id - values = data.spectrocloud_pack.cni.values + name = "cni-calico" + tag = "3.26.x" + uid = data.spectrocloud_pack.cni.id + values = data.spectrocloud_pack.cni.values } pack { - name = "csi-aws-ebs" - tag = "1.16.x" - uid = data.spectrocloud_pack.csi.id - values = data.spectrocloud_pack.csi.values + name = "csi-aws-ebs" + tag = "1.22.x" + uid = data.spectrocloud_pack.csi.id + values = data.spectrocloud_pack.csi.values } ############################ @@ -43,28 +43,17 @@ resource "spectrocloud_cluster_profile" "profile" { ############################ # Refer to https://docs.spectrocloud.com/integrations/frp/ for more details on Spectro Proxy pack. pack { - name = "spectro-proxy" # Static value. Refer to the HubbleAPI collection before changing this value. - tag = "1.3.x" - uid = data.spectrocloud_pack.spectro-proxy.id - values = local.proxy_val + name = "spectro-proxy" # Static value. Refer to the HubbleAPI collection before changing this value. + tag = "1.4.x" + uid = data.spectrocloud_pack.spectro-proxy.id + values = data.spectrocloud_pack.spectro-proxy.values } -# Custom add-on pack -pack { - name = "hellouniverse" - tag = "1.0.x" - uid = data.spectrocloud_pack.hellouniverse.id - values = data.spectrocloud_pack.hellouniverse.values + # Custom add-on pack + pack { + name = "hellouniverse" + tag = "1.0.x" + uid = data.spectrocloud_pack.hellouniverse.id + values = data.spectrocloud_pack.hellouniverse.values } -} - -locals { - proxy_val = <<-EOT - manifests: - spectro-proxy: - namespace: "cluster-{{ .spectro.system.cluster.uid }}" - server: "{{ .spectro.system.reverseproxy.server }}" - clusterUid: "{{ .spectro.system.cluster.uid }}" - subdomain: "cluster-{{ .spectro.system.cluster.uid }}" - EOT } \ No newline at end of file diff --git a/terraform/pack-tf/provider.tf b/terraform/pack-tf/provider.tf index cfdecfd..709ca09 100644 --- a/terraform/pack-tf/provider.tf +++ b/terraform/pack-tf/provider.tf @@ -1,9 +1,13 @@ terraform { required_providers { spectrocloud = { - version = ">= 0.13.1" + version = ">= 0.16.1" source = "spectrocloud/spectrocloud" } + aws = { + source = "hashicorp/aws" + version = "~> 5.0" + } } } diff --git a/terraform/pack-tf/terraform.tfvars b/terraform/pack-tf/terraform.tfvars index 7624d9d..71ca6e6 100644 --- a/terraform/pack-tf/terraform.tfvars +++ b/terraform/pack-tf/terraform.tfvars @@ -1,4 +1,6 @@ cluster_cloud_account_aws_name = "REPLACE ME" # Name of the cloud account added to your Palette project settings -aws_region_name = "REPLACE ME" # Use "us-east-2" or any other AWS region -ssh_key_name = "REPLACE ME" # Name of the SSH key available in the region where you will deploy the cluster -private_pack_registry = "REPLACE ME" # Your registry server name. This tutorial uses "private-pack-registry". \ No newline at end of file +aws_region_name = "REPLACE ME" # Use "us-east-1" or any other AWS region +aws_az_names = [] # Specify the AWS availability zone name in which you want the cluster to be available. By default, only one AZ will be selected. For example: ['us-east-1a', 'us-east-1b', 'us-east-1c']. +ssh_key_name = "REPLACE ME" # Name of the SSH key available in the region where you will deploy the cluster +private_pack_registry = "REPLACE ME" # Your registry server name. This tutorial uses "private-pack-registry". +use_oci_registry = true # Set the use of OCI registry to true or false. The default value is set as true. \ No newline at end of file