Skip to content

Commit c63db55

Browse files
radioheadDuologic
andauthored
Add support for app platform resources (#2076)
* Update linter version and address the issues Signed-off-by: Igor Suleymanov <[email protected]> * Add support for app platform resources Signed-off-by: Igor Suleymanov <[email protected]> * Use app platform API clients from the app SDK Signed-off-by: Igor Suleymanov <[email protected]> * Add a TODO to address panic when setting up TLS Signed-off-by: Igor Suleymanov <[email protected]> * Fix TLS config handling Signed-off-by: Igor Suleymanov <[email protected]> * Update docs with auto-generated content Signed-off-by: Igor Suleymanov <[email protected]> * Fix linter error Signed-off-by: Igor Suleymanov <[email protected]> * Use system cert pool for TLS Signed-off-by: Igor Suleymanov <[email protected]> * Remove linting and client-side validation Signed-off-by: Igor Suleymanov <[email protected]> * Set manager annotations when creating & updating Signed-off-by: Igor Suleymanov <[email protected]> * Handle not found errors properly Signed-off-by: Igor Suleymanov <[email protected]> * Comment out LBAC example for now Signed-off-by: Igor Suleymanov <[email protected]> * Update code owners for app platform resources Signed-off-by: Igor Suleymanov <[email protected]> * Remove unused code Signed-off-by: Igor Suleymanov <[email protected]> * Apply suggestions from code review Co-authored-by: Jeroen Op 't Eynde <[email protected]> * Revert whitespace changes in examples Signed-off-by: Igor Suleymanov <[email protected]> * Apply feedback from PR review Signed-off-by: Igor Suleymanov <[email protected]> * Mark resources as experimental for now Signed-off-by: Igor Suleymanov <[email protected]> * Apply suggestions from the code review Signed-off-by: Igor Suleymanov <[email protected]> * Add test setup for Grafana app platform resources Signed-off-by: Igor Suleymanov <[email protected]> * Update docs Signed-off-by: Igor Suleymanov <[email protected]> --------- Signed-off-by: Igor Suleymanov <[email protected]> Co-authored-by: Jeroen Op 't Eynde <[email protected]>
1 parent e7dfc61 commit c63db55

28 files changed

+3181
-222
lines changed

.github/CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@
1212
/internal/resources/oncall/* @grafana/platform-monitoring @grafana/grafana-irm-backend
1313
/internal/resources/slo/* @grafana/platform-monitoring @grafana/slo-squad
1414
/internal/resources/syntheticmonitoring/* @grafana/platform-monitoring @grafana/synthetic-monitoring
15+
/internal/resources/appplatform/* @grafana/platform-monitoring @grafana/grafana-app-platform-squad

.golangci.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ min-occurrences = 5
99
disable-all = true
1010
enable = [
1111
"dogsled",
12-
"exportloopref",
12+
"copyloopvar",
1313
"goconst",
1414
"gocritic",
1515
"gocyclo",

GNUmakefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ golangci-lint:
6565
--rm \
6666
--volume "$(shell pwd):/src" \
6767
--workdir "/src" \
68-
golangci/golangci-lint:v1.61.0 golangci-lint run ./... -v
68+
golangci/golangci-lint:v1.64.7 golangci-lint run ./... -v
6969

7070
docs:
7171
go generate ./...

docs/index.md

+2
Original file line numberDiff line numberDiff line change
@@ -282,11 +282,13 @@ provider "grafana" {
282282
- `insecure_skip_verify` (Boolean) Skip TLS certificate verification. May alternatively be set via the `GRAFANA_INSECURE_SKIP_VERIFY` environment variable.
283283
- `oncall_access_token` (String, Sensitive) A Grafana OnCall access token. May alternatively be set via the `GRAFANA_ONCALL_ACCESS_TOKEN` environment variable.
284284
- `oncall_url` (String) An Grafana OnCall backend address. May alternatively be set via the `GRAFANA_ONCALL_URL` environment variable.
285+
- `org_id` (Number) The Grafana org ID, if you are using a self-hosted OSS or enterprise Grafana instance. May alternatively be set via the `GRAFANA_ORG_ID` environment variable.
285286
- `retries` (Number) The amount of retries to use for Grafana API and Grafana Cloud API calls. May alternatively be set via the `GRAFANA_RETRIES` environment variable.
286287
- `retry_status_codes` (Set of String) The status codes to retry on for Grafana API and Grafana Cloud API calls. Use `x` as a digit wildcard. Defaults to 429 and 5xx. May alternatively be set via the `GRAFANA_RETRY_STATUS_CODES` environment variable.
287288
- `retry_wait` (Number) The amount of time in seconds to wait between retries for Grafana API and Grafana Cloud API calls. May alternatively be set via the `GRAFANA_RETRY_WAIT` environment variable.
288289
- `sm_access_token` (String, Sensitive) A Synthetic Monitoring access token. May alternatively be set via the `GRAFANA_SM_ACCESS_TOKEN` environment variable.
289290
- `sm_url` (String) Synthetic monitoring backend address. May alternatively be set via the `GRAFANA_SM_URL` environment variable. The correct value for each service region is cited in the [Synthetic Monitoring documentation](https://grafana.com/docs/grafana-cloud/testing/synthetic-monitoring/set-up/set-up-private-probes/#probe-api-server-url). Note the `sm_url` value is optional, but it must correspond with the value specified as the `region_slug` in the `grafana_cloud_stack` resource. Also note that when a Terraform configuration contains multiple provider instances managing SM resources associated with the same Grafana stack, specifying an explicit `sm_url` set to the same value for each provider ensures all providers interact with the same SM API.
291+
- `stack_id` (Number) The Grafana stack ID, if you are using a Grafana Cloud stack. May alternatively be set via the `GRAFANA_STACK_ID` environment variable.
290292
- `store_dashboard_sha256` (Boolean) Set to true if you want to save only the sha256sum instead of complete dashboard model JSON in the tfstate.
291293
- `tls_cert` (String) Client TLS certificate (file path or literal value) to use to authenticate to the Grafana server. May alternatively be set via the `GRAFANA_TLS_CERT` environment variable.
292294
- `tls_key` (String) Client TLS key (file path or literal value) to use to authenticate to the Grafana server. May alternatively be set via the `GRAFANA_TLS_KEY` environment variable.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "grafana_apps_dashboard_dashboard_v1alpha1 Resource - terraform-provider-grafana"
4+
subcategory: ""
5+
description: |-
6+
Manages Grafana dashboards via the new Grafana App Platform API. This resource is currently EXPERIMENTAL and may be subject to change. It requires a development build of Grafana with specific feature flags enabled.
7+
---
8+
9+
# grafana_apps_dashboard_dashboard_v1alpha1 (Resource)
10+
11+
Manages Grafana dashboards via the new Grafana App Platform API. This resource is currently **EXPERIMENTAL** and may be subject to change. It requires a development build of Grafana with specific feature flags enabled.
12+
13+
14+
15+
<!-- schema generated by tfplugindocs -->
16+
## Schema
17+
18+
### Optional
19+
20+
- `metadata` (Block, Optional) The metadata of the resource. (see [below for nested schema](#nestedblock--metadata))
21+
- `options` (Block, Optional) Options for applying the resource. (see [below for nested schema](#nestedblock--options))
22+
- `spec` (Block, Optional) The spec of the resource. (see [below for nested schema](#nestedblock--spec))
23+
24+
<a id="nestedblock--metadata"></a>
25+
### Nested Schema for `metadata`
26+
27+
Required:
28+
29+
- `uid` (String) The unique identifier of the resource.
30+
31+
Optional:
32+
33+
- `folder_uid` (String) The UID of the folder to save the resource in.
34+
35+
Read-Only:
36+
37+
- `url` (String) The full URL of the resource.
38+
- `uuid` (String) The globally unique identifier of a resource, used by the API for tracking.
39+
- `version` (String) The version of the resource.
40+
41+
42+
<a id="nestedblock--options"></a>
43+
### Nested Schema for `options`
44+
45+
Optional:
46+
47+
- `overwrite` (Boolean) Set to true if you want to overwrite existing resource with newer version, same resource title in folder or same resource uid.
48+
49+
50+
<a id="nestedblock--spec"></a>
51+
### Nested Schema for `spec`
52+
53+
Required:
54+
55+
- `json` (String) The JSON representation of the dashboard spec.
56+
57+
Optional:
58+
59+
- `tags` (List of String) The tags of the dashboard. If not set, the tags will be derived from the JSON spec.
60+
- `title` (String) The title of the dashboard. If not set, the title will be derived from the JSON spec.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "grafana_apps_playlist_playlist_v0alpha1 Resource - terraform-provider-grafana"
4+
subcategory: ""
5+
description: |-
6+
Manages Grafana playlists via the new Grafana App Platform API. This resource is currently EXPERIMENTAL and may be subject to change. It requires a development build of Grafana with specific feature flags enabled.
7+
---
8+
9+
# grafana_apps_playlist_playlist_v0alpha1 (Resource)
10+
11+
Manages Grafana playlists via the new Grafana App Platform API. This resource is currently **EXPERIMENTAL** and may be subject to change. It requires a development build of Grafana with specific feature flags enabled.
12+
13+
14+
15+
<!-- schema generated by tfplugindocs -->
16+
## Schema
17+
18+
### Optional
19+
20+
- `metadata` (Block, Optional) The metadata of the resource. (see [below for nested schema](#nestedblock--metadata))
21+
- `options` (Block, Optional) Options for applying the resource. (see [below for nested schema](#nestedblock--options))
22+
- `spec` (Block, Optional) The spec of the resource. (see [below for nested schema](#nestedblock--spec))
23+
24+
<a id="nestedblock--metadata"></a>
25+
### Nested Schema for `metadata`
26+
27+
Required:
28+
29+
- `uid` (String) The unique identifier of the resource.
30+
31+
Optional:
32+
33+
- `folder_uid` (String) The UID of the folder to save the resource in.
34+
35+
Read-Only:
36+
37+
- `url` (String) The full URL of the resource.
38+
- `uuid` (String) The globally unique identifier of a resource, used by the API for tracking.
39+
- `version` (String) The version of the resource.
40+
41+
42+
<a id="nestedblock--options"></a>
43+
### Nested Schema for `options`
44+
45+
Optional:
46+
47+
- `overwrite` (Boolean) Set to true if you want to overwrite existing resource with newer version, same resource title in folder or same resource uid.
48+
49+
50+
<a id="nestedblock--spec"></a>
51+
### Nested Schema for `spec`
52+
53+
Required:
54+
55+
- `items` (List of Object) The items of the playlist. (see [below for nested schema](#nestedatt--spec--items))
56+
- `title` (String) The title of the playlist.
57+
58+
Optional:
59+
60+
- `interval` (String) The interval of the playlist.
61+
62+
<a id="nestedatt--spec--items"></a>
63+
### Nested Schema for `spec.items`
64+
65+
Required:
66+
67+
- `type` (String)
68+
- `value` (String)

0 commit comments

Comments
 (0)