Skip to content

Commit

Permalink
patch - adding support for coralogix_dashboards_folder.parent_id (#207)
Browse files Browse the repository at this point in the history
  • Loading branch information
OrNovo authored Feb 22, 2024
1 parent 8b805c1 commit 271bb04
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 27 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -482,4 +482,9 @@ Bug fixing:
#### resource/coralogix_events2metric
* fixing `buckets` type-conversion bug (from float32 to float64).
#### resource/coralogix_dashboard
* fixing `time_frame.relative.duration` flattening bug when set to `seconds:0`.
* fixing `time_frame.relative.duration` flattening bug when set to `seconds:0`.

## Release 1.11.12
New Features:
#### resource/coralogix_dashboards_folder
* Adding support for `parent_id`.
45 changes: 29 additions & 16 deletions coralogix/clientset/grpc/dashboards/folder.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 13 additions & 6 deletions coralogix/resource_coralogix_dashboards_folder.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ func (r *DashboardsFolderResource) Configure(ctx context.Context, req resource.C
}

type DashboardsFolderResourceModel struct {
ID types.String `tfsdk:"id"`
Name types.String `tfsdk:"name"`
ID types.String `tfsdk:"id"`
Name types.String `tfsdk:"name"`
ParentId types.String `tfsdk:"parent_id"`
}

func (r *DashboardsFolderResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) {
Expand All @@ -79,6 +80,10 @@ func (r *DashboardsFolderResource) Schema(ctx context.Context, req resource.Sche
Optional: true,
MarkdownDescription: "Display name of the folder.",
},
"parent_id": schema.StringAttribute{
Optional: true,
MarkdownDescription: "Parent folder id.",
},
},
}
return
Expand Down Expand Up @@ -138,15 +143,17 @@ func (r *DashboardsFolderResource) Create(ctx context.Context, req resource.Crea

func flattenDashboardsFolder(folder *dashboards.DashboardFolder) DashboardsFolderResourceModel {
return DashboardsFolderResourceModel{
ID: wrapperspbStringToTypeString(folder.GetId()),
Name: wrapperspbStringToTypeString(folder.GetName()),
ID: wrapperspbStringToTypeString(folder.GetId()),
Name: wrapperspbStringToTypeString(folder.GetName()),
ParentId: wrapperspbStringToTypeString(folder.GetParentId()),
}
}

func extractCreateDashboardsFolder(plan DashboardsFolderResourceModel) *dashboards.DashboardFolder {
return &dashboards.DashboardFolder{
Id: expandUuid(plan.ID),
Name: typeStringToWrapperspbString(plan.Name),
Id: expandUuid(plan.ID),
Name: typeStringToWrapperspbString(plan.Name),
ParentId: typeStringToWrapperspbString(plan.ParentId),
}
}

Expand Down
1 change: 1 addition & 0 deletions docs/data-sources/dashboards_folder.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ description: |-
### Read-Only

- `name` (String) Display name of the folder.
- `parent_id` (String) Parent folder id.
14 changes: 13 additions & 1 deletion docs/resources/api_key.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,19 @@ description: |-

Coralogix Api keys.


## Example Usage

```hcl
resource "coralogix_api_key" "example" {
name = "My SCIM KEY"
owner = {
team_id : "<team-id>"
}
active = true
hashed = false
roles = ["SCIM", "Legacy Api Key", "Role Management", "Send Data"]
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
10 changes: 8 additions & 2 deletions docs/resources/dashboards_folder.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@ description: |-
## Example Usage

```hcl
resource "coralogix_dashboards_folder" "this" {
name = "My Folder"
resource "coralogix_dashboards_folder" "example" {
name = "example"
}
resource "coralogix_dashboards_folder" "example_2" {
name = "example2"
parent_id = coralogix_dashboards_folder.example.id
}
```

Expand All @@ -24,6 +29,7 @@ resource "coralogix_dashboards_folder" "this" {
### Optional

- `name` (String) Display name of the folder.
- `parent_id` (String) Parent folder id.

### Read-Only

Expand Down
2 changes: 1 addition & 1 deletion examples/apikeys/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ resource "coralogix_api_key" "example" {
}
active = true
hashed = false
roles = ["SCIM", "Legacy Api Key", "Role Management"]
roles = ["SCIM", "Legacy Api Key", "Role Management", "Send Data"]
}

data "coralogix_api_key" "same_key_by_id" {
Expand Down
5 changes: 5 additions & 0 deletions examples/dashboards_folder/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,9 @@ provider "coralogix" {

resource "coralogix_dashboards_folder" "example" {
name = "example"
}

resource "coralogix_dashboards_folder" "example_2" {
name = "example2"
parent_id = coralogix_dashboards_folder.example.id
}

0 comments on commit 271bb04

Please sign in to comment.