-
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_security_center_pricing
- force new resource to be created when subplan
changes
#27805
base: main
Are you sure you want to change the base?
Conversation
This comment was marked as off-topic.
This comment was marked as off-topic.
kindly bubble this up |
convert to draft to update |
azurerm_security_center_pricing
- add additional update when subplan
changedazurerm_security_center_pricing
- force new resource to be created when subplan
changes
@ziyeqf - looks like this is stuck? Who needs to approve? |
@ziyeqf ping. There is a customer waiting for this since October. Microsoft is not looking very good here. |
) | ||
|
||
func resourceSecurityCenterSubscriptionPricing() *pluginsdk.Resource { | ||
return &pluginsdk.Resource{ | ||
Create: resourceSecurityCenterSubscriptionPricingUpdate, | ||
res := &pluginsdk.Resource{ |
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 can remove this variable declaration since we're not patching anything in the resource here
client := meta.(*clients.Client).SecurityCenter.PricingClient | ||
|
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.
subscriptionId := meta.(*clients.Client).Account.SubscriptionId | ||
ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) | ||
|
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.
|
||
func resourceSecurityCenterSubscriptionPricingUpdate(d *pluginsdk.ResourceData, meta interface{}) error { | ||
client := meta.(*clients.Client).SecurityCenter.PricingClient | ||
|
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.
|
||
updateResponse, updateErr := client.Update(ctx, *id, update) | ||
if updateErr != nil { | ||
return fmt.Errorf("setting %s: %+v", id, updateErr) |
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.
return fmt.Errorf("setting %s: %+v", id, updateErr) | |
return fmt.Errorf("updating %s: %+v", id, updateErr) |
return fmt.Errorf("setting %s: %+v", id, updateErr) | ||
} | ||
|
||
// The extensions list from backend might vary after `tier` changed, thus we need to retire it 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.
should this be?
// The extensions list from backend might vary after `tier` changed, thus we need to retire it again. | |
// The extensions list from backend might vary after `tier` changed, thus we need to retrieve it again. |
update.Properties.Extensions = extensions | ||
_, updateErr := client.Update(ctx, *id, update) | ||
if updateErr != nil { | ||
return fmt.Errorf("setting %s: %+v", id, updateErr) |
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.
return fmt.Errorf("setting %s: %+v", id, updateErr) | |
return fmt.Errorf("updating %s: %+v", id, updateErr) |
requiredAdditionalUpdate = currentlyFreeTier | ||
} | ||
|
||
updateResponse, updateErr := client.Update(ctx, *id, update) |
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 should be able to reuse err
here
updateResponse, updateErr := client.Update(ctx, *id, update) | |
updateResponse, err := client.Update(ctx, *id, update) |
return fmt.Errorf("setting %s: %+v", id, updateErr) | ||
} | ||
update.Properties.Extensions = extensions | ||
_, updateErr := client.Update(ctx, *id, update) |
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.
_, updateErr := client.Update(ctx, *id, update) | |
_, err = client.Update(ctx, *id, update) |
### `azurerm_security_center_princing_tier` | ||
|
||
* Changing the property `subplan` now forces a new resource to be created. | ||
|
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.
This isn't a 5.0 change anymore so this should be removed
Community Note
Description
When
subplan
changes, there might be extensions enabled by default, force a new resource to be created to keep the resource consistent with configuration.PR Checklist
For example: “
resource_name_here
- description of change e.g. adding propertynew_property_name_here
”Changes to existing Resource / Data Source
Testing
azurerm_security_center_pricing
- force new resource to be created when subplan changes [azurerm_security_center_pricing
- force new resource to be created whensubplan
changes #27805]This is a (please select all that apply):
Related Issue(s)
Fixes #27338
Note
If this PR changes meaningfully during the course of review please update the title and description as required.