Skip to content

Commit

Permalink
Merge branch 'main' into catalog-RO-access-control
Browse files Browse the repository at this point in the history
Signed-off-by: Giuseppe Maxia <[email protected]>
  • Loading branch information
Giuseppe Maxia committed Oct 26, 2023
2 parents 6141b1c + b352c50 commit 6087a4d
Show file tree
Hide file tree
Showing 76 changed files with 3,470 additions and 312 deletions.
3 changes: 3 additions & 0 deletions .changes/v3.11.0/1092-improvements.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* Resources `vcd_vapp_network` and `vcd_vapp_org_network` will additionally check if vApp is in
`RESOLVED` (in addition to already checked `POWERED_OFF`) state before attempting a reboot when
`reboot_vapp_on_removal` flag is set to `true` [GH-1092]
File renamed without changes.
2 changes: 2 additions & 0 deletions .changes/v3.11.0/1111-improvements.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Resource and data source `vcd_nsxt_edgegateway` support attachment of NSX-T Segment backed
External Networks via `external_network` block [GH-1111]
4 changes: 4 additions & 0 deletions .changes/v3.11.0/1117-bug-fixes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* Fixes a bug that made impossible to delete `vcd_rde_type_behavior_acl` resources when the Access Level is the last one
in the Behavior [GH-1117]
* Fixes the resource `vcd_rde_type_behavior_acl` to avoid race conditions when creating, updating or deleting more than one
Access Level [GH-1117]
1 change: 1 addition & 0 deletions .changes/v3.11.0/1117-experimental-features.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* **New Data Source:** `vcd_rde_behavior_invocation` to invoke a Behavior of a given RDE [GH-1117, GH-1136]
1 change: 1 addition & 0 deletions .changes/v3.11.0/1117-improvements.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Field `rde_type_id` from resource `vcd_rde` does not force a deletion when updated, to allow easier RDE Type version upgrades [GH-1117]
2 changes: 1 addition & 1 deletion .changes/v3.11.0/1119-bug-fixes.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* Fix media item detection in `vcd_resource_list`: it was incorrectly listing also vApp templates [GH-1101]
* Fix media item detection in `vcd_resource_list`: it was incorrectly listing also vApp templates [GH-1119]
2 changes: 2 additions & 0 deletions .changes/v3.11.0/1121-features.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* **New Resource:** `vcd_nsxt_edgegateway_l2_vpn_tunnel` to manage Edge Gateway L2 VPN Tunnel sessions [GH-1061]
* **New Data Source:** `vcd_nsxt_edgegateway_l2_vpn_tunnel` to read Edge Gateway L2 VPN Tunnel sessions [GH-1061]
3 changes: 3 additions & 0 deletions .changes/v3.11.0/1122-improvements.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* Resource `vcd_rde_type` supports Behavior hooks with the new `hook` blocks, that allow to automatically invoke
Behaviors on certain RDE lifecycle events [GH-1122]
* Data source `vcd_rde_type` supports reading Behavior hooks from VCD and store their information in the new `hook` blocks [GH-1122]
1 change: 1 addition & 0 deletions .changes/v3.11.0/1123-improvements.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Add property `upload_any_file` to resource `vcd_catalog_media` to allow uploading any file as catalog media item [GH-1123]
1 change: 1 addition & 0 deletions .changes/v3.11.0/1124-improvements.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Add property `download_to_file` to data source `vcd_catalog_media` to allow downloading a catalog media item into a file [GH-1124]
1 change: 1 addition & 0 deletions .changes/v3.11.0/1129-bug-fixes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Fix Issue [#1127](https://github.com/vmware/terraform-provider-vcd/issues/1127) (Incorrect behavior of vcd_resource_list, which can retrieve Edge Gateways belonging to a VDC, but not belonging to a VDC Group) [GH-1129]
2 changes: 2 additions & 0 deletions .changes/v3.11.0/1130-improvements.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Resource and data source `vcd_catalog_vapp_template` add property `lease` with field `storage_lease_in_sec` to handle
the VApp Template lease [GH-1130]
1 change: 1 addition & 0 deletions .changes/v3.11.0/1133-notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Improve `TestAccVcdIpv6Support` to avoid subnet clashes [GH-1133]
1 change: 1 addition & 0 deletions .changes/v3.11.0/1135-bug-fixes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Fix test TestAccVcdRightsContainers and expand it to test most available items [GH-1135]
2 changes: 2 additions & 0 deletions .changes/v3.11.0/1140-bug-fixes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Fix organization retrieval in `vcd_resource_list` when users fill the `"parent"` field instead of `"org"` [GH-1140]
* Fix organization retrieval in `vcd_resource_list` when field `"org"` from the provider block was not used [GH-1140]
1 change: 1 addition & 0 deletions .changes/v3.11.0/1142-bug-fixes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Fix Issue [1134](https://github.com/vmware/terraform-provider-vcd/issues/1134) : Can't use SYSTEM `ldap_mode` [GH-1142]
1 change: 1 addition & 0 deletions .changes/v3.11.0/1142-improvements.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Add property `custom_user_ou` to `vcd_org_ldap` to specify custom attributes when `ldap_mode = "SYSTEM"` [GH-1142]
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/hashicorp/go-version v1.6.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.27.0
github.com/kr/pretty v0.2.1
github.com/vmware/go-vcloud-director/v2 v2.22.0-alpha.3
github.com/vmware/go-vcloud-director/v2 v2.22.0-alpha.9
)

require (
Expand Down Expand Up @@ -54,12 +54,12 @@ require (
github.com/peterhellberg/link v1.1.0 // indirect
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
github.com/zclconf/go-cty v1.13.2 // indirect
golang.org/x/crypto v0.10.0 // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/exp v0.0.0-20221114191408-850992195362
golang.org/x/mod v0.10.0 // indirect
golang.org/x/net v0.11.0 // indirect
golang.org/x/sys v0.9.0 // indirect
golang.org/x/text v0.10.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
google.golang.org/grpc v1.56.0 // indirect
Expand Down
16 changes: 8 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -130,17 +130,17 @@ github.com/zclconf/go-cty v1.13.2 h1:4GvrUxe/QUDYuJKAav4EYqdM47/kZa672LwmXFmEKT0
github.com/zclconf/go-cty v1.13.2/go.mod h1:YKQzy/7pZ7iq2jNFzy5go57xdxdWoLLpaEp4u238AE0=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.10.0 h1:LKqV2xt9+kDzSTfOhx4FrkEBcMrAgHSYgzywV9zcGmM=
golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I=
golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc=
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
golang.org/x/exp v0.0.0-20221114191408-850992195362 h1:NoHlPRbyl1VFI6FjwHtPQCN7wAMXI6cKcqrmXhOOfBQ=
golang.org/x/exp v0.0.0-20221114191408-850992195362/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk=
golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.11.0 h1:Gi2tvZIJyBtO9SDr1q9h5hEQCp/4L2RQ+ar0qjx2oNU=
golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ=
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
Expand All @@ -151,14 +151,14 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s=
golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.10.0 h1:UpjohKhiEgNc0CSauXmwYftY1+LlaC75SJwh0SgCX58=
golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
Expand Down
4 changes: 4 additions & 0 deletions scripts/gosec-config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# GOSEC_URL is the address of the gosec installation script
export GOSEC_URL=https://raw.githubusercontent.com/securego/gosec/master/install.sh
# NOTE: if we want to get the latest version, we set the variable below to empty ("")
export GOSEC_VERSION=v2.17.0
12 changes: 10 additions & 2 deletions scripts/gosec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ then
exit 1
fi

if [ ! -f ./scripts/gosec-config.sh ]
then
echo "file ./scripts/gosec-config.sh not found"
exit 1
fi

source ./scripts/gosec-config.sh

function exists_in_path {
what=$1
for dir in $(echo $PATH | tr ':' ' ')
Expand All @@ -35,14 +43,14 @@ function get_gosec {
echo "'curl' executable not found - Skipping gosec"
exit 0
fi
$curl -sfL https://raw.githubusercontent.com/securego/gosec/master/install.sh | sh
$curl -sfL $GOSEC_URL > gosec_install.sh
exit_code=$?
if [ "$exit_code" != "0" ]
then
echo "Error downloading gosec installer"
exit $exit_code
fi
sh -x gosec_install.sh > gosec_install.log 2>&1
sh -x gosec_install.sh $GOSEC_VERSION > gosec_install.log 2>&1
if [ "$exit_code" != "0" ]
then
echo "Error installing gosec"
Expand Down
2 changes: 2 additions & 0 deletions scripts/skip-upgrade-tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -295,5 +295,7 @@ vcd.TestAccVcdVmPlacementPolicyWithoutDescription.tf v3.9.0 "Changed 'descriptio
vcd.TestAccVcdVmPlacementPolicy.tf v3.9.0 "Changed 'description' to Computed in 'vcd_vm_placement_policy'"
vcd.ResourceSchema-vcd_vdc_group.tf v3.10.0 "Added new field 'force_delete'"
vcd.ResourceSchema-vcd_nsxt_alb_pool.tf v3.10.0 "added field 'ssl_enabled'"
vcd.ResourceSchema-vcd_nsxt_edgegateway.tf v3.10.0 "Added support for Segment backed external networks"
vcd.ResourceSchema-vcd_vapp_vm.tf v3.11.0 "added fields 'firmware' and 'boot_options'"
vcd.ResourceSchema-vcd_vm.tf v3.11.0 "added fields 'firmware' and 'boot_options'"
vcd.TestAccVcdIpv6Support-step2.tf v3.10.0 "Test had clashing subnets in 3.10"
11 changes: 0 additions & 11 deletions vcd/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,3 @@ func getVersionFromFile(fileName string) (string, error) {

return strings.TrimSpace(string(versionText)), nil
}

// firstNonEmpty returns the first non empty string from a list
// If all arguments are empty, returns an empty string
func firstNonEmpty(args ...string) string {
for _, s := range args {
if s != "" {
return s
}
}
return ""
}
1 change: 1 addition & 0 deletions vcd/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ type TestConfig struct {
VdcGroup string `json:"vdcGroup"`
VdcGroupEdgeGateway string `json:"vdcGroupEdgeGateway"`
NsxtImportSegment string `json:"nsxtImportSegment"`
NsxtImportSegment2 string `json:"nsxtImportSegment2"`
NsxtEdgeCluster string `json:"nsxtEdgeCluster"`
NsxtAlbControllerUrl string `json:"nsxtAlbControllerUrl"`
NsxtAlbControllerUser string `json:"nsxtAlbControllerUser"`
Expand Down
2 changes: 2 additions & 0 deletions vcd/datasource_not_found_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,8 @@ func addMandatoryParams(dataSourceName string, mandatoryFields []string, t *test
templateFields = templateFields + `rde_type_id = "urn:vcloud:type:donotexist:donotexist:9.9.9"` + "\n"
case "rde_interface_id":
templateFields = templateFields + `rde_interface_id = "urn:vcloud:interface:notexist:notexist:9.9.9"` + "\n"
case "rde_id":
templateFields = templateFields + `rde_id = "urn:vcloud:entity:notexist:notexist:90337fee-f332-40f2-a124-96e890eb1522"` + "\n"
case "behavior_id":
templateFields = templateFields + `behavior_id = "urn:vcloud:behavior-interface:NotExist:notexist:notexist:9.9.9"` + "\n"
case "ip_space_id":
Expand Down
5 changes: 5 additions & 0 deletions vcd/datasource_vcd_catalog_media.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ func datasourceVcdCatalogMedia() *schema.Resource {
Computed: true,
Description: "Storage profile name",
},
"download_to_file": {
Type: schema.TypeString,
Optional: true,
Description: "Will download the contents of the media item into the given file",
},
"filter": {
Type: schema.TypeList,
MaxItems: 1,
Expand Down
78 changes: 74 additions & 4 deletions vcd/datasource_vcd_catalog_media_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ package vcd

import (
"fmt"
"os"
"regexp"
"runtime"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
Expand All @@ -21,6 +23,11 @@ func TestAccVcdCatalogAndMediaDatasource(t *testing.T) {
var TestAccVcdDataSourceMedia = "TestAccVcdCatalogMediaBasic"
var TestAccVcdDataSourceMediaDescription = "TestAccVcdCatalogMediaBasicDescription"

_, sourceFile, _, _ := runtime.Caller(0)
if !fileExists(sourceFile) {
t.Skip("source file for this test was not found")
}
tempFile := "source_file.txt"
var params = StringMap{
"Org": testConfig.VCD.Org,
"Catalog": testConfig.VCD.Catalog.Name,
Expand All @@ -30,8 +37,12 @@ func TestAccVcdCatalogAndMediaDatasource(t *testing.T) {
"UploadProgress": testConfig.Ova.UploadProgress,
"Tags": "catalog",
"CatalogMediaName": TestAccVcdDataSourceMedia,
"MediaFileName": "TestMediaFile",
"MediaFilePath": sourceFile,
"DownloadToFile": tempFile,
"Description": TestAccVcdDataSourceMediaDescription,
"MediaPath": testConfig.Media.MediaPath,
"FuncName": t.Name(),
}
testParamsNotEmpty(t, params)

Expand All @@ -43,6 +54,14 @@ func TestAccVcdCatalogAndMediaDatasource(t *testing.T) {

debugPrintf("#[DEBUG] CONFIGURATION: %s", configText)

defer func() {
if fileExists(tempFile) {
err := os.Remove(tempFile)
if err != nil {
fmt.Printf("error deleting file '%s': %s", tempFile, err)
}
}
}()
resource.Test(t, resource.TestCase{
PreCheck: func() { preRunChecks(t) },
ProviderFactories: testAccProviders,
Expand All @@ -56,14 +75,37 @@ func TestAccVcdCatalogAndMediaDatasource(t *testing.T) {
resource.TestMatchOutput("creation_date", regexp.MustCompile(`^\d{4}-\d{2}-\d{2}.*`)),
resource.TestCheckOutput("status", "RESOLVED"),
resource.TestMatchOutput("storage_profile_name", regexp.MustCompile(`^\S+`)),
resource.TestCheckResourceAttr("vcd_catalog_media.media_file", "name", "TestMediaFile"),
testCheckMediaNonStringOutputs(),
),
},
{
Config: configText,
Check: checkFileContentsAreEqual(sourceFile, tempFile),
},
},
})
postTestChecks(t)
}

func checkFileContentsAreEqual(fileName1, fileName2 string) resource.TestCheckFunc {

return func(s *terraform.State) error {
contents1, err := os.ReadFile(fileName1) // #nosec G304 -- file name under control used for testing
if err != nil {
return err
}
contents2, err := os.ReadFile(fileName2) // #nosec G304 -- file name under control used for testing
if err != nil {
return err
}
if string(contents1) == string(contents2) {
return nil
}
return fmt.Errorf("file %s and %s have different content", fileName1, fileName2)
}
}

func catalogMediaDestroyed(catalog, mediaName string) resource.TestCheckFunc {
return func(s *terraform.State) error {
conn := testAccProvider.Meta().(*VCDClient)
Expand All @@ -84,29 +126,57 @@ func catalogMediaDestroyed(catalog, mediaName string) resource.TestCheckFunc {
}

const testAccCheckVcdCatalogMediaDS = `
data "vcd_catalog" "mycat" {
org = "{{.Org}}"
name = "{{.Catalog}}"
}
resource "vcd_catalog_media" "{{.CatalogMediaName}}" {
org = "{{.Org}}"
catalog = "{{.Catalog}}"
org = "{{.Org}}"
catalog_id = data.vcd_catalog.mycat.id
name = "{{.CatalogMediaName}}"
description = "{{.Description}}"
media_path = "{{.MediaPath}}"
upload_piece_size = {{.UploadPieceSize}}
show_upload_progress = "{{.UploadProgress}}"
show_upload_progress = {{.UploadProgress}}
metadata = {
catalogMedia_metadata = "catalogMedia Metadata"
catalogMedia_metadata2 = "catalogMedia Metadata2"
}
}
# this resource uploads the source file for the current test as a media item
resource "vcd_catalog_media" "media_file" {
org = "{{.Org}}"
catalog_id = data.vcd_catalog.mycat.id
name = "{{.MediaFileName}}"
description = "{{.Description}}"
media_path = "{{.MediaFilePath}}"
upload_piece_size = {{.UploadPieceSize}}
show_upload_progress = {{.UploadProgress}}
upload_any_file = true
}
data "vcd_catalog_media" "{{.NewCatalogMedia}}" {
org = "{{.Org}}"
catalog = "{{.Catalog}}"
catalog_id = data.vcd_catalog.mycat.id
name = vcd_catalog_media.{{.CatalogMediaName}}.name
depends_on = [vcd_catalog_media.{{.CatalogMediaName}}]
}
# This data source downloads the contents of the media item to a local file
data "vcd_catalog_media" "media_file_ds" {
org = "{{.Org}}"
catalog_id = data.vcd_catalog.mycat.id
name = vcd_catalog_media.media_file.name
download_to_file = "{{.DownloadToFile}}"
}
output "size" {
value = data.vcd_catalog_media.{{.NewCatalogMedia}}.size
}
Expand Down
14 changes: 14 additions & 0 deletions vcd/datasource_vcd_catalog_vapp_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,20 @@ func datasourceVcdCatalogVappTemplate() *schema.Resource {
Computed: true,
Description: "Set of VM names within the vApp template",
},
"lease": {
Type: schema.TypeList,
Computed: true,
Description: "Defines lease parameters for this vApp template",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"storage_lease_in_sec": {
Type: schema.TypeInt,
Computed: true,
Description: "How long the vApp template is available before being automatically deleted or marked as expired. 0 means never expires",
},
},
},
},
"filter": {
Type: schema.TypeList,
MaxItems: 1,
Expand Down
Loading

0 comments on commit 6087a4d

Please sign in to comment.