From 794878b0a6f595f2e9959c96f23d8dd7b8015ce0 Mon Sep 17 00:00:00 2001 From: Susan P <82346985+susanpann@users.noreply.github.com> Date: Wed, 30 Oct 2024 13:30:23 +1000 Subject: [PATCH] fix: respect machine policy id in kubernetes agent deployment target (#807) * fix: respect machine policy id in kubernetes agent deployment target * fix: respect machine policy id in kubernetes agent worker --- octopusdeploy/schema_kubernetes_agent_deployment_target.go | 5 ++++- octopusdeploy/schema_kubernetes_agent_worker.go | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/octopusdeploy/schema_kubernetes_agent_deployment_target.go b/octopusdeploy/schema_kubernetes_agent_deployment_target.go index 2323f311b..6bfd0d47e 100644 --- a/octopusdeploy/schema_kubernetes_agent_deployment_target.go +++ b/octopusdeploy/schema_kubernetes_agent_deployment_target.go @@ -1,11 +1,12 @@ package octopusdeploy import ( + "net/url" + "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/core" "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/machines" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - "net/url" ) func expandKubernetesAgentDeploymentTarget(kubernetesAgent *schema.ResourceData) *machines.DeploymentTarget { @@ -30,6 +31,8 @@ func expandKubernetesAgentDeploymentTarget(kubernetesAgent *schema.ResourceData) deploymentTarget.TenantTags = expandArray(kubernetesAgent.Get("tenant_tags").([]interface{})) deploymentTarget.SpaceID = kubernetesAgent.Get("space_id").(string) + deploymentTarget.MachinePolicyID = kubernetesAgent.Get("machine_policy_id").(string) + return deploymentTarget } diff --git a/octopusdeploy/schema_kubernetes_agent_worker.go b/octopusdeploy/schema_kubernetes_agent_worker.go index 8c6f1e753..32c0c6e20 100644 --- a/octopusdeploy/schema_kubernetes_agent_worker.go +++ b/octopusdeploy/schema_kubernetes_agent_worker.go @@ -1,10 +1,11 @@ package octopusdeploy import ( + "net/url" + "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/machines" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - "net/url" ) func expandKubernetesAgentWorker(kubernetesAgent *schema.ResourceData) *machines.Worker { @@ -24,6 +25,8 @@ func expandKubernetesAgentWorker(kubernetesAgent *schema.ResourceData) *machines Worker.SpaceID = kubernetesAgent.Get("space_id").(string) + Worker.MachinePolicyID = kubernetesAgent.Get("machine_policy_id").(string) + return Worker }