From f1632ad9faf8d9f20107a2f15ebb6b6fe4615b8c Mon Sep 17 00:00:00 2001 From: Tobias Babin <140624220+TobiasBabin@users.noreply.github.com> Date: Tue, 31 Oct 2023 14:37:49 +0100 Subject: [PATCH 1/3] Added link to tutorial --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 1dc70dd..1aecfbc 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,3 @@ # Update Resource Definitions for related Applications -This repository contains reference material for Humanitec's tutorial on Resource Definitions for related Applications. You can find the full tutorial instructions here (link coming soon). - +This repository contains reference material for Humanitec's tutorial on [Updating Resource Definitions for related Applications](https://developer.humanitec.com/introduction/tutorials/update-resource-definitions-for-related-applications). Please find the full tutorial instructions in the linked documentation. From 4c7298099faf133cd99d1cbc0b702bcdd9436cb3 Mon Sep 17 00:00:00 2001 From: Tobias Babin Date: Thu, 2 Nov 2023 12:25:35 +0100 Subject: [PATCH 2/3] Adjusted Score files to use resources --- score/score-app1.yaml | 4 ++-- score/score-app2.yaml | 8 ++++---- score/score-app3.yaml | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/score/score-app1.yaml b/score/score-app1.yaml index 38081f9..6afefd4 100644 --- a/score/score-app1.yaml +++ b/score/score-app1.yaml @@ -10,7 +10,7 @@ containers: command: ["/bin/bash"] args: ["-c", "while true; do printenv && sleep 100; done"] variables: - REDIS: ${externals.redis.host} + REDIS: ${resources.redis.host} resources: - "redis": + redis: type: redis diff --git a/score/score-app2.yaml b/score/score-app2.yaml index c4d89f0..c956f09 100644 --- a/score/score-app2.yaml +++ b/score/score-app2.yaml @@ -10,10 +10,10 @@ containers: command: ["/bin/bash"] args: ["-c", "while true; do printenv && sleep 100; done"] variables: - REDIS: ${externals.redis.host} - S3: ${externals.s3.bucket} + REDIS: ${resources.redis.host} + S3: ${resources.s3.bucket} resources: - "redis": + redis: type: redis - "s3": + s3: type: s3 diff --git a/score/score-app3.yaml b/score/score-app3.yaml index 7933f96..a9c1fb9 100644 --- a/score/score-app3.yaml +++ b/score/score-app3.yaml @@ -10,7 +10,7 @@ containers: command: ["/bin/bash"] args: ["-c", "while true; do printenv && sleep 100; done"] variables: - POSTGRES: ${externals.postgres.host} + POSTGRES: ${resources.postgres.host} resources: - "postgres": + postgres: type: postgres From 54dba9b2b7f8667e71f300480ab7877634e1e271 Mon Sep 17 00:00:00 2001 From: Tobias Babin Date: Fri, 10 May 2024 15:34:24 +0200 Subject: [PATCH 3/3] Fix Terraform Driver and add cluster ResDef matching --- terraform/matching.tf | 15 +++++++++++++++ terraform/provider.tf | 3 +++ terraform/resdef.tf | 6 +++--- terraform/terraform.tfvars.example | 4 +++- 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/terraform/matching.tf b/terraform/matching.tf index 2aeb4d2..3a791b6 100644 --- a/terraform/matching.tf +++ b/terraform/matching.tf @@ -17,3 +17,18 @@ resource "humanitec_resource_definition_criteria" "criteria4" { resource_definition_id = humanitec_resource_definition.postgres.id app_id = "app3" } + + +# Matching criteria for the target Kubernetes cluster +resource "humanitec_resource_definition_criteria" "cluster-app1" { + resource_definition_id = var.k8s_resDef + app_id = "app1" +} +resource "humanitec_resource_definition_criteria" "cluster-app2" { + resource_definition_id = var.k8s_resDef + app_id = "app2" +} +resource "humanitec_resource_definition_criteria" "cluster-app3" { + resource_definition_id = var.k8s_resDef + app_id = "app3" +} \ No newline at end of file diff --git a/terraform/provider.tf b/terraform/provider.tf index 5ee2fea..241edbe 100644 --- a/terraform/provider.tf +++ b/terraform/provider.tf @@ -18,3 +18,6 @@ variable "org" { variable "token" { } + +variable "k8s_resDef" { +} \ No newline at end of file diff --git a/terraform/resdef.tf b/terraform/resdef.tf index 8dc9072..d298b05 100644 --- a/terraform/resdef.tf +++ b/terraform/resdef.tf @@ -5,7 +5,7 @@ variable "instance_type" { resource "humanitec_resource_definition" "redis" { name = "redis" id = "redis" - driver_type = "${var.org}/terraform" + driver_type = "humanitec/terraform" type = "redis" driver_inputs = { @@ -37,7 +37,7 @@ resource "humanitec_resource_definition" "redis" { resource "humanitec_resource_definition" "bucket" { name = "bucket" id = "bucket" - driver_type = "${var.org}/terraform" + driver_type = "humanitec/terraform" type = "s3" driver_inputs = { @@ -69,7 +69,7 @@ resource "humanitec_resource_definition" "bucket" { resource "humanitec_resource_definition" "postgres" { name = "postgres" id = "postgres" - driver_type = "${var.org}/terraform" + driver_type = "humanitec/terraform" type = "postgres" driver_inputs = { diff --git a/terraform/terraform.tfvars.example b/terraform/terraform.tfvars.example index 09b85a1..a7247f1 100644 --- a/terraform/terraform.tfvars.example +++ b/terraform/terraform.tfvars.example @@ -1,4 +1,6 @@ # The Humanitec Organization ID. Must be all lowercase. org = "" # The Humanitec API Token. -token = "" \ No newline at end of file +token = "" +# The id of the Resource Definition of the target Kubernetes Cluster +k8s_resDef = "" \ No newline at end of file