splunk / terraform-provider-splunk

Terraform Provider for Splunk
Mozilla Public License 2.0
104 stars 78 forks source link

authorization/roles srchIndexesAllowed and srchIndexesDefault should be lists #20

Closed bedinger closed 4 years ago

bedinger commented 4 years ago

The authorization/roles API allows for lists of indexes to be provided for srchIndexesAllowed and srchIndexesDefault but the provider treats them as strings. This means only one index value can be provided. By comparison, capabilities is treated appropriately as a list.

The below, for example, works. A single string can be provided for search_indexes_allowed and/or search_indexes_default.

resource "splunk_authorization_roles" "role01" {
  name           = "terraform-user01-role"
  default_app    = "search"
  imported_roles = ["power", "user"]
  capabilities   = ["accelerate_datamodel", "change_authentication", "restart_splunkd"]
  search_indexes_allowed = "main"
  search_indexes_default = "main"
}

This, however, should work, in order to better fit the functionality provided by the API:

resource "splunk_authorization_roles" "role01" {
  name           = "terraform-user01-role"
  default_app    = "search"
  imported_roles = ["power", "user"]
  capabilities   = ["accelerate_datamodel", "change_authentication", "restart_splunkd"]
  search_indexes_allowed = ["_audit", "_internal", "main"]
  search_indexes_default = ["_audit", "_internal", "main"]
}

There's also a copy-paste issue in the documentation for splunk_authorization_role - the example usage seems to be from the splunk_authentication_users documentation.

bedinger commented 4 years ago

21

anushjay commented 4 years ago

@bedinger Your changes should be available in v1.3.0 of the provider. Thank you for contributing!