Skip to content

Commit

Permalink
add utility for number type data source id
Browse files Browse the repository at this point in the history
  • Loading branch information
mschuchard committed Jul 30, 2024
1 parent 08fae85 commit 0779ca8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions internal/id_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package util

import (
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/int64planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
)
Expand All @@ -15,3 +16,13 @@ func IDStringAttribute() schema.StringAttribute {
},
}
}

func IDIntAttribute() schema.Int64Attribute {
return schema.Int64Attribute{
Computed: true,
Description: "Aliased to number input parameter(s) for efficiency and proper plan diff detection.",
PlanModifiers: []planmodifier.Int64{
int64planmodifier.UseStateForUnknown(),
},
}
}

0 comments on commit 0779ca8

Please sign in to comment.