Skip to content

Commit

Permalink
feat: spaceID support tenant project variable
Browse files Browse the repository at this point in the history
  • Loading branch information
domenicsim1 committed Oct 16, 2023
1 parent 2b4a5a1 commit b8d47aa
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion octopusdeploy/resource_tenant_project_variable.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/client"
"github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/core"
"github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/tenants"
"github.com/OctopusDeploy/terraform-provider-octopusdeploy/internal/errors"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
Expand Down Expand Up @@ -37,6 +38,11 @@ func resourceTenantProjectVariable() *schema.Resource {
Required: true,
Type: schema.TypeString,
},
"space_id": {
Optional: true,
Computed: true,
Type: schema.TypeString,
},
"value": {
Default: "",
Optional: true,
Expand All @@ -55,6 +61,7 @@ func resourceTenantProjectVariableCreate(ctx context.Context, d *schema.Resource
environmentID := d.Get("environment_id").(string)
projectID := d.Get("project_id").(string)
templateID := d.Get("template_id").(string)
spaceID := d.Get("space_id").(string)
tenantID := d.Get("tenant_id").(string)
value := d.Get("value").(string)

Expand All @@ -63,7 +70,7 @@ func resourceTenantProjectVariableCreate(ctx context.Context, d *schema.Resource
log.Printf("[INFO] creating tenant project variable (%s)", id)

client := m.(*client.Client)
tenant, err := client.Tenants.GetByID(tenantID)
tenant, err := tenants.GetByID(client, spaceID, tenantID)
if err != nil {
return diag.FromErr(err)
}
Expand Down

0 comments on commit b8d47aa

Please sign in to comment.