Skip to content

Commit d9c8532

Browse files
committed
fix: tfplugindocs says that attributes with Default values must be Computed
1 parent cb41030 commit d9c8532

10 files changed

+39
-2
lines changed

internal/provider/alert_channel_resource.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ func (r *AlertChannelResource) Schema(
115115
},
116116
"method": schema.StringAttribute{
117117
Optional: true,
118+
Computed: true,
118119
Default: stringdefault.StaticString("POST"),
119120
Description: "(Default `POST`)",
120121
},
@@ -187,26 +188,31 @@ func (r *AlertChannelResource) Schema(
187188
},
188189
"send_recovery": schema.BoolAttribute{
189190
Optional: true,
191+
Computed: true,
190192
Default: booldefault.StaticBool(true),
191193
Description: "(Default `true`)",
192194
},
193195
"send_failure": schema.BoolAttribute{
194196
Optional: true,
197+
Computed: true,
195198
Default: booldefault.StaticBool(true),
196199
Description: "(Default `true`)",
197200
},
198201
"send_degraded": schema.BoolAttribute{
199202
Optional: true,
203+
Computed: true,
200204
Default: booldefault.StaticBool(false),
201205
Description: "(Default `false`)",
202206
},
203207
"ssl_expiry": schema.BoolAttribute{
204208
Optional: true,
209+
Computed: true,
205210
Default: booldefault.StaticBool(false),
206211
Description: "(Default `false`)",
207212
},
208213
"ssl_expiry_threshold": schema.Int32Attribute{
209214
Optional: true,
215+
Computed: true,
210216
Default: int32default.StaticInt32(30),
211217
Validators: []validator.Int32{
212218
int32validator.Between(1, 30),

internal/provider/check_alert_settings_attribute.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ var CheckAlertSettingsAttributeSchema = schema.SingleNestedAttribute{
3131
Attributes: map[string]schema.Attribute{
3232
"escalation_type": schema.StringAttribute{
3333
Optional: true,
34+
Computed: true,
35+
Default: stringdefault.StaticString("RUN_BASED"),
3436
Validators: []validator.String{
3537
stringvalidator.OneOf("RUN_BASED", "TIME_BASED"),
3638
},
37-
Default: stringdefault.StaticString("RUN_BASED"),
3839
Description: "Determines what type of escalation to use. Possible values are `RUN_BASED` or `TIME_BASED`.",
3940
},
4041
"run_based_escalation": schema.SingleNestedAttribute{
@@ -43,6 +44,7 @@ var CheckAlertSettingsAttributeSchema = schema.SingleNestedAttribute{
4344
Attributes: map[string]schema.Attribute{
4445
"failed_run_threshold": schema.Int32Attribute{
4546
Optional: true,
47+
Computed: true,
4648
Default: int32default.StaticInt32(1),
4749
Validators: []validator.Int32{
4850
int32validator.Between(1, 5),
@@ -57,6 +59,7 @@ var CheckAlertSettingsAttributeSchema = schema.SingleNestedAttribute{
5759
Attributes: map[string]schema.Attribute{
5860
"minutes_failing_threshold": schema.Int32Attribute{
5961
Optional: true,
62+
Computed: true,
6063
Default: int32default.StaticInt32(5),
6164
Validators: []validator.Int32{
6265
int32validator.OneOf(5, 10, 15, 30),
@@ -78,6 +81,7 @@ var CheckAlertSettingsAttributeSchema = schema.SingleNestedAttribute{
7881
},
7982
"interval": schema.Int32Attribute{
8083
Optional: true,
84+
Computed: true,
8185
Default: int32default.StaticInt32(5),
8286
Validators: []validator.Int32{
8387
int32validator.OneOf(5, 10, 15, 30),
@@ -92,11 +96,13 @@ var CheckAlertSettingsAttributeSchema = schema.SingleNestedAttribute{
9296
Attributes: map[string]schema.Attribute{
9397
"enabled": schema.BoolAttribute{
9498
Optional: true,
99+
Computed: true,
95100
Default: booldefault.StaticBool(false),
96101
Description: "Applicable only for checks scheduled in parallel in multiple locations.",
97102
},
98103
"percentage": schema.Int32Attribute{
99104
Optional: true,
105+
Computed: true,
100106
Default: int32default.StaticInt32(10),
101107
Validators: []validator.Int32{
102108
int32validator.OneOf(10, 20, 30, 40, 50, 60, 70, 80, 90, 100),
@@ -111,11 +117,13 @@ var CheckAlertSettingsAttributeSchema = schema.SingleNestedAttribute{
111117
Attributes: map[string]schema.Attribute{
112118
"enabled": schema.BoolAttribute{
113119
Optional: true,
120+
Computed: true,
114121
Default: booldefault.StaticBool(false),
115122
Description: "Determines if alert notifications should be sent for expiring SSL certificates. Possible values `true`, and `false`. (Default `false`).",
116123
},
117124
"alert_threshold": schema.Int32Attribute{
118125
Optional: true,
126+
Computed: true,
119127
Default: int32default.StaticInt32(3),
120128
Validators: []validator.Int32{
121129
int32validator.OneOf(3, 7, 14, 30),

internal/provider/check_environment_variable_attribute.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ var CheckEnvironmentVariableAttributeSchema = schema.ListNestedAttribute{
4646
"default, but can be accessed by team members with the " +
4747
"appropriate permissions.",
4848
Optional: true,
49+
Computed: true,
4950
Default: booldefault.StaticBool(false),
5051
Validators: []validator.Bool{
5152
boolvalidator.ConflictsWith(
@@ -59,6 +60,7 @@ var CheckEnvironmentVariableAttributeSchema = schema.ListNestedAttribute{
5960
"However, keep in mind that your Terraform state will " +
6061
"still contain the value.",
6162
Optional: true,
63+
Computed: true,
6264
Default: booldefault.StaticBool(false),
6365
Validators: []validator.Bool{
6466
boolvalidator.ConflictsWith(

internal/provider/check_request_attribute.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ var CheckRequestAttributeSchema = schema.SingleNestedAttribute{
2222
Attributes: map[string]schema.Attribute{
2323
"method": schema.StringAttribute{
2424
Optional: true,
25+
Computed: true,
2526
Default: stringdefault.StaticString("GET"),
2627
Validators: []validator.String{
2728
stringvalidator.OneOf(
@@ -52,6 +53,7 @@ var CheckRequestAttributeSchema = schema.SingleNestedAttribute{
5253
},
5354
"body_type": schema.StringAttribute{
5455
Optional: true,
56+
Computed: true,
5557
Default: stringdefault.StaticString("NONE"),
5658
Validators: []validator.String{
5759
stringvalidator.OneOf(
@@ -68,6 +70,7 @@ var CheckRequestAttributeSchema = schema.SingleNestedAttribute{
6870
"basic_auth": CheckBasicAuthAttributeSchema,
6971
"ip_family": schema.StringAttribute{
7072
Optional: true,
73+
Computed: true,
7174
Default: stringdefault.StaticString("IPv4"),
7275
Validators: []validator.String{
7376
stringvalidator.OneOf(

internal/provider/check_resource.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,13 @@ func (r *CheckResource) Schema(
109109
"private_locations": CheckPrivateLocationsAttributeSchema,
110110
"script": schema.StringAttribute{
111111
Optional: true,
112+
Computed: true,
112113
Default: stringdefault.StaticString(""),
113114
Description: "A valid piece of Node.js JavaScript code describing a browser interaction with the Puppeteer/Playwright framework or a reference to an external JavaScript file.",
114115
},
115116
"degraded_response_time": schema.Int32Attribute{
116117
Optional: true,
118+
Computed: true,
117119
Default: int32default.StaticInt32(15000),
118120
Validators: []validator.Int32{
119121
int32validator.Between(0, 30000),
@@ -122,6 +124,7 @@ func (r *CheckResource) Schema(
122124
},
123125
"max_response_time": schema.Int32Attribute{
124126
Optional: true,
127+
Computed: true,
125128
Default: int32default.StaticInt32(30000),
126129
Validators: []validator.Int32{
127130
int32validator.Between(0, 30000),

internal/provider/check_retry_strategy_attribute.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,13 @@ var CheckRetryStrategyAttributeSchema = schema.SingleNestedAttribute{
3636
},
3737
"base_backoff_seconds": schema.Int32Attribute{
3838
Optional: true,
39+
Computed: true,
3940
Default: int32default.StaticInt32(60),
4041
Description: "The number of seconds to wait before the first retry attempt.",
4142
},
4243
"max_retries": schema.Int32Attribute{
4344
Optional: true,
45+
Computed: true,
4446
Default: int32default.StaticInt32(2),
4547
Validators: []validator.Int32{
4648
int32validator.Between(1, 10),
@@ -49,6 +51,7 @@ var CheckRetryStrategyAttributeSchema = schema.SingleNestedAttribute{
4951
},
5052
"max_duration_seconds": schema.Int32Attribute{
5153
Optional: true,
54+
Computed: true,
5255
Default: int32default.StaticInt32(600),
5356
Validators: []validator.Int32{
5457
int32validator.AtMost(600),
@@ -57,6 +60,7 @@ var CheckRetryStrategyAttributeSchema = schema.SingleNestedAttribute{
5760
},
5861
"same_region": schema.BoolAttribute{
5962
Optional: true,
63+
Computed: true,
6064
Default: booldefault.StaticBool(true),
6165
Description: "Whether retries should be run in the same region as the initial check run.",
6266
},

internal/provider/dashboard_resource.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ func (r *DashboardResource) Schema(
5959
},
6060
"custom_domain": schema.StringAttribute{
6161
Optional: true,
62+
Computed: true,
6263
Default: nil, // TODO
6364
Description: "A custom user domain, e.g. 'status.example.com'. See the docs on updating your DNS and SSL usage.",
6465
},
@@ -84,6 +85,7 @@ func (r *DashboardResource) Schema(
8485
},
8586
"width": schema.StringAttribute{
8687
Optional: true,
88+
Computed: true,
8789
Default: stringdefault.StaticString("FULL"),
8890
Validators: []validator.String{
8991
stringvalidator.OneOf("FULL", "960PX"),
@@ -92,6 +94,7 @@ func (r *DashboardResource) Schema(
9294
},
9395
"refresh_rate": schema.Int32Attribute{
9496
Optional: true,
97+
Computed: true,
9598
Default: int32default.StaticInt32(60),
9699
Validators: []validator.Int32{
97100
int32validator.OneOf(60, 300, 600),
@@ -100,16 +103,19 @@ func (r *DashboardResource) Schema(
100103
},
101104
"paginate": schema.BoolAttribute{
102105
Optional: true,
106+
Computed: true,
103107
Default: booldefault.StaticBool(true),
104108
Description: "Determines if pagination is on or off.",
105109
},
106110
"checks_per_page": schema.Int32Attribute{
107111
Optional: true,
112+
Computed: true,
108113
Default: int32default.StaticInt32(15),
109114
Description: "Determines how many checks to show per page.",
110115
},
111116
"pagination_rate": schema.Int32Attribute{
112117
Optional: true,
118+
Computed: true,
113119
Default: int32default.StaticInt32(60),
114120
Validators: []validator.Int32{
115121
int32validator.OneOf(30, 60, 300),
@@ -123,16 +129,19 @@ func (r *DashboardResource) Schema(
123129
},
124130
"hide_tags": schema.BoolAttribute{
125131
Optional: true,
132+
Computed: true,
126133
Default: booldefault.StaticBool(false),
127134
Description: "Show or hide the tags on the dashboard.",
128135
},
129136
"use_tags_and_operator": schema.BoolAttribute{
130137
Optional: true,
138+
Computed: true,
131139
Default: booldefault.StaticBool(false),
132140
Description: "Set when to use AND operator for fetching dashboard tags.",
133141
},
134142
"is_private": schema.BoolAttribute{
135143
Optional: true,
144+
Computed: true,
136145
Default: booldefault.StaticBool(false),
137146
Description: "Set your dashboard as private and generate key.",
138147
},

internal/provider/environment_variable_resource.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,13 @@ func (r *EnvironmentVariableResource) Schema(
5959
},
6060
"locked": schema.BoolAttribute{
6161
Optional: true,
62+
Computed: true,
6263
Default: booldefault.StaticBool(false),
6364
Description: "", // TODO
6465
},
6566
"secret": schema.BoolAttribute{
6667
Optional: true,
68+
Computed: true,
6769
Default: booldefault.StaticBool(false),
6870
Description: "", // TODO
6971
},

internal/provider/maintenance_windows_resource.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ func (r *MaintenanceWindowsResource) Schema(
6363
},
6464
"repeat_unit": schema.StringAttribute{
6565
Optional: true,
66-
Default: nil,
6766
Validators: []validator.String{
6867
stringvalidator.OneOf("DAY", "WEEK", "MONTH"),
6968
},

internal/provider/private_location_resource.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ func (r *PrivateLocationResource) Schema(
5959
},
6060
"icon": schema.StringAttribute{
6161
Optional: true,
62+
Computed: true,
6263
Default: stringdefault.StaticString("location"),
6364
Description: "Icon assigned to the private location.",
6465
},

0 commit comments

Comments
 (0)