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

Add initialize fault attribute to nil on first read #5420

Merged
merged 1 commit into from
Jun 24, 2024

Conversation

ismirlia
Copy link
Collaborator

Attr_Fault should be initialized to nil on first read, so that terraform apply doesn't think there's a value left to compute after vm creation.

@ismirlia ismirlia added the service/Power Systems Issues related to Power Systems label Jun 19, 2024
@@ -560,6 +560,8 @@ func resourceIBMPIInstanceRead(ctx context.Context, d *schema.ResourceData, meta
}
if powervmdata.Fault != nil {
d.Set(Attr_Fault, flattenPvmInstanceFault(powervmdata.Fault))
} else {
d.Set(Attr_Fault, nil)
Copy link
Collaborator

@hkantare hkantare Jun 21, 2024

Choose a reason for hiding this comment

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

Didn't get it why we need to initialize to nil

Copy link
Collaborator Author

@ismirlia ismirlia Jun 21, 2024

Choose a reason for hiding this comment

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

If it doesn't get initialized, the terraform apply keeps thinking there's a change to apply, and tries to apply it again, but doesn't do anything. Suraj Sanath Kumar Bharadwaj found the issue.

@hkantare hkantare merged commit 7e4d729 into IBM-Cloud:master Jun 24, 2024
1 check passed
@michaelkad michaelkad deleted the default-fault branch September 6, 2024 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
service/Power Systems Issues related to Power Systems
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants