-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: rewrite resource_region with terraform-plugin-framework
- Loading branch information
1 parent
76efdce
commit 4a37c93
Showing
7 changed files
with
184 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package provider | ||
|
||
import ( | ||
"context" | ||
"github.com/hashicorp/terraform-plugin-framework/resource/schema/defaults" | ||
"github.com/hashicorp/terraform-plugin-framework/types" | ||
) | ||
|
||
type defaultString struct { | ||
Desc string | ||
Default string | ||
} | ||
|
||
func DefaultString(desc string, Default string) *defaultString { | ||
return &defaultString{Desc: desc, Default: Default} | ||
} | ||
|
||
func (d defaultString) Description(_ context.Context) string { | ||
return d.Desc | ||
} | ||
|
||
func (d defaultString) MarkdownDescription(_ context.Context) string { | ||
return d.Desc | ||
} | ||
|
||
func (d defaultString) DefaultString(ctx context.Context, request defaults.StringRequest, response *defaults.StringResponse) { | ||
response.PlanValue = types.StringValue(d.Default) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.