Skip to content

Commit 6dd6e6d

Browse files
Allow underscore on stack labels and values for labels. (#2379)
1 parent 7d36d0e commit 6dd6e6d

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

docs/data-sources/cloud_stack.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ available at “https://<stack_slug>.grafana.net".
5959
- `graphite_user_id` (Number)
6060
- `id` (String) The stack id assigned to this stack by Grafana.
6161
- `influx_url` (String) Base URL of the InfluxDB instance configured for this stack. The username is the same as the metrics' (`prometheus_user_id` attribute of this resource). See https://grafana.com/docs/grafana-cloud/send-data/metrics/metrics-influxdb/push-from-telegraf/ for docs on how to use this.
62-
- `labels` (Map of String) A map of labels to assign to the stack. Label keys and values must match the following regexp: "^[a-zA-Z0-9/\\-.]+$" and stacks cannot have more than 10 labels.
62+
- `labels` (Map of String) A map of labels to assign to the stack. Label keys and values must match the following regexp: "^[a-zA-Z0-9/\\-._]+$" and stacks cannot have more than 10 labels.
6363
- `logs_ip_allow_list_cname` (String) Comma-separated list of CNAMEs that can be whitelisted to access the Logs instance (Optional)
6464
- `logs_name` (String)
6565
- `logs_private_connectivity_info_private_dns` (String) Private DNS for Logs when using AWS PrivateLink (only for AWS stacks)

docs/resources/cloud_stack.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ resource "grafana_cloud_stack" "test" {
4141

4242
- `delete_protection` (Boolean) Whether to enable delete protection for the stack, preventing accidental deletion. Defaults to `true`.
4343
- `description` (String) Description of stack.
44-
- `labels` (Map of String) A map of labels to assign to the stack. Label keys and values must match the following regexp: "^[a-zA-Z0-9/\\-.]+$" and stacks cannot have more than 10 labels.
44+
- `labels` (Map of String) A map of labels to assign to the stack. Label keys and values must match the following regexp: "^[a-zA-Z0-9/\\-._]+$" and stacks cannot have more than 10 labels.
4545
- `region_slug` (String) Region slug to assign to this stack. Changing region will destroy the existing stack and create a new one in the desired region. Use the region list API to get the list of available regions: https://grafana.com/docs/grafana-cloud/developer-resources/api-reference/cloud-api/#list-regions.
4646
- `url` (String) Custom URL for the Grafana instance. Must have a CNAME setup to point to `.grafana.net` before creating the stack
4747
- `wait_for_readiness` (Boolean) Whether to wait for readiness of the stack after creating it. The check is a HEAD request to the stack URL (Grafana instance). Defaults to `true`.

internal/resources/cloud/resource_cloud_stack.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323
const defaultReadinessTimeout = time.Minute * 5
2424

2525
var (
26-
stackLabelRegex = regexp.MustCompile(`^[a-zA-Z0-9/\-.]+$`)
26+
stackLabelRegex = regexp.MustCompile(`^[a-zA-Z0-9/\-._]+$`)
2727
stackSlugRegex = regexp.MustCompile(`^[a-z][a-z0-9]+$`)
2828
resourceStackID = common.NewResourceID(common.StringIDField("stackSlugOrID"))
2929
)

internal/resources/cloud/resource_cloud_stack_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,10 @@ func TestResourceStack_Invalid(t *testing.T) {
176176
name = "test"
177177
slug = "test"
178178
labels = {
179-
invalid_key = "true" // Can't have an underscore
179+
"invalid_key!" = "true" // Can't have an underscore
180180
}
181181
}`,
182-
ExpectError: regexp.MustCompile(`Error: label key "invalid_key" does not match .+"`),
182+
ExpectError: regexp.MustCompile(`Error: label key "invalid_key!" does not match .+"`),
183183
},
184184
{
185185
Config: `resource "grafana_cloud_stack" "test" {

provider_schema.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)