Skip to content

Commit 9114f04

Browse files
committed
Added default organization to fix issue when org is set then omitted
1 parent 98c760d commit 9114f04

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

internal/provider/inventory_resource.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"github.com/hashicorp/terraform-plugin-framework/diag"
1212
"github.com/hashicorp/terraform-plugin-framework/resource"
1313
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
14+
"github.com/hashicorp/terraform-plugin-framework/resource/schema/int64default"
1415
"github.com/hashicorp/terraform-plugin-framework/resource/schema/int64planmodifier"
1516
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
1617
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
@@ -95,6 +96,7 @@ func (r *InventoryResource) Schema(_ context.Context, _ resource.SchemaRequest,
9596
"organization": schema.Int64Attribute{
9697
Computed: true,
9798
Optional: true,
99+
Default: int64default.StaticInt64(1),
98100
PlanModifiers: []planmodifier.Int64{
99101
int64planmodifier.RequiresReplaceIfConfigured(),
100102
},
@@ -103,9 +105,6 @@ func (r *InventoryResource) Schema(_ context.Context, _ resource.SchemaRequest,
103105
},
104106
"organization_name": schema.StringAttribute{
105107
Computed: true,
106-
PlanModifiers: []planmodifier.String{
107-
stringplanmodifier.UseStateForUnknown(),
108-
},
109108
Description: "Name for the organization.",
110109
},
111110
"url": schema.StringAttribute{

internal/provider/inventory_resource_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ resource "aap_inventory" "test" {
241241
}`, name)
242242
}
243243

244-
// testAccInventoryResourceComplete returns a configuration for an AAP Inventory with the provided name and all options.
244+
// testAccInventoryResourceWithOrg returns a configuration for an AAP Inventory with the provided name, organization and all options.
245245
func testAccInventoryResourceWithOrg(name string, org string) string {
246246
return fmt.Sprintf(`
247247
resource "aap_inventory" "test" {

0 commit comments

Comments
 (0)