-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4a03349
commit cffe64d
Showing
53 changed files
with
1,063 additions
and
705 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
56 changes: 56 additions & 0 deletions
56
internal/planmodifiers/float32planmodifier/suppress_diff.go
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,56 @@ | ||
// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. | ||
|
||
package float32planmodifier | ||
|
||
import ( | ||
"context" | ||
"github.com/opalsecurity/terraform-provider-opal/internal/planmodifiers/utils" | ||
|
||
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" | ||
) | ||
|
||
const ( | ||
// ExplicitSuppress strategy suppresses "(known after changes)" messages unless we're in the initial creation | ||
ExplicitSuppress = iota | ||
) | ||
|
||
// SuppressDiff returns a plan modifier that propagates a state value into the planned value, when it is Known, and the Plan Value is Unknown | ||
func SuppressDiff(strategy int) planmodifier.Float32 { | ||
return suppressDiff{ | ||
strategy: strategy, | ||
} | ||
} | ||
|
||
// suppressDiff implements the plan modifier. | ||
type suppressDiff struct { | ||
strategy int | ||
} | ||
|
||
// Description returns a human-readable description of the plan modifier. | ||
func (m suppressDiff) Description(_ context.Context) string { | ||
return "Once set, the value of this attribute in state will not change." | ||
} | ||
|
||
// MarkdownDescription returns a markdown description of the plan modifier. | ||
func (m suppressDiff) MarkdownDescription(_ context.Context) string { | ||
return "Once set, the value of this attribute in state will not change." | ||
} | ||
|
||
// PlanModifyFloat32 implements the plan modification logic. | ||
func (m suppressDiff) PlanModifyFloat32(ctx context.Context, req planmodifier.Float32Request, resp *planmodifier.Float32Response) { | ||
// Do nothing if there is a known planned value. | ||
if !req.PlanValue.IsUnknown() { | ||
return | ||
} | ||
|
||
// Do nothing if there is an unknown configuration value | ||
if req.ConfigValue.IsUnknown() { | ||
return | ||
} | ||
|
||
if utils.IsAllStateUnknown(ctx, req.State) { | ||
return | ||
} | ||
|
||
resp.PlanValue = req.StateValue | ||
} |
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,56 @@ | ||
// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. | ||
|
||
package int32planmodifier | ||
|
||
import ( | ||
"context" | ||
"github.com/opalsecurity/terraform-provider-opal/internal/planmodifiers/utils" | ||
|
||
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" | ||
) | ||
|
||
const ( | ||
// ExplicitSuppress strategy suppresses "(known after changes)" messages unless we're in the initial creation | ||
ExplicitSuppress = iota | ||
) | ||
|
||
// SuppressDiff returns a plan modifier that propagates a state value into the planned value, when it is Known, and the Plan Value is Unknown | ||
func SuppressDiff(strategy int) planmodifier.Int32 { | ||
return suppressDiff{ | ||
strategy: strategy, | ||
} | ||
} | ||
|
||
// suppressDiff implements the plan modifier. | ||
type suppressDiff struct { | ||
strategy int | ||
} | ||
|
||
// Description returns a human-readable description of the plan modifier. | ||
func (m suppressDiff) Description(_ context.Context) string { | ||
return "Once set, the value of this attribute in state will not change." | ||
} | ||
|
||
// MarkdownDescription returns a markdown description of the plan modifier. | ||
func (m suppressDiff) MarkdownDescription(_ context.Context) string { | ||
return "Once set, the value of this attribute in state will not change." | ||
} | ||
|
||
// PlanModifyInt32 implements the plan modification logic. | ||
func (m suppressDiff) PlanModifyInt32(ctx context.Context, req planmodifier.Int32Request, resp *planmodifier.Int32Response) { | ||
// Do nothing if there is a known planned value. | ||
if !req.PlanValue.IsUnknown() { | ||
return | ||
} | ||
|
||
// Do nothing if there is an unknown configuration value | ||
if req.ConfigValue.IsUnknown() { | ||
return | ||
} | ||
|
||
if utils.IsAllStateUnknown(ctx, req.State) { | ||
return | ||
} | ||
|
||
resp.PlanValue = req.StateValue | ||
} |
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
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
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
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
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
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.