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

Fix missing org_id of resource grafana_organization #392

Merged
merged 2 commits into from
Feb 16, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion grafana/resource_organization.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func CreateOrganization(ctx context.Context, d *schema.ResourceData, meta interf
return diag.FromErr(err)
}

return diag.Diagnostics{}
return ReadOrganization(ctx, d, meta)
}

func ReadOrganization(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
Expand All @@ -155,6 +155,7 @@ func ReadOrganization(ctx context.Context, d *schema.ResourceData, meta interfac
if err != nil {
return diag.FromErr(err)
}
d.Set("org_id", resp.ID)
d.Set("name", resp.Name)
if err := ReadUsers(d, meta); err != nil {
return diag.FromErr(err)
Expand Down
3 changes: 3 additions & 0 deletions grafana/resource_organization_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ func TestAccOrganization_basic(t *testing.T) {
resource.TestCheckResourceAttr(
"grafana_organization.test", "name", "terraform-acc-test",
),
resource.TestMatchResourceAttr(
"grafana_organization.test", "org_id", idRegexp,
),
resource.TestMatchResourceAttr(
"grafana_organization.test", "id", idRegexp,
),
Expand Down