-
Notifications
You must be signed in to change notification settings - Fork 231
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
Add a resource for group attribute mapping #1850
Open
IevaVasiljeva
wants to merge
17
commits into
main
Choose a base branch
from
ieva/add-resource-for-gas
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 10 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
feea53a
add TF resource for group attribute mapping
IevaVasiljeva 17a1eb8
add docs
IevaVasiljeva 204137b
Merge branch 'main' into ieva/add-resource-for-gas
IevaVasiljeva e522e6a
mere
IevaVasiljeva 2ca913b
add go.sum
IevaVasiljeva 4166172
linting
IevaVasiljeva 03398dd
update docs
IevaVasiljeva a971810
add GAS to enabled feature toggles
IevaVasiljeva 79cf46e
Merge branch 'main' into ieva/add-resource-for-gas
IevaVasiljeva 2348a6a
linting
IevaVasiljeva be98fd2
get doc test to pass
IevaVasiljeva aeb7d8c
merge main
IevaVasiljeva 6de5f3d
unneeded change
IevaVasiljeva 452e660
remove more unneeded change
IevaVasiljeva 339162d
switch to using types.set over a string array
IevaVasiljeva 661c5f2
switch test to enterprise, as GAS is an enterprise only feature
IevaVasiljeva 9c122ec
Merge branch 'main' into ieva/add-resource-for-gas
IevaVasiljeva File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "grafana_group_attribute_mapping Resource - terraform-provider-grafana" | ||
subcategory: "Grafana Enterprise" | ||
description: |- | ||
Group attribute mapping is used to map groups from an external identity provider to Grafana attributes. This resource maps groups to fixed and custom role-based access control roles. | ||
!> Warning: The resource is experimental and will be subject to change. To use the resource, you need to enable groupAttributeSync feature flag. | ||
This resource requires Grafana Enterprise or Cloud >=11.4.0. | ||
--- | ||
|
||
# grafana_group_attribute_mapping (Resource) | ||
|
||
Group attribute mapping is used to map groups from an external identity provider to Grafana attributes. This resource maps groups to fixed and custom role-based access control roles. | ||
|
||
!> Warning: The resource is experimental and will be subject to change. To use the resource, you need to enable groupAttributeSync feature flag. | ||
|
||
This resource requires Grafana Enterprise or Cloud >=11.4.0. | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
resource "grafana_role" "report_admin_role" { | ||
name = "Report Administrator" | ||
uid = "report_admin_role_uid" | ||
auto_increment_version = true | ||
permissions { | ||
action = "reports:create" | ||
} | ||
permissions { | ||
action = "reports:read" | ||
scope = "reports:*" | ||
} | ||
} | ||
|
||
resource "grafana_group_attribute_mapping" "report_admin_mapping" { | ||
group_id = "business_dev_group_id" | ||
role_uids = [grafana_role.report_admin_role.uid] | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `group_id` (String) Group ID from the identity provider. | ||
- `role_uids` (Set of String) Fixed or custom Grafana role-based access control role UIDs. | ||
|
||
### Optional | ||
|
||
- `org_id` (String) The Organization ID. If not set, the default organization is used for basic authentication, or the one that owns your service account for token authentication. | ||
|
||
### Read-Only | ||
|
||
- `id` (String) The ID of this resource. | ||
|
||
## Import | ||
|
||
Import is supported using the following syntax: | ||
|
||
```shell | ||
terraform import grafana_group_attribute_mapping.name "{{ group_id }}" | ||
terraform import grafana_group_attribute_mapping.name "{{ orgID }}:{{ group_id }}" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
terraform import grafana_group_attribute_mapping.name "{{ group_id }}" | ||
terraform import grafana_group_attribute_mapping.name "{{ orgID }}:{{ group_id }}" |
17 changes: 17 additions & 0 deletions
17
examples/resources/grafana_group_attribute_mapping/resource.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
resource "grafana_role" "report_admin_role" { | ||
name = "Report Administrator" | ||
uid = "report_admin_role_uid" | ||
auto_increment_version = true | ||
permissions { | ||
action = "reports:create" | ||
} | ||
permissions { | ||
action = "reports:read" | ||
scope = "reports:*" | ||
} | ||
} | ||
|
||
resource "grafana_group_attribute_mapping" "report_admin_mapping" { | ||
group_id = "business_dev_group_id" | ||
role_uids = [grafana_role.report_admin_role.uid] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -145,7 +145,8 @@ func putMessageTemplate(ctx context.Context, data *schema.ResourceData, meta int | |
func deleteMessageTemplate(ctx context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics { | ||
client, _, name := OAPIClientFromExistingOrgResource(meta, data.Id()) | ||
|
||
_, err := client.Provisioning.DeleteTemplate(name) | ||
params := provisioning.NewDeleteTemplateParams().WithName(name) | ||
_, err := client.Provisioning.DeleteTemplate(params) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like the openAPI spec has changed slightly for alerting. |
||
diag, _ := common.CheckReadError("message template", data, err) | ||
return diag | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't make it to automatically infer types, but I am not sure why. Let me know if you have any ideas.