Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grafana_cloud_stack: Add influx_url #1580

Merged
merged 1 commit into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion GNUmakefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
GRAFANA_VERSION ?= 11.0.0
DOCKER_COMPOSE_ARGS ?= --force-recreate --detach --remove-orphans --wait
DOCKER_COMPOSE_ARGS ?= --force-recreate --detach --remove-orphans --wait --renew-anon-volumes

testacc:
TF_ACC=1 go test ./... -v $(TESTARGS) -timeout 120m
Expand Down
1 change: 1 addition & 0 deletions docs/data-sources/cloud_stack.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ available at “https://<stack_slug>.grafana.net".
- `graphite_url` (String)
- `graphite_user_id` (Number)
- `id` (String) The stack id assigned to this stack by Grafana.
- `influx_url` (String) Base URL of the InfluxDB instance configured for this stack. See https://grafana.com/docs/grafana-cloud/send-data/metrics/metrics-influxdb/push-from-telegraf/ for docs on how to use this.
- `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.
- `logs_name` (String)
- `logs_status` (String)
Expand Down
1 change: 1 addition & 0 deletions docs/resources/cloud_stack.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ resource "grafana_cloud_stack" "test" {
- `graphite_url` (String)
- `graphite_user_id` (Number)
- `id` (String) The stack id assigned to this stack by Grafana.
- `influx_url` (String) Base URL of the InfluxDB instance configured for this stack. See https://grafana.com/docs/grafana-cloud/send-data/metrics/metrics-influxdb/push-from-telegraf/ for docs on how to use this.
- `logs_name` (String)
- `logs_status` (String)
- `logs_url` (String)
Expand Down
9 changes: 7 additions & 2 deletions internal/resources/cloud/resource_cloud_stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,9 @@ Required access policy scopes:
"graphite_url": common.ComputedString(),
"graphite_status": common.ComputedString(),

// OTLP
"otlp_url": common.ComputedStringWithDescription("Base URL of the OTLP instance configured for this stack. See https://grafana.com/docs/grafana-cloud/send-data/otlp/send-data-otlp/ for docs on how to use this."),
// Connections
"influx_url": common.ComputedStringWithDescription("Base URL of the InfluxDB instance configured for this stack. See https://grafana.com/docs/grafana-cloud/send-data/metrics/metrics-influxdb/push-from-telegraf/ for docs on how to use this."),
"otlp_url": common.ComputedStringWithDescription("Base URL of the OTLP instance configured for this stack. See https://grafana.com/docs/grafana-cloud/send-data/otlp/send-data-otlp/ for docs on how to use this."),
},
CustomizeDiff: customdiff.All(
customdiff.ComputedIf("url", func(_ context.Context, diff *schema.ResourceDiff, meta interface{}) bool {
Expand Down Expand Up @@ -419,6 +420,10 @@ func flattenStack(d *schema.ResourceData, stack *gcom.FormattedApiInstance, conn
d.Set("otlp_url", otlpURL.Get())
}

if influxURL := connections.InfluxUrl; influxURL.IsSet() {
d.Set("influx_url", influxURL.Get())
}

return nil
}

Expand Down
1 change: 1 addition & 0 deletions internal/resources/cloud/resource_cloud_stack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ func TestResourceStack_Basic(t *testing.T) {
resource.TestCheckResourceAttrSet("grafana_cloud_stack.test", "profiles_url"),
resource.TestCheckResourceAttrSet("grafana_cloud_stack.test", "profiles_status"),
resource.TestCheckResourceAttrSet("grafana_cloud_stack.test", "otlp_url"),
resource.TestCheckResourceAttrSet("grafana_cloud_stack.test", "influx_url"),
)

resource.ParallelTest(t, resource.TestCase{
Expand Down
Loading