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. 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 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