Skip to content

Commit

Permalink
fix has_avatar default in object_resource
Browse files Browse the repository at this point in the history
  • Loading branch information
forevanyeung committed Nov 6, 2023
1 parent 55740b3 commit db2a3b9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/provider/object_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/hashicorp/terraform-plugin-framework/path"
"github.com/hashicorp/terraform-plugin-framework/resource"
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/booldefault"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/types"
Expand Down Expand Up @@ -137,6 +138,8 @@ func (r *objectResource) Schema(_ context.Context, _ resource.SchemaRequest, res
},
"has_avatar": schema.BoolAttribute{
Optional: true,
Computed: true,
Default: booldefault.StaticBool(false),
},
"avatar_uuid": schema.StringAttribute{
Optional: true,
Expand Down
19 changes: 19 additions & 0 deletions internal/provider/object_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,25 @@ func TestAccJiraAssetsObjectResource(t *testing.T) {
resource.TestCheckResourceAttr("jiraassets_object.test", "attributes.#", "2"),
),
},
{
Config: `resource "jiraassets_object" "test_avatar" {
type_id = "117"
attributes = [
{
attr_type_id = "1087"
attr_value = "My Phone"
},
{
attr_type_id = "1090"
attr_value = "1234657890"
}
]
has_avatar = true
}`,
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("jiraassets_object.test_avatar", "attributes.#", "2"),
),
},
},
})
}

0 comments on commit db2a3b9

Please sign in to comment.