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

Add vApp network resources and data sources #455

Merged
merged 119 commits into from
Mar 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
6585559
Add missing file
vbauzys Jul 15, 2019
e247d25
Merge branch 'master' of github.com:terraform-providers/terraform-pro…
vbauzys Jul 15, 2019
cf1e7c2
git push origin masterMerge branch 'master' of github.com:terraform-p…
vbauzys Jul 23, 2019
be6790f
Merge branch 'master' of github.com:terraform-providers/terraform-pro…
vbauzys Jul 24, 2019
6f4c5cb
Merge branch 'master' of github.com:terraform-providers/terraform-pro…
vbauzys Jul 25, 2019
c73d402
Merge branch 'master' of github.com:terraform-providers/terraform-pro…
vbauzys Jul 26, 2019
261d142
git push origin master
vbauzys Jul 29, 2019
c431d43
git push origin masterMerge branch 'master' of github.com:terraform-p…
vbauzys Aug 1, 2019
414b3bf
git push origin masterMerge branch 'master' of github.com:terraform-p…
vbauzys Aug 15, 2019
8b03ab8
Merge branch 'master' of github.com:terraform-providers/terraform-pro…
vbauzys Aug 22, 2019
36c5487
git push origin masterMerge branch 'master' of github.com:terraform-p…
vbauzys Sep 3, 2019
db01eec
git push origin masterMerge branch 'master' of github.com:terraform-p…
vbauzys Sep 9, 2019
331e895
git push origin masterMerge branch 'master' of github.com:terraform-p…
vbauzys Sep 12, 2019
a85d555
git push origin masterMerge branch 'master' of github.com:terraform-p…
vbauzys Sep 19, 2019
e1996e3
git push origin masterMerge branch 'master' of github.com:terraform-p…
vbauzys Sep 24, 2019
9c63eec
Merge branch 'master' of github.com:terraform-providers/terraform-pro…
vbauzys Sep 27, 2019
5073f6c
git push origin masterMerge branch 'master' of github.com:terraform-p…
vbauzys Oct 7, 2019
f0bdef3
git push origin master
vbauzys Oct 23, 2019
24f169d
git push origin masterMerge branch 'master' of github.com:terraform-p…
vbauzys Oct 24, 2019
06b36d1
git push origin masterMerge branch 'master' of github.com:terraform-p…
vbauzys Oct 24, 2019
30d6a79
Merge branch 'master' of github.com:terraform-providers/terraform-pro…
vbauzys Oct 24, 2019
0ca001f
git push origin masterMerge branch 'master' of github.com:terraform-p…
vbauzys Oct 24, 2019
8c9c7c4
git push origin master
vbauzys Oct 25, 2019
4c8d081
git push origin masterMerge branch 'master' of github.com:terraform-p…
vbauzys Oct 30, 2019
206bc9f
git push origin masterMerge branch 'master' of github.com:terraform-p…
vbauzys Oct 31, 2019
48970bc
git push origin masterMerge branch 'master' of github.com:terraform-p…
vbauzys Nov 4, 2019
e7ef092
git push origin masterMerge branch 'master' of github.com:terraform-p…
vbauzys Nov 7, 2019
cb5659a
git push origin masterMerge branch 'master' of github.com:terraform-p…
vbauzys Nov 8, 2019
1e097fd
git push origin masterMerge branch 'master' of github.com:terraform-p…
vbauzys Nov 11, 2019
ae2d955
git push origin masterMerge branch 'master' of github.com:terraform-p…
vbauzys Nov 12, 2019
67f9230
git push origin masterMerge branch 'master' of github.com:terraform-p…
vbauzys Nov 14, 2019
867b991
git push origin masterMerge branch 'master' of github.com:terraform-p…
vbauzys Dec 2, 2019
7ec2137
git push origin masterMerge branch 'master' of github.com:terraform-p…
vbauzys Dec 6, 2019
3f3798b
Merge
vbauzys Dec 19, 2019
ec131aa
git push origin masterMerge branch 'master' of github.com:terraform-p…
vbauzys Dec 19, 2019
e985ac6
git push origin masterMerge branch 'master' of github.com:terraform-p…
vbauzys Jan 14, 2020
7bac78e
git push origin masterMerge branch 'master' of github.com:terraform-p…
vbauzys Jan 27, 2020
b299b2b
added new parameters and update function
vbauzys Feb 6, 2020
d027cc8
Added org network resource
vbauzys Feb 10, 2020
2b81637
git push origin master
vbauzys Feb 10, 2020
2bd657a
Cleanup after usage latest govcd
vbauzys Feb 12, 2020
2b82082
git push origin masterMerge branch 'master' of github.com:terraform-p…
vbauzys Feb 12, 2020
9d3ed9d
bump govcd
vbauzys Feb 12, 2020
ebbbcee
cleanup
vbauzys Feb 12, 2020
d45b231
Add tests
vbauzys Feb 13, 2020
bb0639b
swtiching
vbauzys Feb 13, 2020
5301c6f
bump govcd
vbauzys Feb 13, 2020
218b30f
Added tests
vbauzys Feb 13, 2020
47bb204
Improve testing and name handling
vbauzys Feb 14, 2020
eeba5f3
Improve testing and name handling
vbauzys Feb 17, 2020
3543d7a
Added import functionality and tests
vbauzys Feb 18, 2020
9c7f656
Add datasources and testes. Improved read functionality
vbauzys Feb 19, 2020
bdc1a4e
Add part of docs
vbauzys Feb 19, 2020
4b50016
Fix
vbauzys Feb 19, 2020
0049eda
Add part of docs
vbauzys Feb 19, 2020
be07503
Add data source docs
vbauzys Feb 20, 2020
d5a3b97
Improvements
vbauzys Feb 20, 2020
aa2198d
git push origin master
vbauzys Feb 20, 2020
eda9486
bump govcd
vbauzys Feb 20, 2020
0c0dc77
fix after govcd changes
vbauzys Feb 20, 2020
6316a5b
bump govcd missing part
vbauzys Feb 20, 2020
ef068bd
Merge branch 'master' into vapp-netw
vbauzys Feb 20, 2020
bb26c30
Improve comment
vbauzys Feb 20, 2020
4137f26
Improve comment
vbauzys Feb 20, 2020
49ef28c
Improve comment
vbauzys Feb 20, 2020
b785dcf
Fix module
vbauzys Feb 20, 2020
b9c3ea4
Removed default values for DNS
vbauzys Feb 20, 2020
de266cd
bump govcd version
vbauzys Feb 24, 2020
ca5c78b
Add change log
vbauzys Feb 24, 2020
46d1e66
Improve docs
vbauzys Feb 24, 2020
cb7bb97
git push origin masterMerge branch 'master' of github.com:terraform-p…
vbauzys Feb 24, 2020
03ced76
Merge branch 'master' into vapp-netw
vbauzys Feb 24, 2020
e47fc38
Improved docs
vbauzys Feb 24, 2020
759c62d
Improved docs
vbauzys Feb 24, 2020
62eb5a1
Small improvement
vbauzys Feb 24, 2020
0b6855d
Add additional check for empty vApp network
vbauzys Feb 24, 2020
e706b4a
Refactor dhcp pool
vbauzys Feb 24, 2020
e923709
Improve error message
vbauzys Feb 24, 2020
9f41ec2
Improve error message
vbauzys Feb 24, 2020
470740e
Improve error message
vbauzys Feb 24, 2020
a15565c
Add missing descriptions
vbauzys Feb 24, 2020
be6c080
Rename org_network to org_network_name
vbauzys Feb 24, 2020
5f4f4de
Rename org_network to org_network_name
vbauzys Feb 24, 2020
197a832
Rename org_network to org_network_name
vbauzys Feb 24, 2020
ae84aad
Added validation for import
vbauzys Feb 24, 2020
13d9998
Improvements
vbauzys Feb 28, 2020
931bf68
bump govcd
vbauzys Feb 28, 2020
792178e
bump govcd
vbauzys Feb 28, 2020
28af28e
improved docs
vbauzys Mar 2, 2020
28b0ce9
Improve read functionality and bump govcd
vbauzys Mar 2, 2020
0e920f5
Improve handling of DHCP end address
vbauzys Mar 2, 2020
1e14e32
Removed firewall enabled and nat enabled default values
vbauzys Mar 2, 2020
585b898
Fix test issue
vbauzys Mar 3, 2020
3506d75
Fix issue
vbauzys Mar 3, 2020
a9e1e58
Fix test issue
vbauzys Mar 3, 2020
59aa12b
Fix nil issue
vbauzys Mar 3, 2020
ab6c7e1
Fix test issue
vbauzys Mar 3, 2020
ff50f77
Improve tests, by removing create vapp networks
vbauzys Mar 3, 2020
43d01f3
Improvements
vbauzys Mar 3, 2020
04442b0
Improve test
vbauzys Mar 3, 2020
e8a174a
Improve test
vbauzys Mar 3, 2020
2be8e13
Improve test
vbauzys Mar 3, 2020
b4813b6
Improve tests
vbauzys Mar 3, 2020
32c0937
Improve tests
vbauzys Mar 3, 2020
fa86791
Improve tests
vbauzys Mar 3, 2020
ced2f24
Revert back change
vbauzys Mar 4, 2020
dab1988
Improve tests
vbauzys Mar 4, 2020
51e8a00
Improve docs
vbauzys Mar 4, 2020
d1a65ff
Improve docs
vbauzys Mar 4, 2020
aa23587
Added warning for VM
vbauzys Mar 4, 2020
e537072
Removed firewall enabled and nat enabled default values
vbauzys Mar 4, 2020
455e78e
Improve docs, update example of VM
vbauzys Mar 4, 2020
a75efde
Add section for changelog about deprecation
vbauzys Mar 5, 2020
418dd49
bump govcd version
vbauzys Mar 5, 2020
2ee27ea
Improve changelog
vbauzys Mar 5, 2020
a7b9768
Improve changelog
vbauzys Mar 5, 2020
f78bde5
Improve changelog
vbauzys Mar 5, 2020
f433df0
Improve changelog
vbauzys Mar 5, 2020
811a39c
Improve changelog
vbauzys Mar 5, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ FEATURES:
* `vcd_org_vdc` can be created with Flex allocation in vCD 9.7 and later. Also two new fields added for Flex - `elasticity`, `include_vm_memory_overhead` [GH-443]
* `resource/vcd_vapp_vm` and `datasource/vcd_vapp_vm` get optional `network_dhcp_wait_seconds` field
to ensure `ip` is reported when `ip_allocation_mode=DHCP` is used [GH-436]
* **New Resource:** `vcd_vapp_org_network` vApp organization network [GH-455]
* `vcd_vapp_network` supports isolated network and vApp network connected to Org VDC networks [GH-455]
* **New Data Source:** `vcd_vapp_org_network` vApp org network [GH-455]
* **New Data Source:** `vcd_vapp_network` vApp network [GH-455]
Copy link
Collaborator

Choose a reason for hiding this comment

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

We need a "DEPRECATIONS:" section with the note about behavior we're deprecating of VM creating vApp Org Network if it doesn't exist.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added


IMPROVEMENTS:

Expand All @@ -18,6 +22,9 @@ IMPROVEMENTS:
* `vcd_vapp_vm` `disk` has new attribute `size_in_mb` [GH-433]
* `datasource/*` - all data sources return an error when object is not found [GH-446]

DEPRECATIONS:
* `resource/vcd_vapp_vm` `network.name` deprecated automatic attaching of vApp Org network when `network.type=org` and it doesn't exist. Requires to create/attach vApp Org network with `vcd_vapp_org_network` before referencing it.

BUG FIXES:

* fix `vcd_vapp_vm` resource read - independent disks where losing `bus_number` and `unit_number` values after refresh. [GH-433]
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ go 1.13
require (
github.com/hashicorp/go-version v1.2.0
github.com/hashicorp/terraform-plugin-sdk v1.5.0
github.com/vmware/go-vcloud-director/v2 v2.6.0-alpha.6
github.com/vmware/go-vcloud-director/v2 v2.6.0-beta.1
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ github.com/vmihailenco/msgpack v3.3.3+incompatible h1:wapg9xDUZDzGCNFlwc5SqI1rvc
github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
github.com/vmihailenco/msgpack v4.0.1+incompatible h1:RMF1enSPeKTlXrXdOcqjFUElywVZjjC6pqse21bKbEU=
github.com/vmihailenco/msgpack v4.0.1+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
github.com/vmware/go-vcloud-director/v2 v2.6.0-alpha.6 h1:FixFeoQ0+q8sMVXVfEeVegoJPwcOiVOtEHV4UAjrpSM=
github.com/vmware/go-vcloud-director/v2 v2.6.0-alpha.6/go.mod h1:XY9Fmqp1JeHIU2nP87NykB6unNCsY6qV4Zdu5JI4aZU=
github.com/vmware/go-vcloud-director/v2 v2.6.0-beta.1 h1:S1yYH2T3VXMGiUgWSOnBU1qbFjuMIwkP6rZlxOQZgCU=
github.com/vmware/go-vcloud-director/v2 v2.6.0-beta.1/go.mod h1:XY9Fmqp1JeHIU2nP87NykB6unNCsY6qV4Zdu5JI4aZU=
github.com/zclconf/go-cty v1.0.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s=
github.com/zclconf/go-cty v1.1.0 h1:uJwc9HiBOCpoKIObTQaLR+tsEXx1HBHnOsOOpcdhZgw=
github.com/zclconf/go-cty v1.1.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s=
Expand Down
2 changes: 2 additions & 0 deletions vcd/datasource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ func addMandatoryParams(dataSourceName string, mandatoryFields []string, t *test
templateFields = templateFields + `rule_id = "347928347234"` + "\n"
case "name":
templateFields = templateFields + `name = "does-not-exist"` + "\n"
case "org_network_name":
templateFields = templateFields + `org_network_name = "does-not-exist"` + "\n"
}

}
Expand Down
150 changes: 150 additions & 0 deletions vcd/datasource_vcd_vapp_network.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
package vcd

import (
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
)

func datasourceVcdVappNetwork() *schema.Resource {
return &schema.Resource{
Read: datasourceVappNetworkRead,
Schema: map[string]*schema.Schema{
"name": &schema.Schema{
Type: schema.TypeString,
Required: true,
Description: "vApp network name",
},
"vapp_name": &schema.Schema{
Type: schema.TypeString,
Required: true,
Description: "vApp to use",
},
"org": {
Type: schema.TypeString,
Optional: true,
Description: "The name of organization to use, optional if defined at provider " +
"level. Useful when connected as sysadmin working across different organizations",
},
"vdc": {
Type: schema.TypeString,
Optional: true,
Description: "The name of VDC to use, optional if defined at provider level",
},
"description": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "Optional description for the network",
},
"netmask": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "Netmask address for a subnet",
},
"gateway": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "Gateway of the network",
},

"dns1": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "Primary DNS server",
},

"dns2": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "Secondary DNS server",
},

"dns_suffix": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "DNS suffix",
},

"guest_vlan_allowed": &schema.Schema{
Type: schema.TypeBool,
Computed: true,
Description: "True if Network allows guest VLAN tagging",
},
"org_network_name": {
Type: schema.TypeString,
Computed: true,
Description: "org network name to which vapp network is connected",
},
"firewall_enabled": {
Type: schema.TypeBool,
Computed: true,
Description: "firewall service enabled or disabled. Default is true",
},
"nat_enabled": {
Type: schema.TypeBool,
Computed: true,
Description: "NAT service enabled or disabled. Default is true",
},
"retain_ip_mac_enabled": {
Type: schema.TypeBool,
Computed: true,
Description: "Specifies whether the network resources such as IP/MAC of router will be retained across deployments.",
},
"dhcp_pool": &schema.Schema{
Type: schema.TypeSet,
Computed: true,
Description: "A range of IPs to issue to virtual machines that don't have a static IP",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"start_address": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},

"end_address": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},

"default_lease_time": &schema.Schema{
Type: schema.TypeInt,
Computed: true,
},

"max_lease_time": &schema.Schema{
Type: schema.TypeInt,
Computed: true,
},

"enabled": &schema.Schema{
Type: schema.TypeBool,
Computed: true,
},
},
},
Set: resourceVcdNetworkIPAddressHash,
},
"static_ip_pool": &schema.Schema{
Type: schema.TypeSet,
Computed: true,
Description: "A range of IPs permitted to be used as static IPs for virtual machines",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"start_address": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},

"end_address": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
},
},
Set: resourceVcdNetworkIPAddressHash,
},
},
}
}

func datasourceVappNetworkRead(d *schema.ResourceData, meta interface{}) error {
return genericVappNetworkRead(d, meta, "datasource")
}
Loading