-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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_log_analytics_workspace
- prevent ForceNew when sku
is LACluster
#19608
Merged
mbfrahry
merged 5 commits into
hashicorp:main
from
ziyeqf:tengzh/vanguard/sentinel/log_workspace_lacluster
Feb 21, 2023
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2f558ed
`azurerm_log_analytics_workspace` - fix workaround when `sku` is `LAC…
ziyeqf 693448e
add condition
ziyeqf 80d91b1
empty commit to re trigger CI
ziyeqf 38db6a6
Update log_analytics_linked_service_resource_test.go
mbfrahry 197ef8f
Update log_analytics_linked_service_resource_test.go
mbfrahry File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I believe this maybe a breaking change depending on how the new enum cases the value. In the previous version we used
lacluster
. So, if there is an existing resource with the skulacluster
and the new value in the enum isLACluster
that my cause an issue here?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.
We'll need to do a state migration and fix it on read perhapes?
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.
@ziyeqf - Are you able to check if this is an issue (i.e. build one with a released version, then manage it with your updated code) and add the state migration if needed?
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.
My test steps:
terraform plan
and then aForceNew
diff shows.ForceNew
shows.My explain is:
After changed to azure-go-sdk, it has begun to set
LACluster
to state file, which was""
before, then the workaround goes invalid.For the casing change here, it's only between provider and service, we used to use
lacluster
in payload, andLACluster
now. Per the test result I think it should be ok?Code ref:
terraform-provider-azurerm/internal/services/loganalytics/log_analytics_workspace_resource.go
Lines 382 to 394 in 4ce0783
Constant ref:
https://github.com/hashicorp/go-azure-sdk/blob/10bd4eb4bbb6822a564b2d0fcdf348e8ed3a8e8c/resource-manager/operationalinsights/2020-08-01/workspaces/constants.go#L177-L186
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.
Hi @ziyeqf - I think you should test with a
lacluster
value and check the effect of the change toLACluster
, since this Enum change will likely result in a diff, which is what I think @WodansSon was pointing out? This may need a state migration to update the value to prevent this.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.
@jackofallops I don't think there will be a config with
sku
set tolacluster
, it's now allowed invalidateFunc
and will throw error in plan stage. And for state file, it will be set toLACluster
in refresh stage.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.
sorry for typo, it's "not" allowed.
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.
previous versions allowed lacluster - we'll need to account for that as we don't know what version someone will be upgrading from so we can't make that asausmption
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.
So.. we need to allow
lacluster
invalidateFunc
again?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.
Apologies for the back and forth @ziyeqf. Your implementation here is correct. We are only setting
lacluster
during create and update and the api doesn't care about casing. During the read, we are settingsku
toLACluster
so the end user shouldn't encounter any state changes from this PR