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 support to metadata that is automatically added by VCD #1146

Merged

Conversation

adambarreiro
Copy link
Collaborator

@adambarreiro adambarreiro commented Oct 26, 2023

Context

In the most recent versions of VCD, standalone VMs that are created from a vApp Template come with three metadata entries that are created automatically by VCD: vm.origin.id, vm.origin.name and vm.origin.type.

This conflicts with the way metadata works in this Terraform provider, as any plan will ask to remove these "foreign" entries if one adds metadata to their VMs in their HCL configuration.

Solution

To avoid a bad experience when dealing with this casuistic, this metadata is filtered out from metadata and metadata_entry blocks and moved to a separated block only available in vcd_vapp_vm and vcd_vm. This block is completely Computed and available for reading.

Tests

Tests fail in the newest VCD versions as the expected metadata is n-3. After this feature, as metadata is filtered out, we get these n-3 entries and the removed 3 are in a separated block, which gets its own set of assertions.

  • Impacted acceptance tests pass 10.5.0
  • All vm acceptance tests pass 10.5.0
  • vm tag upgrade tests pass 10.5.0
  • Impacted acceptance tests pass on latest version
  • All vm acceptance tests pass on latest version
  • vm tag upgrade tests pass on latest version

Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
@adambarreiro adambarreiro self-assigned this Oct 26, 2023
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Copy link
Collaborator

@lvirbalas lvirbalas left a comment

Choose a reason for hiding this comment

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

Looks to be a tidy approach to work around the change in API behavior!

website/docs/r/vapp_vm.html.markdown Outdated Show resolved Hide resolved
vcd/metadata.go Outdated Show resolved Hide resolved
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
@adambarreiro adambarreiro marked this pull request as draft November 6, 2023 12:20
Signed-off-by: abarreiro <abarreiro@vmware.com>
@adambarreiro adambarreiro marked this pull request as ready for review November 6, 2023 13:35
Signed-off-by: abarreiro <abarreiro@vmware.com>
.changes/v3.11.0/1146-improvements.md Outdated Show resolved Hide resolved
vcd/datasource_vcd_vapp.go Show resolved Hide resolved
vcd/datasource_vcd_vapp_test.go Outdated Show resolved Hide resolved
vcd/datasource_vcd_vapp_vm.go Show resolved Hide resolved
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
#
Signed-off-by: abarreiro <abarreiro@vmware.com>
Copy link
Collaborator

@lvirbalas lvirbalas left a comment

Choose a reason for hiding this comment

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

The new "map" approach looks great and versatile!

Copy link
Collaborator

@Didainius Didainius left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@adezxc adezxc left a comment

Choose a reason for hiding this comment

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

Thanks for this improvement! Also really like the new TestCheckFuncs with version constraint!

Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
@adambarreiro adambarreiro merged commit dbb9adb into vmware:main Nov 13, 2023
3 checks passed
@adambarreiro adambarreiro deleted the add-support-to-inherited-metadata branch November 13, 2023 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants