Skip to content

Commit d7d051c

Browse files
committed
docs: clarify use of environment_variable.scopes for free-plan users
1 parent 2d522e8 commit d7d051c

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

docs/resources/environment_variable.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ resource "netlify_environment_variable" "astro_database_file" {
9494

9595
### Optional
9696

97-
- `scopes` (Set of String) One or more of builds, functions, runtime, and post-processing
97+
- `scopes` (Set of String) One or more of builds, functions, runtime, and post-processing.
98+
99+
Customizing scopes is not supported on free plans. However, free plan users managing a secret environment variable can and must explicitly set this to `["builds", "functions", "runtime"]`.
98100
- `secret_values` (Attributes Set) (see [below for nested schema](#nestedatt--secret_values))
99101
- `site_id` (String)
100102
- `team_id` (String) Required if a default team was not configured in the provider configuration.

internal/provider/environment_variable_resource.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,15 @@ type environmentVariableValueModel struct {
5252
ContextParameter types.String `tfsdk:"context_parameter"`
5353
}
5454

55-
var allScopes = []string{"builds", "functions", "runtime", "post-processing"}
56-
var allScopesValues = []attr.Value{
57-
types.StringValue("builds"),
58-
types.StringValue("functions"),
59-
types.StringValue("runtime"),
60-
types.StringValue("post-processing"),
61-
}
55+
var (
56+
allScopes = []string{"builds", "functions", "runtime", "post-processing"}
57+
allScopesValues = []attr.Value{
58+
types.StringValue("builds"),
59+
types.StringValue("functions"),
60+
types.StringValue("runtime"),
61+
types.StringValue("post-processing"),
62+
}
63+
)
6264

6365
func (r *environmentVariableResource) Metadata(_ context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) {
6466
resp.TypeName = req.ProviderTypeName + "_environment_variable"
@@ -115,7 +117,7 @@ func (r *environmentVariableResource) Schema(_ context.Context, _ resource.Schem
115117
Optional: true,
116118
Computed: true,
117119
ElementType: types.StringType,
118-
Description: "One or more of builds, functions, runtime, and post-processing",
120+
Description: "One or more of builds, functions, runtime, and post-processing.\n\nCustomizing scopes is not supported on free plans. However, free plan users managing a secret environment variable can and must explicitly set this to `[\"builds\", \"functions\", \"runtime\"]`.",
119121
Validators: []validator.Set{
120122
setvalidator.ValueStringsAre(
121123
stringvalidator.OneOf(allScopes...),

0 commit comments

Comments
 (0)