From ffc074aed2338323fb06148d016dc4d90c83fa1c Mon Sep 17 00:00:00 2001 From: Danielle Maywood Date: Tue, 13 Jan 2026 17:50:38 +0000 Subject: [PATCH 1/2] feat: Add subagent_id attribute to devcontainer resource - Add computed subagent_id attribute to devcontainer resource - Generate unique UUID for subagent identification - Add tests verifying subagent_id is a valid UUID - Update documentation with new attribute --- docs/resources/devcontainer.md | 1 + provider/devcontainer.go | 10 ++++++++++ provider/devcontainer_test.go | 11 +++++++++++ 3 files changed, 22 insertions(+) diff --git a/docs/resources/devcontainer.md b/docs/resources/devcontainer.md index 06d7f6f3..0ebc49a5 100644 --- a/docs/resources/devcontainer.md +++ b/docs/resources/devcontainer.md @@ -30,3 +30,4 @@ Define a Dev Container the agent should know of and attempt to autostart. ### Read-Only - `id` (String) The ID of this resource. +- `subagent_id` (String) The ID of the subagent created for this Dev Container. diff --git a/provider/devcontainer.go b/provider/devcontainer.go index 81a31194..d273efa7 100644 --- a/provider/devcontainer.go +++ b/provider/devcontainer.go @@ -17,6 +17,11 @@ func devcontainerResource() *schema.Resource { CreateContext: func(_ context.Context, rd *schema.ResourceData, _ interface{}) diag.Diagnostics { rd.SetId(uuid.NewString()) + // Generate a unique subagent ID for this dev container. + if err := rd.Set("subagent_id", uuid.NewString()); err != nil { + return diag.FromErr(err) + } + return nil }, ReadContext: schema.NoopContext, @@ -41,6 +46,11 @@ func devcontainerResource() *schema.Resource { ForceNew: true, Optional: true, }, + "subagent_id": { + Type: schema.TypeString, + Description: "The ID of the subagent created for this Dev Container.", + Computed: true, + }, }, } } diff --git a/provider/devcontainer_test.go b/provider/devcontainer_test.go index 784cfb0d..c8b4ea9f 100644 --- a/provider/devcontainer_test.go +++ b/provider/devcontainer_test.go @@ -4,6 +4,7 @@ import ( "regexp" "testing" + "github.com/google/uuid" "github.com/stretchr/testify/require" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" @@ -39,6 +40,11 @@ func TestDevcontainer(t *testing.T) { } { require.Equal(t, expected, script.Primary.Attributes[key]) } + // Verify subagent_id is a valid UUID. + subagentID := script.Primary.Attributes["subagent_id"] + require.NotEmpty(t, subagentID) + _, err := uuid.Parse(subagentID) + require.NoError(t, err, "subagent_id should be a valid UUID") return nil }, }}, @@ -72,6 +78,11 @@ func TestDevcontainerNoConfigPath(t *testing.T) { } { require.Equal(t, expected, script.Primary.Attributes[key]) } + // Verify subagent_id is a valid UUID. + subagentID := script.Primary.Attributes["subagent_id"] + require.NotEmpty(t, subagentID) + _, err := uuid.Parse(subagentID) + require.NoError(t, err, "subagent_id should be a valid UUID") return nil }, }}, From 3abae0d3fc84c29d18101c122c4c619ceea925d5 Mon Sep 17 00:00:00 2001 From: Danielle Maywood Date: Wed, 14 Jan 2026 10:44:57 +0000 Subject: [PATCH 2/2] Remove unnecessary comments --- provider/devcontainer.go | 1 - provider/devcontainer_test.go | 2 -- 2 files changed, 3 deletions(-) diff --git a/provider/devcontainer.go b/provider/devcontainer.go index d273efa7..b2c16eb8 100644 --- a/provider/devcontainer.go +++ b/provider/devcontainer.go @@ -17,7 +17,6 @@ func devcontainerResource() *schema.Resource { CreateContext: func(_ context.Context, rd *schema.ResourceData, _ interface{}) diag.Diagnostics { rd.SetId(uuid.NewString()) - // Generate a unique subagent ID for this dev container. if err := rd.Set("subagent_id", uuid.NewString()); err != nil { return diag.FromErr(err) } diff --git a/provider/devcontainer_test.go b/provider/devcontainer_test.go index c8b4ea9f..be1a3d9e 100644 --- a/provider/devcontainer_test.go +++ b/provider/devcontainer_test.go @@ -40,7 +40,6 @@ func TestDevcontainer(t *testing.T) { } { require.Equal(t, expected, script.Primary.Attributes[key]) } - // Verify subagent_id is a valid UUID. subagentID := script.Primary.Attributes["subagent_id"] require.NotEmpty(t, subagentID) _, err := uuid.Parse(subagentID) @@ -78,7 +77,6 @@ func TestDevcontainerNoConfigPath(t *testing.T) { } { require.Equal(t, expected, script.Primary.Attributes[key]) } - // Verify subagent_id is a valid UUID. subagentID := script.Primary.Attributes["subagent_id"] require.NotEmpty(t, subagentID) _, err := uuid.Parse(subagentID)