Skip to content

Commit b6f981e

Browse files
authored
Add cluster slug to stack (#1998)
* Add cluster slug to stack * Add cluster slug to stack tests * Fix doc links that were moved
1 parent 55b1d88 commit b6f981e

File tree

7 files changed

+18
-12
lines changed

7 files changed

+18
-12
lines changed

docs/data-sources/cloud_stack.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ available at “https://<stack_slug>.grafana.net".
3939
- `alertmanager_status` (String) Status of the Alertmanager instance configured for this stack.
4040
- `alertmanager_url` (String) Base URL of the Alertmanager instance configured for this stack.
4141
- `alertmanager_user_id` (Number) User ID of the Alertmanager instance configured for this stack.
42+
- `cluster_slug` (String) Slug of the cluster where this stack resides.
4243
- `description` (String) Description of stack.
4344
- `graphite_name` (String)
4445
- `graphite_status` (String)

docs/index.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -274,15 +274,15 @@ resource "grafana_oncall_escalation" "example_notify_step" {
274274
#### Obtaining Cloud Provider access token
275275

276276
Before using the Terraform Provider to manage Grafana Cloud Provider Observability resources, such as AWS CloudWatch scrape jobs, you need to create an access policy token on the Grafana Cloud Portal. This token is used to authenticate the provider to the Grafana Cloud Provider API.
277-
[These docs](https://grafana.com/docs/grafana-cloud/account-management/authentication-and-permissions/access-policies/authorize-services/#create-an-access-policy-for-a-stack) will guide you on how to create
277+
[These docs](https://grafana.com/docs/grafana-cloud/account-management/authentication-and-permissions/access-policies/using-an-access-policy-token/#create-an-access-policy-for-a-stack) will guide you on how to create
278278
an access policy. The required permissions, or scopes, are `integration-management:read`, `integration-management:write` and `stacks:read`.
279279

280280
Also, by default the Access Policies UI will not show those scopes, to find name you need to use the `Add Scope` textbox, as shown in the following image:
281281

282282
<img src="https://grafana.com/media/docs/grafana-cloud/aws/cloud-provider-terraform-access-policy-creation.png" width="700"/>
283283

284284
Having created an Access Policy, you can now create a token that will be used to authenticate the provider to the Cloud Provider API. You can do so just after creating the access policy, following
285-
the in-screen instructions, of following [this guide](https://grafana.com/docs/grafana-cloud/account-management/authentication-and-permissions/access-policies/authorize-services/#create-one-or-more-access-policy-tokens).
285+
the in-screen instructions, of following [this guide](https://grafana.com/docs/grafana-cloud/account-management/authentication-and-permissions/access-policies/using-an-access-policy-token/#create-one-or-more-access-policy-tokens).
286286

287287
#### Obtaining Cloud Provider API hostname
288288

@@ -399,7 +399,7 @@ resource "grafana_cloud_provider_aws_cloudwatch_scrape_job" "test" {
399399
#### Obtaining Connections access token
400400

401401
Before using the Terraform Provider to manage Grafana Connections resources, such as metrics endpoint scrape jobs, you need to create an access policy token on the Grafana Cloud Portal. This token is used to authenticate the provider to the Grafana Connections API.
402-
[These docs](https://grafana.com/docs/grafana-cloud/account-management/authentication-and-permissions/access-policies/authorize-services/#create-an-access-policy-for-a-stack) will guide you on how to create
402+
[These docs](https://grafana.com/docs/grafana-cloud/account-management/authentication-and-permissions/access-policies/using-an-access-policy-token/#create-an-access-policy-for-a-stack) will guide you on how to create
403403
an access policy. The required permissions, or scopes, are `integration-management:read`, `integration-management:write` and `stacks:read`.
404404

405405
Also, by default the Access Policies UI will not show those scopes, instead, search for it using the `Add Scope` textbox, as shown in the following image:
@@ -410,7 +410,7 @@ Also, by default the Access Policies UI will not show those scopes, instead, sea
410410
1. Once done, you should see the scopes selected with checkboxes.
411411

412412
Having created an Access Policy, you can now create a token that will be used to authenticate the provider to the Connections API. You can do so just after creating the access policy, following
413-
the in-screen instructions, of following [this guide](https://grafana.com/docs/grafana-cloud/account-management/authentication-and-permissions/access-policies/authorize-services/#create-one-or-more-access-policy-tokens).
413+
the in-screen instructions, of following [this guide](https://grafana.com/docs/grafana-cloud/account-management/authentication-and-permissions/access-policies/using-an-access-policy-token/#create-one-or-more-access-policy-tokens).
414414

415415
#### Obtaining Connections API hostname
416416

@@ -456,7 +456,7 @@ This can be a Grafana API key, basic auth `username:password`, or a
456456

457457
### `cloud_access_policy_token`
458458

459-
An access policy token created on the [Grafana Cloud Portal](https://grafana.com/docs/grafana-cloud/account-management/authentication-and-permissions/access-policies/authorize-services/).
459+
An access policy token created on the [Grafana Cloud Portal](https://grafana.com/docs/grafana-cloud/account-management/authentication-and-permissions/access-policies/using-an-access-policy-token/).
460460

461461
### `sm_access_token`
462462

@@ -475,6 +475,6 @@ To create one, follow the instructions in the [obtaining cloud provider access t
475475

476476
### `connections_api_access_token`
477477

478-
An access policy token created on the [Grafana Cloud Portal](https://grafana.com/docs/grafana-cloud/account-management/authentication-and-permissions/access-policies/authorize-services/) to manage
478+
An access policy token created on the [Grafana Cloud Portal](https://grafana.com/docs/grafana-cloud/account-management/authentication-and-permissions/access-policies/using-an-access-policy-token/) to manage
479479
connections resources, such as Metrics Endpoint jobs.
480480
For guidance on creating one, see section [obtaining connections access token](#obtaining-connections-access-token).

docs/resources/cloud_stack.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ resource "grafana_cloud_stack" "test" {
5252
- `alertmanager_status` (String) Status of the Alertmanager instance configured for this stack.
5353
- `alertmanager_url` (String) Base URL of the Alertmanager instance configured for this stack.
5454
- `alertmanager_user_id` (Number) User ID of the Alertmanager instance configured for this stack.
55+
- `cluster_slug` (String) Slug of the cluster where this stack resides.
5556
- `graphite_name` (String)
5657
- `graphite_status` (String)
5758
- `graphite_url` (String)

internal/resources/cloud/data_source_cloud_stack_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ func TestAccDataSourceStack_Basic(t *testing.T) {
3535
resource.TestCheckResourceAttrSet("data.grafana_cloud_stack.test", "prometheus_url"),
3636
resource.TestCheckResourceAttrSet("data.grafana_cloud_stack.test", "prometheus_user_id"),
3737
resource.TestCheckResourceAttrSet("data.grafana_cloud_stack.test", "alertmanager_user_id"),
38+
resource.TestCheckResourceAttrSet("data.grafana_cloud_stack.test", "cluster_slug"),
3839
),
3940
},
4041
},

internal/resources/cloud/resource_cloud_stack.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ Required access policy scopes:
8383
return oldValue == newValue || newValue == "" // Ignore default region
8484
},
8585
},
86+
"cluster_slug": common.ComputedStringWithDescription("Slug of the cluster where this stack resides."),
8687
"url": {
8788
Type: schema.TypeString,
8889
Optional: true,
@@ -369,6 +370,7 @@ func flattenStack(d *schema.ResourceData, stack *gcom.FormattedApiInstance, conn
369370
d.Set("url", stack.Url)
370371
d.Set("status", stack.Status)
371372
d.Set("region_slug", stack.RegionSlug)
373+
d.Set("cluster_slug", stack.ClusterSlug)
372374
d.Set("description", stack.Description)
373375
d.Set("labels", stack.Labels)
374376

internal/resources/cloud/resource_cloud_stack_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ func TestResourceStack_Basic(t *testing.T) {
5252
resource.TestCheckResourceAttrSet("grafana_cloud_stack.test", "profiles_status"),
5353
resource.TestCheckResourceAttrSet("grafana_cloud_stack.test", "otlp_url"),
5454
resource.TestCheckResourceAttrSet("grafana_cloud_stack.test", "influx_url"),
55+
resource.TestCheckResourceAttrSet("grafana_cloud_stack.test", "cluster_slug"),
5556
)
5657

5758
resource.ParallelTest(t, resource.TestCase{

templates/index.md.tmpl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@ an specific `oncall_access_token` instead, that you can create in the web UI:
4242
#### Obtaining Cloud Provider access token
4343

4444
Before using the Terraform Provider to manage Grafana Cloud Provider Observability resources, such as AWS CloudWatch scrape jobs, you need to create an access policy token on the Grafana Cloud Portal. This token is used to authenticate the provider to the Grafana Cloud Provider API.
45-
[These docs](https://grafana.com/docs/grafana-cloud/account-management/authentication-and-permissions/access-policies/authorize-services/#create-an-access-policy-for-a-stack) will guide you on how to create
45+
[These docs](https://grafana.com/docs/grafana-cloud/account-management/authentication-and-permissions/access-policies/using-an-access-policy-token/#create-an-access-policy-for-a-stack) will guide you on how to create
4646
an access policy. The required permissions, or scopes, are `integration-management:read`, `integration-management:write` and `stacks:read`.
4747

4848
Also, by default the Access Policies UI will not show those scopes, to find name you need to use the `Add Scope` textbox, as shown in the following image:
4949

5050
<img src="https://grafana.com/media/docs/grafana-cloud/aws/cloud-provider-terraform-access-policy-creation.png" width="700"/>
5151

5252
Having created an Access Policy, you can now create a token that will be used to authenticate the provider to the Cloud Provider API. You can do so just after creating the access policy, following
53-
the in-screen instructions, of following [this guide](https://grafana.com/docs/grafana-cloud/account-management/authentication-and-permissions/access-policies/authorize-services/#create-one-or-more-access-policy-tokens).
53+
the in-screen instructions, of following [this guide](https://grafana.com/docs/grafana-cloud/account-management/authentication-and-permissions/access-policies/using-an-access-policy-token/#create-one-or-more-access-policy-tokens).
5454

5555
#### Obtaining Cloud Provider API hostname
5656

@@ -97,7 +97,7 @@ The following are examples on how the *Account* and *Scrape Job* resources can b
9797
#### Obtaining Connections access token
9898

9999
Before using the Terraform Provider to manage Grafana Connections resources, such as metrics endpoint scrape jobs, you need to create an access policy token on the Grafana Cloud Portal. This token is used to authenticate the provider to the Grafana Connections API.
100-
[These docs](https://grafana.com/docs/grafana-cloud/account-management/authentication-and-permissions/access-policies/authorize-services/#create-an-access-policy-for-a-stack) will guide you on how to create
100+
[These docs](https://grafana.com/docs/grafana-cloud/account-management/authentication-and-permissions/access-policies/using-an-access-policy-token/#create-an-access-policy-for-a-stack) will guide you on how to create
101101
an access policy. The required permissions, or scopes, are `integration-management:read`, `integration-management:write` and `stacks:read`.
102102

103103
Also, by default the Access Policies UI will not show those scopes, instead, search for it using the `Add Scope` textbox, as shown in the following image:
@@ -108,7 +108,7 @@ Also, by default the Access Policies UI will not show those scopes, instead, sea
108108
1. Once done, you should see the scopes selected with checkboxes.
109109

110110
Having created an Access Policy, you can now create a token that will be used to authenticate the provider to the Connections API. You can do so just after creating the access policy, following
111-
the in-screen instructions, of following [this guide](https://grafana.com/docs/grafana-cloud/account-management/authentication-and-permissions/access-policies/authorize-services/#create-one-or-more-access-policy-tokens).
111+
the in-screen instructions, of following [this guide](https://grafana.com/docs/grafana-cloud/account-management/authentication-and-permissions/access-policies/using-an-access-policy-token/#create-one-or-more-access-policy-tokens).
112112

113113
#### Obtaining Connections API hostname
114114

@@ -154,7 +154,7 @@ This can be a Grafana API key, basic auth `username:password`, or a
154154

155155
### `cloud_access_policy_token`
156156

157-
An access policy token created on the [Grafana Cloud Portal](https://grafana.com/docs/grafana-cloud/account-management/authentication-and-permissions/access-policies/authorize-services/).
157+
An access policy token created on the [Grafana Cloud Portal](https://grafana.com/docs/grafana-cloud/account-management/authentication-and-permissions/access-policies/using-an-access-policy-token/).
158158

159159
### `sm_access_token`
160160

@@ -173,6 +173,6 @@ To create one, follow the instructions in the [obtaining cloud provider access t
173173

174174
### `connections_api_access_token`
175175

176-
An access policy token created on the [Grafana Cloud Portal](https://grafana.com/docs/grafana-cloud/account-management/authentication-and-permissions/access-policies/authorize-services/) to manage
176+
An access policy token created on the [Grafana Cloud Portal](https://grafana.com/docs/grafana-cloud/account-management/authentication-and-permissions/access-policies/using-an-access-policy-token/) to manage
177177
connections resources, such as Metrics Endpoint jobs.
178178
For guidance on creating one, see section [obtaining connections access token](#obtaining-connections-access-token).

0 commit comments

Comments
 (0)