diff --git a/go.sum b/go.sum index 49289fb..ab41540 100644 --- a/go.sum +++ b/go.sum @@ -7,6 +7,7 @@ github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ= github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= @@ -33,6 +34,7 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/hil v0.0.0-20170627220502-fa9f258a9250 h1:fooK5IvDL/KIsi4LxF/JH68nVdrBSiGNPhS2JAQjtjo= github.com/hashicorp/hil v0.0.0-20170627220502-fa9f258a9250/go.mod h1:KHvg/R2/dPtaePb16oW4qIyzkMxXOL38xjRN64adsts= +github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= github.com/hashicorp/terraform v0.0.0-20170808153846-8b3b678c2fd9 h1:RBqAZm6NV1s0ZqGMJJ9rn5CTO7N4syDZgNuPRb4f2J8= github.com/hashicorp/terraform v0.0.0-20170808153846-8b3b678c2fd9/go.mod h1:uN1KUiT7Wdg61fPwsGXQwK3c8PmpIVZrt5Vcb1VrSoM= diff --git a/version b/version index 7574079..968e750 100644 --- a/version +++ b/version @@ -1 +1 @@ -v1.3.1 +v1.3.2 diff --git a/wavefront/import_dashboard_test.go b/wavefront/import_dashboard_test.go index 547cdda..73115ef 100644 --- a/wavefront/import_dashboard_test.go +++ b/wavefront/import_dashboard_test.go @@ -38,7 +38,7 @@ resource "wavefront_dashboard" "foobar" { name = "Terraform Test Dashboard" description = "a" url = "tftestimport" - + display_section_table_of_contents = true section { name = "section 1" diff --git a/wavefront/resource_dashboard.go b/wavefront/resource_dashboard.go index 01e0343..149868f 100644 --- a/wavefront/resource_dashboard.go +++ b/wavefront/resource_dashboard.go @@ -485,6 +485,10 @@ func resourceDashboard() *schema.Resource { }, "section": section, "parameter_details": parameterDetail, + "display_section_table_of_contents": { + Type: schema.TypeBool, + Optional: true, + }, "event_filter_type": { Type: schema.TypeString, Optional: true, @@ -964,15 +968,21 @@ func buildDashboard(d *schema.ResourceData) (*wavefront.Dashboard, error) { eventFilterType = e.(string) } + displayTOC := false + if toc, ok := d.GetOk("display_section_table_of_contents"); ok { + displayTOC = toc.(bool) + } + return &wavefront.Dashboard{ - Name: d.Get("name").(string), - ID: d.Get("url").(string), - Tags: tags, - Description: d.Get("description").(string), - Url: d.Get("url").(string), - Sections: *buildSections(&terraformSections), - ParameterDetails: *buildParameterDetails(&terraformParams), - EventFilterType: eventFilterType, + Name: d.Get("name").(string), + ID: d.Get("url").(string), + Tags: tags, + Description: d.Get("description").(string), + Url: d.Get("url").(string), + Sections: *buildSections(&terraformSections), + ParameterDetails: *buildParameterDetails(&terraformParams), + EventFilterType: eventFilterType, + DisplaySectionTableOfContents: displayTOC, }, nil } @@ -1025,6 +1035,8 @@ func resourceDashboardRead(d *schema.ResourceData, m interface{}) error { d.Set("description", dash.Description) d.Set("url", dash.Url) + d.Set("display_section_table_of_contents", dash.DisplaySectionTableOfContents) + sections := []map[string]interface{}{} for _, wavefrontSection := range dash.Sections { sections = append(sections, buildTerraformSection(wavefrontSection)) diff --git a/wavefront/resource_dashboard_test.go b/wavefront/resource_dashboard_test.go index 6acc0d4..258b5e4 100644 --- a/wavefront/resource_dashboard_test.go +++ b/wavefront/resource_dashboard_test.go @@ -316,6 +316,8 @@ func TestAccWavefrontDashboard_Basic(t *testing.T) { testAccCheckWavefrontDashboardExists("wavefront_dashboard.test_dashboard", &record), testAccCheckWavefrontDashboardAttributes(&record), + resource.TestCheckResourceAttr( + "wavefront_dashboard.test_dashboard", "display_section_table_of_contents", "true"), // Check against state that the attributes are as we expect resource.TestCheckResourceAttr( "wavefront_dashboard.test_dashboard", "name", "Terraform Test Dashboard"), @@ -378,6 +380,8 @@ func TestAccWavefrontDashboard_Updated(t *testing.T) { testAccCheckWavefrontDashboardAttributes(&record), resource.TestCheckResourceAttr( "wavefront_dashboard.test_dashboard", "name", "Terraform Test Dashboard"), + resource.TestCheckResourceAttr( + "wavefront_dashboard.test_dashboard", "display_section_table_of_contents", "true"), ), }, { @@ -387,6 +391,8 @@ func TestAccWavefrontDashboard_Updated(t *testing.T) { testAccCheckWavefrontDashboardAttributesUpdated(&record), resource.TestCheckResourceAttr( "wavefront_dashboard.test_dashboard", "name", "Terraform Test Dashboard Updated"), + resource.TestCheckResourceAttr( + "wavefront_dashboard.test_dashboard", "display_section_table_of_contents", "false"), ), }, }, @@ -979,7 +985,9 @@ resource "wavefront_dashboard" "test_dashboard" { name = "Terraform Test Dashboard" description = "testing, testing" url = "tftestcreate" - section { + display_section_table_of_contents = true + + section{ name = "section 1" row { chart { @@ -1023,6 +1031,7 @@ resource "wavefront_dashboard" "test_dashboard" { name = "Terraform Test Dashboard Updated" description = "testing, testing" url = "tftestcreate" + display_section_table_of_contents = false section { name = "section 1" row {