Skip to content
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

Shared Dashboard Resource #4357

Merged

Conversation

damoodamoo
Copy link
Contributor

@damoodamoo damoodamoo commented Sep 18, 2019

Initial PR for review. References issue #3887 .

Allows azure portal dashboards to be defined and created / updated / destroyed. Example .tf configuration:

    data "azurerm_subscription" "current" {}
    resource "azurerm_resource_group" "my-group"{
        name = "mygroup"
        location = "uksouth"
    }

    resource "azurerm_dashboard" "my-board" {
        name                       = "my-shared-dashboard"
        resource_group_name        = azurerm_resource_group.my-group.name
        location                   = azurerm_resource_group.my-group.location
        dashboard_properties       = <<DASH
{
   "lenses": {
        "0": {
            "order": 0,
            "parts": {
                "0": {
                    "position": {
                        "x": 0,
                        "y": 0,
                        "rowSpan": 2,
                        "colSpan": 3
                    },
                    "metadata": {
                        "inputs": [],
                        "type": "Extension/HubsExtension/PartType/MarkdownPart",
                        "settings": {
                            "content": {
                                "settings": {
                                    "content": "${var.md_content}",
                                    "subtitle": "",
                                    "title": ""
                                }
                            }
                        }
                    }
                },
                "1": {
                    "position": {
                        "x": 3,
                        "y": 0,
                        "rowSpan": 2,
                        "colSpan": 2
                    },
                    "metadata": {
                        "inputs": [],
                        "type": "Extension/HubsExtension/PartType/ClockPart",
                        "settings": {
                            "content": {
                                "settings": {
                                    "location": "Central Europe Standard Time",
                                    "timezoneId": "UTC",
                                    "timeFormat": "h:mmA",
                                    "version": 1
                                }
                            }
                        }
                    }
                },
                "2": {
                    "position": {
                        "x": 5,
                        "y": 0,
                        "rowSpan": 4,
                        "colSpan": 6
                    },
                    "metadata": {
                        "inputs": [],
                        "type": "Extension/HubsExtension/PartType/VideoPart",
                        "settings": {
                            "content": {
                                "settings": {
                                    "title": "Important Information",
                                    "subtitle": "",
                                    "src": "${var.video_link}",
                                    "autoplay": true
                                }
                            }
                        }
                    }
                },
                "3": {
                    "position": {
                        "x": 0,
                        "y": 4,
                        "rowSpan": 4,
                        "colSpan": 6
                    },
                    "metadata": {
                        "inputs": [
                            {
                                "name": "ComponentId",
                                "value": "/subscriptions/${data.azurerm_subscription.current.subscription_id}/resourceGroups/myRG/providers/microsoft.insights/components/mywebapp"
                            }
                        ],
                        "type": "Extension/AppInsightsExtension/PartType/AppMapGalPt",
                        "settings": {},
                        "asset": {
                            "idInputName": "ComponentId",
                            "type": "ApplicationInsights"
                        }
                    }
                },
                "4": {
                    "position": {
                        "x": 6,
                        "y": 4,
                        "rowSpan": 4,
                        "colSpan": 6
                    },
                    "metadata": {
                        "inputs": [
                            {
                                "name": "resourceType",
                                "value": "Microsoft.Resources/subscriptions/resourcegroups",
                                "isOptional": true
                            },
                            {
                                "name": "filter",
                                "isOptional": true
                            },
                            {
                                "name": "scope",
                                "isOptional": true
                            },
                            {
                                "name": "kind",
                                "isOptional": true
                            }
                        ],
                        "type": "Extension/HubsExtension/PartType/BrowseResourceGroupPinnedPart"
                    }
                }
            }
        }
    },
    "metadata": {
        "model": {
            "timeRange": {
                "value": {
                    "relative": {
                        "duration": 24,
                        "timeUnit": 1
                    }
                },
                "type": "MsPortalFx.Composition.Configuration.ValueTypes.TimeRange"
            },
            "filterLocale": {
                "value": "en-us"
            },
            "filters": {
                "value": {
                    "MsPortalFx_TimeRange": {
                        "model": {
                            "format": "utc",
                            "granularity": "auto",
                            "relative": "24h"
                        },
                        "displayCache": {
                            "name": "UTC Time",
                            "value": "Past 24 hours"
                        },
                        "filteredPartIds": [
                            "StartboardPart-UnboundPart-ae44fef5-76b8-46b0-86f0-2b3f47bad1c7"
                        ]
                    }
                }
            }
        }
    }
}
DASH
    }

Fixes #3887

@ghost ghost added the size/XL label Sep 18, 2019
@damoodamoo damoodamoo changed the title Dashboard Provider Review Dashboard Provider Sep 18, 2019
@damoodamoo damoodamoo changed the title Dashboard Provider Shared Dashboard Resource Sep 18, 2019
@ghost ghost added the documentation label Sep 18, 2019
Copy link
Member

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @damoodamoo

Thanks for this PR :)

Taking a look through this mostly LGTM - if we can fix up the minor comments and add import support this otherwise LGTM 👍

Thanks!

azurerm/resource_arm_dashboard.go Outdated Show resolved Hide resolved
azurerm/resource_arm_dashboard.go Outdated Show resolved Hide resolved
azurerm/resource_arm_dashboard.go Outdated Show resolved Hide resolved
azurerm/resource_arm_dashboard.go Outdated Show resolved Hide resolved
azurerm/resource_arm_dashboard.go Outdated Show resolved Hide resolved
website/docs/r/dashboard.html.markdown Outdated Show resolved Hide resolved
website/docs/r/dashboard.html.markdown Show resolved Hide resolved
azurerm/resource_arm_dashboard.go Show resolved Hide resolved
azurerm/resource_arm_dashboard.go Outdated Show resolved Hide resolved
website/docs/r/dashboard.html.markdown Outdated Show resolved Hide resolved
@damoodamoo
Copy link
Contributor Author

Thanks @tombuildsstuff - really helpful comments. I think I've addressed them all now - let me know if anything else is missing.
Cheers!

@ghost ghost removed the waiting-response label Sep 19, 2019
@damoodamoo
Copy link
Contributor Author

Hmmm looks like the build is failing because of the version of the API/SDK i'm using?

@katbyte
Copy link
Collaborator

katbyte commented Sep 19, 2019

@damoodamoo, it looks like you didn't vendor in the required packages. While we use modules we also vendor them in so we aren't reliant on external sources. Try running go mod vendor and update your PR with the files it adds to the vendor directory.

@ghost ghost added size/XXL dependencies and removed size/XL labels Sep 19, 2019
@damoodamoo
Copy link
Contributor Author

I also wasn't too sure if I should edit the azurerm.erb file to add the Portal -> Dashboards link for the left nav for the docs..?

@katbyte
Copy link
Collaborator

katbyte commented Sep 19, 2019

Yep you totally should @damoodamoo 🙂 thanks!

Copy link
Member

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @damoodamoo

Thanks for pushing those changes - I've taken a look through and left a few minor comments inline but this otherwise LGTM 👍

Thanks!

azurerm/resource_arm_dashboard.go Outdated Show resolved Hide resolved
azurerm/resource_arm_dashboard.go Outdated Show resolved Hide resolved
azurerm/resource_arm_dashboard_test.go Outdated Show resolved Hide resolved
website/docs/r/dashboard.html.markdown Show resolved Hide resolved
website/docs/r/dashboard.html.markdown Show resolved Hide resolved
website/docs/r/dashboard.html.markdown Outdated Show resolved Hide resolved
@damoodamoo
Copy link
Contributor Author

@tombuildsstuff - cheers again - all changes made :)

@ghost ghost removed the waiting-response label Sep 23, 2019
@tombuildsstuff
Copy link
Member

Test passes:

Screenshot 2019-09-23 at 13 08 55

@tombuildsstuff tombuildsstuff merged commit 91863ca into hashicorp:master Sep 23, 2019
tombuildsstuff added a commit that referenced this pull request Sep 23, 2019
@ghost
Copy link

ghost commented Oct 4, 2019

This has been released in version 1.35.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
    version = "~> 1.35.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Mar 29, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

azurerm_dashboards: Create and share dashboards
3 participants