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

RDE (Runtime Defined Entities) framework support with RDE resource and data source (3/3) #977

Merged
merged 238 commits into from
Mar 21, 2023

Conversation

adambarreiro
Copy link
Collaborator

@adambarreiro adambarreiro commented Jan 4, 2023

Design details

computed_entity vs input_entity/input_entity_url

There is a common use case for RDEs where they are used by 3rd party components that perform continuous updates on them, which are expected and desired. This conflicts with Terraform way of working, as doing a terraform plan would reveal the required actions to remove every single change done by those 3rd party tools, which we don't want in this case.

To add compatibility with this scenario, there are two important arguments, input_entity and input_entity_url,
and one important computed attribute, computed_entity.

If the RDE is intended to be managed only and exclusively by Terraform, the contents of the input JSON should always match with those retrieved into computed_entity. Otherwise, only computed_entity will reflect the current state of the RDE in VCD, whereas input_entity and input_entity_url will only specify the RDE contents that are needed either on creation or in a deliberate update that will cause the RDE contents to be completely overridden.

As per this last point, one needs to be careful when updating input_entity or input_entity_url, as Terraform will apply
whatever changes were done, ignoring the real state from computed_entity. To perform a real update, one
needs to check the contents of the computed_entity and do some diff with the original input.

resolve and resolve_on_destroy

RDEs must be resolved to be used or deleted, and this operation can be done either by Terraform with resolve=true, or by a 3rd party actor that will do it behind the scenes (resolve=false). To cover this last scenario, the RDE resource also has an argument resolve_on_destroy so Terraform can destroy the RDE if it was not resolved by anyone.

Non-unique imports

RDEs uniqueness is only granted by their ID. This means that the combination of vendor, nss, version and name does not guarantee its uniqueness. One can have multiple RDEs with the same values of vendor, nss, version and name.

In order to have a decent implementation of the terraform import operation, this PR implements three ways of importing:

  • list@vendor.nss.version.name: This is the way to list all available RDE identifiers of the given type and name. Import will exit without performing any other operation. This way the users can somehow decide which RDE they want to import (if the ID gives some information to them, that is)
  • rde-id: Import by RDE ID, which is unique.
  • vendor.nss.version.name.position import by type, name and position. Position is a natural number that starts from 1.

RDE saga:

abarreiro added 30 commits December 20, 2022 13:02
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>
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>
#
Signed-off-by: abarreiro <abarreiro@vmware.com>
…raform-provider-vcd into add-rde-support-2

Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
…raform-provider-vcd into add-rde-support-2

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>
…raform-provider-vcd into add-rde-support-2

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>
abarreiro added 5 commits March 16, 2023 10:45
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
nit
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
website/docs/r/rde.html.markdown Outdated Show resolved Hide resolved
vcd/resource_vcd_rde_test.go Outdated Show resolved Hide resolved
vcd/resource_vcd_rde_test.go Outdated Show resolved Hide resolved
vcd/resource_vcd_rde.go Show resolved Hide resolved
abarreiro added 6 commits March 16, 2023 12:37
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>
website/docs/r/rde.html.markdown Show resolved Hide resolved
Copy link
Contributor

@dataclouder dataclouder left a comment

Choose a reason for hiding this comment

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

First pass

vcd/config.go Show resolved Hide resolved
vcd/config.go Show resolved Hide resolved
vcd/resource_vcd_rde.go Outdated Show resolved Hide resolved
vcd/resource_vcd_rde.go Outdated Show resolved Hide resolved
vcd/resource_vcd_rde.go Outdated Show resolved Hide resolved
website/docs/d/rde.html.markdown Show resolved Hide resolved
website/docs/r/rde.html.markdown Outdated Show resolved Hide resolved
website/docs/r/rde.html.markdown Show resolved Hide resolved
website/docs/r/rde.html.markdown Show resolved Hide resolved
website/docs/r/rde.html.markdown Show resolved Hide resolved
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.

I have tried it and approving, but have a look at binary tests as they need some skip directives - for example vcd.TestAccVcdRde-Resolve.tf binary test will not be skipped, but it will fail

abarreiro added 8 commits March 21, 2023 10:32
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>
abarreiro added 2 commits March 21, 2023 16:21
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
@adambarreiro adambarreiro merged commit 6032f71 into vmware:main Mar 21, 2023
@adambarreiro adambarreiro deleted the add-rde-support-3 branch March 21, 2023 15:36
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.

6 participants