File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,3 +30,4 @@ Define a Dev Container the agent should know of and attempt to autostart.
3030### Read-Only
3131
3232- ` id ` (String) The ID of this resource.
33+ - ` subagent_id ` (String) The ID of the subagent created for this Dev Container.
Original file line number Diff line number Diff line change @@ -17,6 +17,11 @@ func devcontainerResource() *schema.Resource {
1717 CreateContext : func (_ context.Context , rd * schema.ResourceData , _ interface {}) diag.Diagnostics {
1818 rd .SetId (uuid .NewString ())
1919
20+ // Generate a unique subagent ID for this dev container.
21+ if err := rd .Set ("subagent_id" , uuid .NewString ()); err != nil {
22+ return diag .FromErr (err )
23+ }
24+
2025 return nil
2126 },
2227 ReadContext : schema .NoopContext ,
@@ -41,6 +46,11 @@ func devcontainerResource() *schema.Resource {
4146 ForceNew : true ,
4247 Optional : true ,
4348 },
49+ "subagent_id" : {
50+ Type : schema .TypeString ,
51+ Description : "The ID of the subagent created for this Dev Container." ,
52+ Computed : true ,
53+ },
4454 },
4555 }
4656}
Original file line number Diff line number Diff line change 44 "regexp"
55 "testing"
66
7+ "github.com/google/uuid"
78 "github.com/stretchr/testify/require"
89
910 "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
@@ -39,6 +40,11 @@ func TestDevcontainer(t *testing.T) {
3940 } {
4041 require .Equal (t , expected , script .Primary .Attributes [key ])
4142 }
43+ // Verify subagent_id is a valid UUID.
44+ subagentID := script .Primary .Attributes ["subagent_id" ]
45+ require .NotEmpty (t , subagentID )
46+ _ , err := uuid .Parse (subagentID )
47+ require .NoError (t , err , "subagent_id should be a valid UUID" )
4248 return nil
4349 },
4450 }},
@@ -72,6 +78,11 @@ func TestDevcontainerNoConfigPath(t *testing.T) {
7278 } {
7379 require .Equal (t , expected , script .Primary .Attributes [key ])
7480 }
81+ // Verify subagent_id is a valid UUID.
82+ subagentID := script .Primary .Attributes ["subagent_id" ]
83+ require .NotEmpty (t , subagentID )
84+ _ , err := uuid .Parse (subagentID )
85+ require .NoError (t , err , "subagent_id should be a valid UUID" )
7586 return nil
7687 },
7788 }},
You can’t perform that action at this time.
0 commit comments