Include API Version in input/state#3907
Closed
EronWright wants to merge 22 commits into
Closed
Conversation
4c7470f to
0704737
Compare
This comment was marked as duplicate.
This comment was marked as duplicate.
Add script for generating a new major version.
Fix altered casing of "IP" from `IpAllocationMethod`.
Add new field (privateEndpointVNetPolicies) which is now populated by default in the new version of the VirtualNetwork resource.
The value ("Disabled") was found by creating a VirtualNetwork manually and exporting as an ARM template in the portal.
Resolves #2749 but not completely yet. So far, these are the overrides that can be removed without any further changes, and `make schema` succeeds.
Contributor
Author
|
Replaced by #4015 |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Overview
Closes #3766
This PR is aimed at improving the experience around api versions, e.g. when upgrading a resource to a new api version. Note that major version upgrades of this provider tend to change the 'default' versions of many resources.
In 2.x mode, the provider simply records the actual
azureApiVersionas an output property, but doesn't expose it at the SDK level. The rationale is to have the information available in "old state" +before+ the major upgrade is performed; this allows the provider to avoid a spurious diff and to make fewer update calls during the major upgrade.In 3.x mode, the provider introduces a new
azureApiVersioninput property, with a constant value. The input property is NOT added to the resource args; it is always defaulted inCheck. In the future, a true input property might be added to support overrides. The purpose of having a checked input is to produce a diff when the API version has changed (for whatever reason). This leads to an update call against the new API version of the resource, to validate the inputs and refresh the state.The output property that was added to state in 2.x is fully exposed in 3.x at the SDK level.
Migration
In a migration case, the old
azureApiVersionisn't yet known, and this may lead to a spurious (though harmless) update because the value goes from empty to known. We mitigate this by readingazureApiVersionfrom old state during Diff. The recommended migration flow is:pulumi up(to update the provider version) followed bypulumi refresh(to update the resource's state. Now there's anazureApiVersionin state for each 2.x resource.pulumi up, and the provider compares old state to new input to see whether the api version is actually changing, e.g. due to a change to the "default version" of a resource.For example, here's the impact to the state file after completing the migration as described. We see two affected resources: a resource group and a storage account, with the latter undergoing a change to the 'default' API version.
Invokes
Another aspect to this PR is the
azureApiVersionoutput property and supporting thegetFoofunctions. The code generator must be careful to apply the output property to the resource type (as represented byisTopLevel), not to functions. There is, however, a special "get" function where it does make sense to return theazureApiVersion.