-
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_postgresql_flexible_server
- move the error check for storage_mb
from CustomizeDiff
to Create/Update
func
#25986
Conversation
…_mb from CustomizeDiff to Create/Update func
@@ -384,11 +384,6 @@ func resourcePostgresqlFlexibleServer() *pluginsdk.Resource { | |||
newMb = newStorageMbRaw.(int) | |||
newTier = newTierRaw.(string) | |||
|
|||
// storage_mb can only be scaled up... |
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.
is it not possible to also detect that something has changed forcing a new resoruce to be created and just not throw the error?
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.
@katbyte , Unfortunately, I didn't find any way to ask terraform if the resource is going to be destroyed or not, I assume that bit is only known by the core runtime. And I didn't find any way to judge if the resource is going to be destroyed per the condition combination. So I have to move it to create/update func.
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.
👍
@katbyte , thanks for the comment. Please take another look. |
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 🌻
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. |
Community Note
Description
I run
tf apply
against below tf config 1 and the resources are created successfully. Then I updatename
ofazurerm_postgresql_flexible_server
and changestorage_mb
from 65536 to 32768 like below tf config 2 and runtf apply
again. I expect that TF would re-create the resource successfully but it failed with below error. What is happening is that the validation in the customized diff is catching the error because the validation doesn't know that it is going to be destroyed and re-created. So this error check would always check if new storage_mb is lower than old storage_mb. Hence, we have to move the error check forstorage_mb
fromCustomizeDiff
toCreate/Update
func.Error Message:
The tf config 1 for the first apply:
The tf config 2 for the second apply:
PR Checklist
For example: “
resource_name_here
- description of change e.g. adding propertynew_property_name_here
”Changes to existing Resource / Data Source
Testing
Change Log
Below please provide what should go into the changelog (if anything) conforming to the Changelog Format documented here.
azurerm_postgresql_flexible_server
- move the error check forstorage_mb
fromCustomizeDiff
toCreate/Update
funcThis is a (please select all that apply):
Note
If this PR changes meaningfully during the course of review please update the title and description as required.