Giter Club home page Giter Club logo

pulumi-grafana's Introduction

grafana Resource Provider

The grafana resource provider for Pulumi lets you creating resources in grafana. To use this package, please install the Pulumi CLI first.

Installing

This package is available in many languages in the standard packaging formats.

Node.js (Java/TypeScript)

To use from JavaScript or TypeScript in Node.js, install using either npm:

$ npm install @pulumiverse/grafana

or yarn:

$ yarn add @pulumiverse/grafana

Python

To use from Python, install using pip:

$ pip install pulumiverse_grafana

Go

To use from Go, use go get to grab the latest version of the library

$ go get github.com/pulumiverse/pulumi-grafana/sdk/go/...

.NET

To use from Dotnet, use dotnet add package to install into your project. You must specify the version if it is a pre-release version.

$ dotnet add package Pulumiverse.Grafana

Reference

See the Pulumi registry for API docs:

https://www.pulumi.com/registry/packages/grafana/api-docs/

pulumi-grafana's People

Contributors

dependabot[bot] avatar imtomeddy avatar jaxxstorm avatar renovate[bot] avatar ringods avatar susanev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

pulumi-grafana's Issues

Plugin only works using env variables

Creating a new provider returns an error

_, err = grafana_client.NewProvider(ctx, "grafana-provider", &grafana_client.ProviderArgs{
		Auth: pulumi.String("something"),
		Url:  pulumi.String("https://web.url"),
	})
    error: could not validate provider configuration: 1 error occurred:
        * Missing required argument: "auth": one of `auth,cloud_api_key,oncall_access_token,sm_access_token` must be specified

Maybe I am doing something wrong?
Any advice?
Thanks!

(I tried v0.0.7 and v0.0.8)

OrgId is mandatory in RuleGroup while it is not in Terraform

In the documentation, most of the resources can take a OrgId as input documented like that:

The Organization ID. If not set, the Org ID defined in the provider block will be used.

But OrgId is mandatory for RuleGroup and enforced here:
https://github.com/lbrlabs/pulumi-grafana/blob/5561b3334f91460d165fb2ac938857086a0f443a/sdk/go/grafana/ruleGroup.go#L180

But on the terraform side, it is optional:
https://github.com/grafana/terraform-provider-grafana/blob/f2a3013f6cd24acfcc27fe95b020190c316bf95a/internal/resources/grafana/oss_org_id.go#L18

Since the SDK code is generated, I do not understand where the code ensuring that it is not nil comes from. Therefore, I cannot provide a pr for a fix.
I understand now: Terraform made the change not long ago:
grafana/terraform-provider-grafana@f3b1845

Is the update of the terraform provider is automated and can be triggered or a pull request must be opened ?

Upgrade the Terraform Provider from 2.4.0 to 2.13.0

The current terraform provider powering the Pulumi provider generation is 2.4.0. This should be upgraded to the latest version (currently 2.13.0) to ensure feature parity.

One feature missing that I need is grafana_sso_configuration.

Issue with http_headers in the python sdk

We are looking to adopt the plugin but when using the python flavor we are getting an error:

    import lbrlabs_pulumi_grafana as grafana
/usr/local/lib/python3.9/site-packages/lbrlabs_pulumi_grafana/__init__.py:56: in <module>
    from .provider import *
E     File "/usr/local/lib/python3.9/site-packages/lbrlabs_pulumi_grafana/provider.py", line 455
E       __props__.__dict__["http_headers"] = None if pulumi.Output.from_input(http_headers).apply(pulumi.runtime.to_json) if http_headers is not None else None is None else pulumi.Output.secret(pulumi.Output.from_input(http_headers).apply(pulumi.runtime.to_json) if http_headers is not None else None)
E                                                                                                                         ^
E   SyntaxError: invalid syntax

Looking at the code on that line it doesn't appear to be valid syntax. If we correct it in our local filesystem we are able to get around it and everything works great!

I was taking a look to see if I could resolve the issue. I removed all the references of http_headers or httpHeaders in schema.json and resources.go but everything appears to just continue to be overwritten.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

dockerfile
.devcontainer/Dockerfile
github-actions
.github/workflows/artifact-cleanup.yml
  • c-hive/gha-remove-artifacts v1
.github/workflows/command-dispatch.yml
  • actions/checkout v4
  • peter-evans/slash-command-dispatch v4
.github/workflows/main.yml
  • actions/checkout v4
  • actions/checkout v4
  • actions/setup-go v5
  • jaxxstorm/action-install-gh-release v1.11.0
  • pulumi/actions v5
  • actions/setup-node v4
  • actions/setup-dotnet v4
  • actions/setup-python v5
  • actions/download-artifact v4
  • actions/upload-artifact v4
  • actions/checkout v4
  • actions/checkout v4
  • actions/setup-go v5
  • jaxxstorm/action-install-gh-release v1.11.0
  • pulumi/actions v5
  • jaxxstorm/action-install-gh-release v1.11.0
  • actions/upload-artifact v4
  • actions/checkout v4
  • actions/checkout v4
  • actions/setup-go v5
  • jaxxstorm/action-install-gh-release v1.11.0
  • pulumi/actions v5
  • actions/setup-node v4
  • actions/setup-dotnet v4
  • actions/setup-python v5
  • actions/download-artifact v4
  • actions/download-artifact v4
.github/workflows/pr-automation.yml
  • pascalgn/automerge-action v0.16.3
.github/workflows/prerelease.yml
  • actions/checkout v4
  • actions/checkout v4
  • actions/setup-go v5
  • jaxxstorm/action-install-gh-release v1.11.0
  • pulumi/actions v5
  • actions/setup-node v4
  • actions/setup-dotnet v4
  • actions/setup-python v5
  • actions/download-artifact v4
  • actions/upload-artifact v4
  • actions/checkout v4
  • actions/checkout v4
  • actions/setup-go v5
  • jaxxstorm/action-install-gh-release v1.11.0
  • pulumi/actions v5
  • jaxxstorm/action-install-gh-release v1.11.0
  • actions/upload-artifact v4
  • actions/checkout v4
  • actions/setup-go v5
  • jaxxstorm/action-install-gh-release v1.11.0
  • pulumi/actions v5
  • goreleaser/goreleaser-action v5
  • actions/checkout v4
  • actions/checkout v4
  • actions/setup-go v5
  • jaxxstorm/action-install-gh-release v1.11.0
  • pulumi/actions v5
  • actions/setup-node v4
  • actions/setup-dotnet v4
  • actions/setup-python v5
  • actions/download-artifact v4
  • actions/download-artifact v4
  • actions/download-artifact v4
  • actions/checkout v4
  • actions/checkout v4
  • actions/setup-go v5
  • jaxxstorm/action-install-gh-release v1.11.0
  • pulumi/actions v5
  • actions/setup-node v4
  • actions/setup-dotnet v4
  • actions/setup-python v5
  • actions/download-artifact v4
  • actions/download-artifact v4
.github/workflows/pull-request.yml
  • actions/checkout v4
  • thollander/actions-comment-pull-request v2.5.0
.github/workflows/release.yml
  • actions/checkout v4
  • actions/checkout v4
  • actions/setup-go v5
  • jaxxstorm/action-install-gh-release v1.11.0
  • pulumi/actions v5
  • actions/setup-node v4
  • actions/setup-dotnet v4
  • actions/setup-python v5
  • actions/download-artifact v4
  • actions/upload-artifact v4
  • actions/checkout v4
  • actions/checkout v4
  • actions/setup-go v5
  • jaxxstorm/action-install-gh-release v1.11.0
  • pulumi/actions v5
  • jaxxstorm/action-install-gh-release v1.11.0
  • actions/upload-artifact v4
  • actions/checkout v4
  • actions/setup-go v5
  • jaxxstorm/action-install-gh-release v1.11.0
  • pulumi/actions v5
  • goreleaser/goreleaser-action v5
  • actions/checkout v4
  • actions/checkout v4
  • actions/setup-go v5
  • jaxxstorm/action-install-gh-release v1.11.0
  • pulumi/actions v5
  • actions/setup-node v4
  • actions/setup-dotnet v4
  • actions/setup-python v5
  • actions/download-artifact v4
  • actions/download-artifact v4
  • actions/download-artifact v4
  • actions/checkout v4
  • actions/checkout v4
  • actions/setup-go v5
  • jaxxstorm/action-install-gh-release v1.11.0
  • pulumi/actions v5
  • actions/setup-node v4
  • actions/setup-dotnet v4
  • actions/setup-python v5
  • actions/download-artifact v4
  • actions/download-artifact v4
.github/workflows/resync-build.yml
  • actions/checkout v4
  • actions/checkout v4
  • actions/setup-go v5
  • jaxxstorm/action-install-gh-release v1.11.0
  • pulumi/actions v5
  • actions/setup-dotnet v4
  • actions/setup-node v4
  • actions/setup-python v5
  • peter-evans/create-pull-request v6.0.5
.github/workflows/run-acceptance-tests.yml
  • actions/checkout v4
  • actions/checkout v4
  • actions/setup-go v5
  • jaxxstorm/action-install-gh-release v1.11.0
  • pulumi/actions v5
  • actions/setup-node v4
  • actions/setup-dotnet v4
  • actions/setup-python v5
  • actions/download-artifact v4
  • actions/upload-artifact v4
  • peter-evans/create-or-update-comment v4
  • actions/checkout v4
  • actions/checkout v4
  • actions/setup-go v5
  • jaxxstorm/action-install-gh-release v1.11.0
  • pulumi/actions v5
  • jaxxstorm/action-install-gh-release v1.11.0
  • actions/upload-artifact v4
  • actions/checkout v4
  • actions/checkout v4
  • actions/setup-go v5
  • jaxxstorm/action-install-gh-release v1.11.0
  • pulumi/actions v5
  • actions/setup-node v4
  • actions/setup-dotnet v4
  • actions/setup-python v5
  • actions/download-artifact v4
  • actions/download-artifact v4
.github/workflows/upgrade-bridge.yml
  • pulumi/pulumi-upgrade-provider-action v0.0.12
.github/workflows/upgrade-provider.yml
  • pulumi/pulumi-upgrade-provider-action v0.0.12
gomod
examples/go.mod
  • go 1.21
  • github.com/pulumi/pulumi/pkg/v3 v3.112.0
provider/go.mod
  • go 1.21
  • github.com/pulumi/terraform-plugin-sdk/v2 v2.0.0-20240229143312-4f60ee4e2975@4f60ee4e2975
  • github.com/grafana/terraform-provider-grafana/v2 v2.14.3
  • github.com/pulumi/pulumi-terraform-bridge/pf v0.33.0
  • github.com/pulumi/pulumi-terraform-bridge/v3 v3.80.0
  • github.com/pulumi/pulumi/sdk/v3 v3.112.0
sdk/go.mod
  • go 1.21
  • github.com/blang/semver v3.5.1+incompatible
  • github.com/pulumi/pulumi/sdk/v3 v3.112.0
npm
examples/typescript/service_account/package.json
  • @pulumi/pulumi ^3.0.0
  • @pulumi/random ^4.8.2
  • @types/node ^14
pip_requirements
examples/python/explicit_provider/requirements.txt
  • pulumi >=3.0.0,<4.0.0
  • pulumi-random >=4.0.0,<5.0.0
examples/python/service_account/requirements.txt
  • pulumi >=3.0.0,<4.0.0

  • Check this box to trigger a request for Renovate to run again on this repository

Is there a resource for an alert Rule?

Hi, pulumi-grafana authors!
I'm trying to automatically configure some grafana alerts for my infra, but following the official doc I could only find a RuleGroup resource, which is not exactly the same thing as a singular alert.
I'm wondering if I'm missing something or if there's a reason it's not implemented.

Screenshot 2023-07-11 at 3 10 45 PM

Thanks for any help!

`org_id` kwarg is ignored when creating `RuleGroup` resources

When specifying an org_id as an attribute for a RuleGroup resource, it is ignored and the rule group is always created in the org with id 1. Example (leaving the rule definitions empty for brevity):

import lbrlabs_pulumi_grafana as grafana
from pulumi import ResourceOptions

provider = grafana.Provider(
    "provider",
    auth="user:pwd",
    url="https://my.grafana.net",
)
opts = ResourceOptions(provider=provider)

org_id = "3"

folder = grafana.Folder(
    "example",
    grafana.FolderArgs(title="example", org_id=org_id),
    opts=opts,
)

grafana.RuleGroup(
    "example",
    grafana.RuleGroupArgs(
        folder_uid=folder.uid,
        interval_seconds=60,
        rules=[],
        name="example rules",
        org_id=org_id,
    ),
    opts=opts,
)

When I run this, the folder will get created in the correct org (id=3), but no rule groups show up even though pulumi thinks it has created them. If I look at the outputs for the RuleGroup resource, I see the "orgId": "1", and when I re-run the pulumi up command, the diff shows:

+-grafana:index/ruleGroup:RuleGroup: (replace)
        [id=ea7ab555-d6f9-4fcb-8482-d9842b47f9a1;example]
        [urn=urn:pulumi:cody-test::monitoring::monitoring:grafana:GrafanaHDX$grafana:index/ruleGroup:RuleGroup::example]
        [provider=urn:pulumi:cody-test::monitoring::monitoring:grafana:GrafanaHDX$pulumi:providers:grafana::cody-grafana-provider::a062207a-261a-4b8c-8ffb-3c0922b4c0d0]
      ~ orgId    : "1" => "3"

I have to hardcode the folder_uid to an id of a folder I created manually in orgId 1, but then I can see that alerts do actually get created there.

If I change the provider to use the org_id attribute as such:

provider = grafana.Provider(
    "provider",
    auth="user:pwd",
    url="https://my.grafana.net",
    org_id=3,
)

And then don't pass org_id in the RuleGroup args, things work as expected and the alerts get created in the correct org. However I get these deprecation warnings:

    warning: org_id is deprecated: Use the `org_id` attributes on resources instead.
    warning: org_id is deprecated: Use the `org_id` attributes on resources instead.
    warning: provider config warning: Use the `org_id` attributes on resources instead.
    warning: provider config warning: Use the `org_id` attributes on resources instead.

Expected Behavior:
I should be able to set org_id as a kwarg when creating a RuleGroup (like the deprecation warning suggests) and have the rules get created in the correct org

add http_headers config / disable provenance

Hi, thanks for this great provider!
I'd like to disable provenance by setting the x-disable-provenance http header (grafana/terraform-provider-grafana#845), however it appears you removed the http_headers setting from the provider settings due to some python binding issues #27 .
Is there a chance we could add the http_headers back? Or maybe simply expose a disableProvenance setting that under the hood sets these headers.
Thoughts?

Add `sdk/{{tag}}` automation

When we create a new release, we need to add a sdk/{{tag}} tag for the Go SDK.

We need this to be automated so our intrepid maintainer doesn't forget

Ability to fetch all teams

The provider (and this goes for Terraform as well) currently lacks a way to fetch all teams. It requires specifying a single team to fetch. I would like to see the ability to fetch all teams (with a getTeams function, much like getUsers). The endpoint api/teams/search can be used (with pagination) to accomplish this.

pulumi plugin install 403

Hi, it possible to play with it?

When I try pulumi plugin install resource grafana v0.0.3 is error: [resource plugin grafana-0.0.3] downloading from : failed to download plugin: grafana-0.0.3: 403 HTTP error fetching plugin from https://get.pulumi.com/releases/plugins/pulumi-resource-grafana-v0.0.3-linux-amd64.tar.gz How to deal with it?

Thanks

DestinationDatasource field cannot be nil

I started seeing this error suddenly:

Unable to Update Slo with ID: me9j8x38oo8fww5d6o9p5: API Error Message:status: 400, body: {"code":400,"error":"SLO failed validation: invalid input - DestinationDatasource field cannot be nil. please refer to the docs here: https://grafana.com/docs/grafana-cloud/alerting-and-irm/slo/set-up/terraform/#provision-slo-resources and try using a DestinationDatasourceUID of: grafanacloud-prom"}

when trying to create SLOs, this is a new error that didn't happened before. Probably something changed in grafana API

Provider does not work when auth is set via GRAFANA_AUTH and url is set in my code

I was able to get the Grafana Provider to work when I set GRAFANA_AUTH and GRAFANA_URL as env vars on my linux machine. I can also get it to work when I have both values in my code:
new grafana.Provider("provider",
{
auth: "test",
url: "test",
});

The issue occurs when I split it up. So I have GRAFANA_AUTH an an env var and then the url in my code.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.