forked from vmware/terraform-provider-vcd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Site and Org associations (vmware#1260)
* Add Data Source vcd_multisite_site to read the state and associations of current site * Add Data Source vcd_multisite_site_data to produce the association data needed to start a site association * Add Data Source vcd_multisite_site_association to read the details of a site association * Add Resource vcd_multisite_site_association to associate the current site with a remote one * Add Data Source vcd_multisite_org_data to produce the association data needed to start an organization association * Add Data Source vcd_multisite_org_association to read the details of an organization association * Add Resource vcd_multisite_org_association to associate a local organization with a remote one * Add Guide "Site and Org associations" to describe association operations for sites and organizations * Update vcd_resource_list for site and org associations * Add site-all-at-once example * Add org-all-at-once example * Add comprehensive test for site and Org association * Add documentation * Update DataSourceNotFound test * Add Changelog entries * Add import test for multisite resources --------- Signed-off-by: Giuseppe Maxia <[email protected]>
- Loading branch information
1 parent
3fcac89
commit 8334ce4
Showing
42 changed files
with
2,500 additions
and
14 deletions.
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 |
---|---|---|
|
@@ -34,3 +34,6 @@ jobs: | |
|
||
- name: test | ||
run: make test | ||
|
||
- name: tags | ||
run: make tagverify |
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
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.