@@ -6,6 +6,7 @@ package provider
66import (
77 "context"
88 "fmt"
9+ "log"
910
1011 tfe "github.com/hashicorp/go-tfe"
1112 "github.com/hashicorp/terraform-plugin-framework/ephemeral"
@@ -38,12 +39,11 @@ func (e *AgentTokenEphemeralResource) Schema(ctx context.Context, req ephemeral.
3839 Attributes : map [string ]schema.Attribute {
3940 "agent_pool_id" : schema.StringAttribute {
4041 Description : `ID of the agent. If omitted, agent must be defined in the provider config.` ,
41- Optional : false ,
42- Computed : true ,
42+ Required : true ,
4343 },
4444 "description" : schema.StringAttribute {
45- Description : `The token's expiration date .` ,
46- Optional : true ,
45+ Description : `Description of the agent token .` ,
46+ Required : true ,
4747 },
4848 "token" : schema.StringAttribute {
4949 Description : `The generated token.` ,
@@ -86,9 +86,15 @@ func (e *AgentTokenEphemeralResource) Open(ctx context.Context, req ephemeral.Op
8686 return
8787 }
8888
89- agentPoolId := data .AgentPoolId .String ()
89+ agentPoolId := data .AgentPoolId .ValueString ()
90+ description := data .Description .ValueString ()
91+
92+ options := tfe.AgentTokenCreateOptions {
93+ Description : tfe .String (description ),
94+ }
9095
91- options := tfe.AgentTokenCreateOptions {}
96+ log .Printf ("[DEBUG] Create new agent token for agent pool ID: %s" , agentPoolId )
97+ log .Printf ("[DEBUG] Create new agent token with description: %s" , description )
9298
9399 result , err := e .config .Client .AgentTokens .Create (ctx , agentPoolId , options )
94100
0 commit comments