Skip to content
This repository has been archived by the owner on Jun 1, 2023. It is now read-only.

Commit

Permalink
feat: fix graylog_view (wip)
Browse files Browse the repository at this point in the history
  • Loading branch information
suzuki-shunsuke committed Apr 16, 2020
1 parent 567b45e commit a6912da
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 25 deletions.
17 changes: 11 additions & 6 deletions terraform/example/v0.12/view.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# resource "graylog_view" "test" {
# title = "test"
# description = "description"
# summary = "summary"
# # set appropriate search_id
# search_id = "5d9529b275d97f58f9539279"
resource "graylog_view" "test" {
title = "test"
description = "description"
summary = "summary"
# set appropriate search_id
# search_id = "5d9529b275d97f58f9539279"
# state = {
# "6971d00a-e605-43fb-b873-e4bca773d286" = {
# selected_fields = ["source", "message"]
# }
# }
}
113 changes: 94 additions & 19 deletions terraform/graylog/resource_view.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ func resourceView() *schema.Resource {
Type: schema.TypeString,
Required: true,
},

"search_id": {
Type: schema.TypeString,
Required: true,
Expand All @@ -33,52 +34,126 @@ func resourceView() *schema.Resource {
"state": {
Type: schema.TypeMap,
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
MinItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"selected_fields": {
Type: schema.TypeList,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"selected_fields": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},

"titles": {
Type: schema.TypeMap,
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeMap,
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
},

"widget_mapping": {
Type: schema.TypeMap,
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeList,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
},

"widgets": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"id": {
Type: schema.TypeString,
Optional: true,
},

// "aggregation_config": {
// Type: schema.TypeList,
// Optional: true,
// MaxItems: 1,
// MinItems: 1,
// Elem: &schema.Resource{
// },
// },
},
},
},

"positions": {
Type: schema.TypeMap,
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
MinItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
// "width": {
// Type: schema.TypeInt,
// Optional: true,
// },
"col": {
Type: schema.TypeInt,
Optional: true,
},
"row": {
Type: schema.TypeInt,
Optional: true,
},
"height": {
Type: schema.TypeInt,
Optional: true,
},
},
},
},
},
},
},
},

"summary": {
Type: schema.TypeString,
Optional: true,
},

"description": {
Type: schema.TypeString,
Optional: true,
},

"owner": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},
// outputs

"created_at": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"dashboard_state": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
MinItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{},
},
},

// "dashboard_state": {
// Type: schema.TypeList,
// Optional: true,
// MaxItems: 1,
// MinItems: 1,
// Elem: &schema.Resource{
// Schema: map[string]*schema.Schema{},
// },
// },
},
}
}
Expand Down

0 comments on commit a6912da

Please sign in to comment.