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

org_id kwarg is ignored when creating RuleGroup resources #111

Open
codyhydrolix opened this issue Jan 5, 2024 · 1 comment
Open

org_id kwarg is ignored when creating RuleGroup resources #111

codyhydrolix opened this issue Jan 5, 2024 · 1 comment

Comments

@codyhydrolix
Copy link

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

@ringods
Copy link
Member

ringods commented Apr 15, 2024

@codyhydrolix Can you retry with version v0.4.0 (or later) and report if it solves your problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants