@@ -20,9 +20,10 @@ import (
20
20
"context"
21
21
"fmt"
22
22
23
- apitypes "github.com/gravitational/teleport/api/types"
24
23
"github.com/hashicorp/terraform-plugin-framework/tfsdk"
25
24
tftypes "github.com/hashicorp/terraform-plugin-framework/types"
25
+
26
+ apitypes "github.com/gravitational/teleport/api/types"
26
27
)
27
28
28
29
const (
@@ -34,21 +35,27 @@ One way to deal with version change is to force-recreate, but this is too destru
34
35
The workaround we found was to use this plan modifier.`
35
36
)
36
37
38
+ // DefaultRoleOptions returns the default implementation of the DefaultRoleOptionsModifier
37
39
func DefaultRoleOptions () tfsdk.AttributePlanModifier {
38
40
return DefaultRoleOptionsModifier {}
39
41
}
40
42
43
+ // DefaultRoleOptionsModifier implements the tfsdk.AttributePlanModifier interface. It accounts
44
+ // for default values applied by CheckAndSetDefaults that would otherwise create inconsistent states
41
45
type DefaultRoleOptionsModifier struct {
42
46
}
43
47
48
+ // Description of the RoleOptions plan modifier
44
49
func (d DefaultRoleOptionsModifier ) Description (ctx context.Context ) string {
45
50
return DefaultRoleOptionsModifierDescription
46
51
}
47
52
53
+ // MarkdownDescription of the RoleOptions plan modifier
48
54
func (d DefaultRoleOptionsModifier ) MarkdownDescription (ctx context.Context ) string {
49
55
return DefaultRoleOptionsModifierDescription
50
56
}
51
57
58
+ // Modify the terraform plan to account for defaults applied to RoleOptions by CheckAndSetDefaults
52
59
func (d DefaultRoleOptionsModifier ) Modify (ctx context.Context , req tfsdk.ModifyAttributePlanRequest , resp * tfsdk.ModifyAttributePlanResponse ) {
53
60
var config tftypes.Object
54
61
diags := req .Config .Get (ctx , & config )
0 commit comments