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 Runtime Defined Entity Interfaces resource and data source (1/3) #965

Merged
merged 51 commits into from
Feb 23, 2023

Conversation

adambarreiro
Copy link
Collaborator

@adambarreiro adambarreiro commented Dec 20, 2022

Overview

This PR depends on vmware/go-vcloud-director#527

This PR adds a new resource and data source vcd_rde_interface to be able to create, read, update and delete Defined Interfaces, and also to import existing ones into Terraform state.

Design details

To define a Defined Interface unequivocally, one needs vendor, nss and version:

  • Same 3-tuple of (vendor, nss,version) can't have a different name. Otherwise it fails with RDE_INTERFACE_ALREADY_EXISTS.
  • Different 3-tuples of (vendor, nss,version) can have the same name.

An example of a valid scenario:

{
  "name": "sameName",
  "nss": "nss1",
  "version": "1.0.0",
  "vendor": "vendor1"
}
{
  "name": "sameName",
  "nss": "nss2",
  "version": "1.0.0",
  "vendor": "vendor2"
}

Because the 3-tuple (vendor, nss,version) is different.

An example of a wrong scenario:

{
  "name": "someName",
  "nss": "nss1",
  "version": "1.0.0",
  "vendor": "vendor1"
}
{
  "name": "differentName",
  "nss": "ns11", // Wrong: same nss
  "version": "1.0.0", // Wrong: same version
  "vendor": "vendor1" // Wrong: same vendor
}

Creation of differentName will fail as the 3-tuple is being reused.

  • Because of the constraint above, the data source requires only the vendor, nss and version. In other words, we can't use name to fetch Defined Interfaces for the data source because it can be non-unique.

  • In the resource, all attributes except name have ForceNew: true, this is because the PUT endpoint in VCD API ignores all changes in fields except for name. Also, if name is not sent during the PUT, API fails with a very ugly error.

  • To import an existing Defined Interface from VCD into Terraform state, one needs to build an URN like vendor.nss.version. As version follows SemVer, the identifier results in something like vmware.kubernetes.1.0.0 which can be visually odd. The usage of . as separator can be changed with VCD_IMPORT_SEPARATOR, but as with the data source, one requires the version to unequivocally identify the Defined Interface.

Disclaimer

The new resource vcd_rde_interface does NOT add behaviors support in this PR. A "behavior" is an extension of the capabilities of the Defined Interfaces that would require an extra resource (something like vcd_rde_interface_behavior). These behaviors can be mapped in the Runtime Defined Entity types hooks map[string]string property, where this map supports PRE_CREATED, POST_CREATION, etc as keys and behavior IDs coming from Defined Interfaces as values.

RDE saga:

abarreiro added 10 commits December 20, 2022 13:02
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
@adambarreiro adambarreiro changed the title Add RDE support with Defined Interfaces, RDE types and RDEs Start with RDE support with Defined Interfaces Jan 2, 2023
@adambarreiro adambarreiro changed the title Start with RDE support with Defined Interfaces Start with RDE (Runtime Defined Entities) framework support with Defined Interfaces resource and data source Jan 2, 2023
@adambarreiro adambarreiro self-assigned this Jan 2, 2023
Signed-off-by: abarreiro <[email protected]>
abarreiro added 6 commits January 2, 2023 15:33
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
#
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
#
Signed-off-by: abarreiro <[email protected]>
@adambarreiro adambarreiro changed the title Start with RDE (Runtime Defined Entities) framework support with Defined Interfaces resource and data source RDE (Runtime Defined Entities) framework support with Defined Interfaces resource and data source (1/3) Jan 4, 2023
abarreiro added 5 commits January 9, 2023 16:54
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
#
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
@adambarreiro adambarreiro changed the title RDE (Runtime Defined Entities) framework support with Defined Interfaces resource and data source (1/3) RDE (Runtime Defined Entities) framework support with Runtime Defined Entity Interfaces resource and data source (1/3) Jan 30, 2023
.changes/v3.9.0/965-features.md Outdated Show resolved Hide resolved
.changes/v3.9.0/965-features.md Outdated Show resolved Hide resolved
website/docs/d/rde_interface.html.markdown Outdated Show resolved Hide resolved
website/docs/r/rde_interface.html.markdown Outdated Show resolved Hide resolved
abarreiro added 4 commits January 31, 2023 11:18
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
vcd/datasource_vcd_rde_interface_test.go Outdated Show resolved Hide resolved
website/docs/d/rde_interface.html.markdown Outdated Show resolved Hide resolved
vcd/resource_vcd_rde_interface.go Outdated Show resolved Hide resolved
vcd/resource_vcd_rde_interface_test.go Show resolved Hide resolved
Signed-off-by: abarreiro <[email protected]>
abarreiro added 5 commits January 31, 2023 13:26
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
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.

My only reservation is whether nss (field name coming from the API) is not too cryptic for the new users.

abarreiro added 2 commits February 8, 2023 16:28
Signed-off-by: abarreiro <[email protected]>
fmt
Signed-off-by: abarreiro <[email protected]>
website/docs/r/rde_interface.html.markdown Outdated Show resolved Hide resolved
Signed-off-by: abarreiro <[email protected]>
abarreiro added 2 commits February 22, 2023 16:51
Signed-off-by: abarreiro <[email protected]>
@adambarreiro adambarreiro merged commit 4ec6651 into vmware:main Feb 23, 2023
@adambarreiro adambarreiro deleted the add-rde-support branch February 23, 2023 08:57
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