Skip to content

Conversation

@stephybun
Copy link
Member

@stephybun stephybun commented Aug 27, 2025

Related Issue

Closes #1502

Description

Adds validation to the ApplyResource and ReadResource RPC to check whether a resource identity is fully null i.e. all attributes within the identity are null.

Rollback Plan

  • If a change needs to be reverted, we will roll out an update to the code within 7 days.

Changes to Security Controls

None

@stephybun stephybun requested a review from a team as a code owner August 27, 2025 13:51
Comment on lines 682 to 686

// AllowNullIdentity toggles whether the managed resource allows identities to be null. Setting this flag to true
// disables the SDK validation that ensures the identity cannot be null at the end of ApplyResourceChange and ReadResource
// RPC calls in certain situations.
AllowNullIdentity bool
Copy link
Member Author

Choose a reason for hiding this comment

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

Added this flag so that we could toggle this behaviour off in case it introduced any unforeseen bugs or behaviours that could break providers - but as it stands no one can think of a specific use case where an identity would need to be completely null, so perhaps this should be removed.

Copy link
Member

Choose a reason for hiding this comment

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

Continuing our offline conversation, I think I'm on the side of removing this flag and just always applying it. In lieu of a real example of a resource that has an identity that is allowed to be fully null (while still supporting identity), I think any bugs we introduce would require a re-release of the provider anyways, so we could always come back and add a flag if we find a scenario or adjust the validation logic

Copy link
Member Author

Choose a reason for hiding this comment

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

If we introduce any bugs with this validation that can be toggled off by this flag I'm not sure I follow why we would still need to re-release the provider, but I'm fine with removing this flag and reassessing on a case by case basis.

Copy link
Member

@austinvalle austinvalle left a comment

Choose a reason for hiding this comment

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

Left some comments! Also one suggestion to perhaps increase our confidence in this change.

Perhaps we can reach out to the AWS team to run these changes (perhaps after we merge to main, before releasing the module) against their acceptance test suite? They have the most resource identity implementations and have a lot of tests that might help us see if there are any edges we missed.

If all those tests are passing that would give us some confidence that we don't need any flags to skip this validation

Comment on lines 682 to 686

// AllowNullIdentity toggles whether the managed resource allows identities to be null. Setting this flag to true
// disables the SDK validation that ensures the identity cannot be null at the end of ApplyResourceChange and ReadResource
// RPC calls in certain situations.
AllowNullIdentity bool
Copy link
Member

Choose a reason for hiding this comment

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

Continuing our offline conversation, I think I'm on the side of removing this flag and just always applying it. In lieu of a real example of a resource that has an identity that is allowed to be fully null (while still supporting identity), I think any bugs we introduce would require a re-release of the provider anyways, so we could always come back and add a flag if we find a scenario or adjust the validation logic

@stephybun stephybun force-pushed the f/prevent-null-identity-validation branch from e10bfe6 to 7057933 Compare August 28, 2025 09:27
Copy link
Contributor

@rainkwan rainkwan left a comment

Choose a reason for hiding this comment

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

Comments look to be addressed and seems sound to me 🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SDKv2 allows resource identities to be set to null, eventually triggering mutable identity error

3 participants