-
Notifications
You must be signed in to change notification settings - Fork 112
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
Site and Org associations #1260
Open
dataclouder
wants to merge
60
commits into
vmware:main
Choose a base branch
from
dataclouder:site-org-associations
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,400
−10
Open
Changes from 52 commits
Commits
Show all changes
60 commits
Select commit
Hold shift + click to select a range
d38a160
WIP
dataclouder 08d0e1c
WIP Add site/org association entities
dataclouder 4c3891e
Update ID handling in association resources
dataclouder 25353a1
Update error message
dataclouder c00ba9a
Update vcd_resource_list for site associations
dataclouder 1e6a668
Remove unnecessary association_data_file in vcd_org data source
dataclouder dc68643
Update docs
dataclouder eb6850a
Add Import and update funcs to associations
dataclouder 92a4d97
Update go.mod
dataclouder 6b2e8db
Merge branch 'main' into site-org-associations
dataclouder e5442e7
Adapt resource/data source names to suggestions
dataclouder a88f68d
Add all-at-once example
dataclouder eb537f2
[skip-ci] Update examples version
dataclouder 166fdf0
Merge branch 'main' into site-org-associations
dataclouder a39a6a4
WIP
dataclouder 761bc01
Merge branch 'main' into site-org-associations
dataclouder ec89936
Merge branch 'main' into site-org-associations
dataclouder e5f3763
Update Org association test
dataclouder c74400b
Add skip for short test
dataclouder 1ff9c51
Update Org association test
dataclouder 0e3e4ca
Add skip for Org association binary test
dataclouder f129a3c
Add comprehensive test for site/org association
dataclouder be00b8a
Improve tests
dataclouder 3c24236
Update tests
dataclouder b03ddfa
Add some documentation
dataclouder f1e257a
Update govcd
dataclouder f121f12
Merge branch 'main' into site-org-associations
dataclouder b205c08
Add more documentation
dataclouder b50382e
Update association data sources
dataclouder 32f5ca7
Update docs
dataclouder b3490a5
Merge branch 'main' into site-org-associations
dataclouder 3a8e0ab
Add example of multi-org association
dataclouder 7a5d6c1
Add multi-site resources docs
dataclouder 253349f
Add first draft of site and org association guide
dataclouder 1cdcbb2
Update example path
dataclouder 7956f85
Improve DataSourceNotFound test
dataclouder 040e13a
Update docs
dataclouder 57df3c9
Update test DatasourceNotFound
dataclouder 4bd5ae5
Add unified site association test
dataclouder 0a42519
Update tests
dataclouder 4183aed
Add Changelog entries
dataclouder 1400754
Update docs
dataclouder ff88eb8
Merge branch 'main' into site-org-associations
dataclouder dc38aff
Remove unnecessary comment
dataclouder d940316
Merge branch 'main' into site-org-associations
dataclouder 4358e86
Update go.mod
dataclouder 7a03986
Update examples
dataclouder 4cb44b3
Remove leftover comments
dataclouder 1b23238
Merge branch 'main' into site-org-associations
dataclouder 2e8fe78
Merge branch 'main' into site-org-associations
dataclouder 948cd88
Merge branch 'main' into site-org-associations
dataclouder 5127f96
Update govcd
dataclouder 06e8d1b
Update documentation
dataclouder a47de96
Update documentation
dataclouder 10cced0
Update documentation
dataclouder 7dffe09
Merge branch 'main' into site-org-associations
dataclouder 5cbb4a5
Merge branch 'main' into site-org-associations
dataclouder 5b0afe1
Merge branch 'main' into site-org-associations
dataclouder 108040d
Merge branch 'main' into site-org-associations
dataclouder dc2c3e2
Fix test formatting
dataclouder File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
* **New Data Source:** `vcd_multisite_site` to read the state and associations of current site [GH-1260] | ||
* **New Data Source:** `vcd_multisite_site_data` to produce the association data needed to start a site association [GH-1260] | ||
* **New Data Source:** `vcd_multisite_site_association` to read the details of a site association [GH-1260] | ||
* **New Resource:** `vcd_multisite_site_association` to associate the current site with a remote one [GH-1260] | ||
* **New Data Source:** `vcd_multisite_org_data` to produce the association data needed to start an organization association [GH-1260] | ||
* **New Data Source:** `vcd_multisite_org_association` to read the details of an organization association [GH-1260] | ||
* **New Resource:** `vcd_multisite_org_association` to associate a local organization with a remote one [GH-1260] | ||
* **New Guide** `Site and Org associations` to describe association operations for sites and organizations [GH-1260] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* Data source `vcd_resource_list` can now list site and organization associations [GH-1260] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
provider "vcd" { | ||
user = var.vcd_admin | ||
password = var.vcd_password | ||
token = "" | ||
api_token = "" | ||
auth_type = "integrated" | ||
saml_adfs_rpt_id = "" | ||
url = var.vcd_url | ||
sysorg = var.vcd_sysorg | ||
org = var.vcd_org1 | ||
allow_unverified_ssl = "true" | ||
max_retry_timeout = 600 | ||
logging = true | ||
logging_file = "go-vcloud-director.log" | ||
} | ||
|
||
data "vcd_org" "org1" { | ||
name = var.vcd_org1 | ||
} | ||
data "vcd_org" "org2" { | ||
name = var.vcd_org2 | ||
} | ||
|
||
data "vcd_multisite_org_data" "org1-data" { | ||
org_id = data.vcd_org.org1.id | ||
} | ||
|
||
data "vcd_multisite_org_data" "org2-data" { | ||
org_id = data.vcd_org.org2.id | ||
} | ||
|
||
data "vcd_resource_list" "orgs" { | ||
name = "org_associations" | ||
resource_type = "vcd_multisite_org_association" | ||
list_mode = "name_id" | ||
} | ||
|
||
resource "vcd_multisite_org_association" "org1-org2" { | ||
org_id = data.vcd_org.org1.id | ||
association_data = data.vcd_multisite_org_data.org2-data.association_data | ||
connection_timeout_mins = 2 | ||
} | ||
|
||
resource "vcd_multisite_org_association" "org2-org1" { | ||
org_id = data.vcd_org.org2.id | ||
association_data = data.vcd_multisite_org_data.org1-data.association_data | ||
connection_timeout_mins = 2 | ||
} | ||
|
||
output "org2-org1" { | ||
value = vcd_multisite_org_association.org2-org1 | ||
} | ||
|
||
|
||
output "org1-org2" { | ||
value = vcd_multisite_org_association.org1-org2 | ||
} | ||
|
||
output "org_associations" { | ||
value = data.vcd_resource_list.orgs | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Rename this file to 'terraform.tfvars' and update the variables to their intended values | ||
vcd_url = "https://example1.com/api" | ||
vcd_admin = "administrator" | ||
vcd_password = "myPassword" | ||
vcd_sysorg = "System" | ||
vcd_org1 = "nameOfMyOrg" | ||
vcd_org2 = "nameOfMyOtherOrg" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
variable "vcd_url" { | ||
type = string | ||
} | ||
|
||
variable "vcd_admin" { | ||
type = string | ||
default = "administrator" | ||
} | ||
|
||
variable "vcd_sysorg" { | ||
type = string | ||
default = "System" | ||
} | ||
|
||
variable "vcd_password" { | ||
type = string | ||
} | ||
|
||
variable "vcd_org1" { | ||
type = string | ||
} | ||
|
||
variable "vcd_org2" { | ||
type = string | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
terraform { | ||
required_providers { | ||
vcd = { | ||
source = "vmware/vcd" | ||
version = ">=3.13.0" | ||
} | ||
} | ||
} | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
provider "vcd" { | ||
alias = "vcd1" | ||
user = var.vcd_admin1 | ||
password = var.vcd_password1 | ||
token = "" | ||
api_token = "" | ||
auth_type = "integrated" | ||
saml_adfs_rpt_id = "" | ||
url = var.vcd_url1 | ||
sysorg = var.vcd_sysorg1 | ||
org = var.vcd_org1 | ||
allow_unverified_ssl = "true" | ||
max_retry_timeout = 600 | ||
logging = true | ||
logging_file = "go-vcloud-director-1.log" | ||
} | ||
|
||
data "vcd_org" "org1" { | ||
provider = vcd.vcd1 | ||
name = var.vcd_org1 | ||
} | ||
|
||
data "vcd_multisite_org_data" "org1-data" { | ||
provider = vcd.vcd1 | ||
org_id = data.vcd_org.org1.id | ||
download_to_file = "${var.vcd_org1}.xml" | ||
} | ||
|
||
data "vcd_multisite_site_data" "site1-data" { | ||
provider = vcd.vcd1 | ||
download_to_file = "${var.site_name1}-site.xml" | ||
} | ||
|
||
# The data files are needed because the data will be read by resources handled by a different user, which can't read | ||
# directly the data source that is the origin of these files | ||
|
||
data "local_file" "site1" { | ||
filename = "${var.site_name1}-site.xml" | ||
depends_on = [data.vcd_multisite_site_data.site1-data] | ||
} | ||
|
||
data "local_file" "org1" { | ||
filename = "${var.vcd_org1}.xml" | ||
depends_on = [data.vcd_multisite_org_data.org1-data] | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
|
||
data "vcd_resource_list" "sites" { | ||
provider = vcd.vcd1 | ||
name = "site_associations" | ||
resource_type = "vcd_multisite_site_association" | ||
list_mode = "name_id" | ||
} | ||
|
||
data "vcd_resource_list" "orgs" { | ||
provider = vcd.vcd1 | ||
name = "org_associations" | ||
resource_type = "vcd_multisite_org_association" | ||
list_mode = "name_id" | ||
} | ||
|
||
resource "vcd_multisite_site_association" "site1-site2" { | ||
provider = vcd.vcd1 | ||
association_data = data.local_file.site2.content | ||
connection_timeout_mins = 2 | ||
} | ||
|
||
resource "vcd_multisite_org_association" "org1-org2" { | ||
provider = vcd.vcd1 | ||
org_id = data.vcd_org.org1.id | ||
association_data = data.local_file.org2.content | ||
connection_timeout_mins = 2 | ||
depends_on = [vcd_multisite_site_association.site1-site2] | ||
} | ||
|
||
output "site1-site2" { | ||
value = vcd_multisite_site_association.site1-site2 | ||
} | ||
|
||
output "org1-org2" { | ||
value = vcd_multisite_org_association.org1-org2 | ||
} | ||
|
||
output "site_associations" { | ||
value = data.vcd_resource_list.sites | ||
} | ||
output "org_associations" { | ||
value = data.vcd_resource_list.orgs | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
provider "vcd" { | ||
alias = "vcd2" | ||
user = var.vcd_admin2 | ||
password = var.vcd_password2 | ||
token = "" | ||
api_token = "" | ||
auth_type = "integrated" | ||
saml_adfs_rpt_id = "" | ||
url = var.vcd_url2 | ||
sysorg = var.vcd_sysorg2 | ||
org = var.vcd_org2 | ||
allow_unverified_ssl = "true" | ||
max_retry_timeout = 600 | ||
logging = true | ||
logging_file = "go-vcloud-director-2.log" | ||
} | ||
|
||
data "vcd_org" "org2" { | ||
provider = vcd.vcd2 | ||
name = var.vcd_org2 | ||
} | ||
|
||
data "vcd_multisite_org_data" "org2-data" { | ||
provider = vcd.vcd2 | ||
org_id = data.vcd_org.org2.id | ||
download_to_file = "${var.vcd_org2}.xml" | ||
} | ||
|
||
data "vcd_multisite_site_data" "site2-data" { | ||
provider = vcd.vcd2 | ||
download_to_file = "${var.site_name2}-site.xml" | ||
} | ||
|
||
# The data files are needed because the data will be read by resources handled by a different user, which can't read | ||
# directly the data source that is the origin of these files | ||
|
||
data "local_file" "site2" { | ||
filename = "${var.site_name2}-site.xml" | ||
depends_on = [data.vcd_multisite_site_data.site2-data] | ||
} | ||
|
||
data "local_file" "org2" { | ||
filename = "${var.vcd_org2}.xml" | ||
depends_on = [data.vcd_multisite_org_data.org2-data] | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
resource "vcd_multisite_site_association" "site2-site1" { | ||
provider = vcd.vcd2 | ||
association_data = data.local_file.site1.content | ||
connection_timeout_mins = 2 | ||
} | ||
|
||
resource "vcd_multisite_org_association" "org2-org1" { | ||
provider = vcd.vcd2 | ||
org_id = data.vcd_org.org2.id | ||
association_data = data.local_file.org1.content | ||
connection_timeout_mins = 2 | ||
depends_on = [vcd_multisite_site_association.site2-site1] | ||
} | ||
|
||
output "site2-site1" { | ||
value = vcd_multisite_site_association.site2-site1 | ||
} | ||
|
||
output "org2-org1" { | ||
value = vcd_multisite_org_association.org2-org1 | ||
} |
14 changes: 14 additions & 0 deletions
14
examples/multi-site/site-all-at-once/terraform.tfvars.example
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Rename this file to 'terraform.tfvars' and update the variables to their intended values | ||
vcd_site_name1 = "SITE1" | ||
vcd_url1 = "https://example1.com/api" | ||
vcd_admin1 = "administrator" | ||
vcd_password1 = "myPassword" | ||
vcd_sysorg1 = "System" | ||
vcd_org1 = "nameOfMyOrg" | ||
|
||
vcd_site_name2 = "SITE2" | ||
vcd_url2 = "https://example2.com/api" | ||
vcd_admin2 = "administrator" | ||
vcd_password2 = "anotherPassword" | ||
vcd_sysorg2 = "System" | ||
vcd_org2 = "nameOfMyOtherOrg" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
|
||
# ----------------------- | ||
# site 1 | ||
# ----------------------- | ||
|
||
variable "site_name1" { | ||
type = string | ||
default = "site1" | ||
} | ||
|
||
variable "vcd_url1" { | ||
type = string | ||
} | ||
|
||
variable "vcd_admin1" { | ||
type = string | ||
default = "administrator" | ||
} | ||
|
||
variable "vcd_sysorg1" { | ||
type = string | ||
default = "System" | ||
} | ||
|
||
variable "vcd_password1" { | ||
type = string | ||
} | ||
|
||
variable "vcd_org1" { | ||
type = string | ||
} | ||
|
||
# ----------------------- | ||
# site 2 | ||
# ----------------------- | ||
|
||
variable "site_name2" { | ||
type = string | ||
default = "site2" | ||
} | ||
|
||
variable "vcd_url2" { | ||
type = string | ||
} | ||
|
||
variable "vcd_admin2" { | ||
type = string | ||
default = "administrator" | ||
} | ||
|
||
variable "vcd_sysorg2" { | ||
type = string | ||
default = "System" | ||
} | ||
|
||
variable "vcd_password2" { | ||
type = string | ||
} | ||
|
||
variable "vcd_org2" { | ||
type = string | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
terraform { | ||
required_providers { | ||
vcd = { | ||
source = "vmware/vcd" | ||
version = ">=3.13.0" | ||
} | ||
} | ||
} | ||
|
This file contains 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
This file contains 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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reminder to remove this replacement before merging