From c31de6d56a0641490cc41ab9f90e44ee2579d524 Mon Sep 17 00:00:00 2001 From: Georgios Gkinis Date: Wed, 29 May 2024 12:55:23 +0200 Subject: [PATCH] Populate Policy_id for integrations and policies when importing (#646) --- internal/fleet/agent_policy_resource.go | 3 +++ internal/fleet/integration_policy_resource.go | 3 +++ 2 files changed, 6 insertions(+) diff --git a/internal/fleet/agent_policy_resource.go b/internal/fleet/agent_policy_resource.go index 6b56109bd..cbd6c054a 100644 --- a/internal/fleet/agent_policy_resource.go +++ b/internal/fleet/agent_policy_resource.go @@ -220,6 +220,9 @@ func resourceAgentPolicyRead(ctx context.Context, d *schema.ResourceData, meta i if err := d.Set("namespace", agentPolicy.Namespace); err != nil { return diag.FromErr(err) } + if err := d.Set("policy_id", agentPolicy.Id); err != nil { + return diag.FromErr(err) + } if agentPolicy.Description != nil { if err := d.Set("description", *agentPolicy.Description); err != nil { return diag.FromErr(err) diff --git a/internal/fleet/integration_policy_resource.go b/internal/fleet/integration_policy_resource.go index e5a63422a..86f2f7ea0 100644 --- a/internal/fleet/integration_policy_resource.go +++ b/internal/fleet/integration_policy_resource.go @@ -305,6 +305,9 @@ func resourceIntegrationPolicyRead(ctx context.Context, d *schema.ResourceData, if err := d.Set("namespace", pkgPolicy.Namespace); err != nil { return diag.FromErr(err) } + if err := d.Set("policy_id", pkgPolicy.Id); err != nil { + return diag.FromErr(err) + } if err := d.Set("integration_name", pkgPolicy.Package.Name); err != nil { return diag.FromErr(err) }