-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
azurerm_portal_dashboard - update dashboard name validation #16406
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing this, unfortunately it appears this doesn't work:
Error: creating/updating Dashboard: (Name “hellllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllo” / Resource Group “acctestRG-220419094823499740") portal.DashboardsClient#CreateOrUpdate: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: error response cannot be parsed: {“{\“error\“:{\“code\“:377,\“message\“:\“The dashboard name ‘hellllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllo’ has length ‘259’ which exceeds the length limit ‘160’.\“}}” ‘\x00’ ‘\x00’} error: json: cannot unmarshal number into Go struct field RequestError.error of type string
The name used here is the ARM name which has a number of limitations, as mentioned in the product documentation it's possible to specify a tag
of hidden-title
to override this (which doesn't have this 160 character limit).
As such there's three things needed here:
- Update the validation logic to support 160 characters
- Add an acceptance test to confirm that
- Add a
display_name
filter toazurerm_portal_dashboard
to allow users to lookup a dashboard by eithername
ordisplay_name
(makingname
optional - but having a check in the Read function to ensure that either one of them is set / a dashboard is found)
Would you be able to take a look?
Thanks!
@tombuildsstuff , for items 1 and 2, I've updated code. For item 3, maybe I can file a new issue to track this new feature request. Does it make sense? |
@neil-yechenwei 3 should be a part of this PR too, as requested above - else this isn't really solving #16376. |
@tombuildsstuff , ok. I will implement it in data source azurerm_portal_dashboard. |
@tombuildsstuff , while testing against 3, I think of one thing. The tag value of hidden-title isn't globally unique. So it would be duplicate with others so that we would get multiple dashboards while filtering by the display_name. Hence, maybe we cannot filter the resource by display_name in data source azurerm_portal_dashboard. Does it make sense? |
@neil-yechenwei in which case we can raise an error that there isn't a single match, like we do in other data sources which allow filtering in this manner |
@tombuildsstuff , thanks for your suggestion. I've updated code. Please take another look. Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pushing those changes, I've taken a look through and left some comments inline - if we can fix those up then we can take another look.
Thanks!
} | ||
|
||
id := parse.NewDashboardID(subscriptionId, resourceGroup, name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
both the resourceGroup
and the name
here will be empty when we're filtering by display name - making this ID invalid?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As resourceGroup
is required property, so it won't be empty.
For name
, while filtering by display_name
, name
would be empty. So I updated code to use *dashboard.Name
since this property always has value when the resource is retrieved.
@tombuildsstuff , thanks for your suggestion. I've updated code. Please take another look. Thanks. |
@katbyte , thanks for your comment. I've updated PR. Please take another look. Thanks in advance. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @neil-yechenwei - LGTM 🚜
This functionality has been released in v3.8.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
fixes #16376
--- PASS: TestAccPortalDashboard_basic (232.15s)
--- PASS: TestAccPortalDashboard_hiddenTitle (234.44s)
--- PASS: TestAccPortalDashboard_complete (234.69s)
--- PASS: TestAccDataSourcePortalDashboard_complete (194.95s)
--- PASS: TestAccDataSourcePortalDashboard_basic (208.89s)
--- PASS: TestAccDataSourcePortalDashboard_displayName (212.52s)