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

New resource and datasource vcd_nsxt_edgegateway_dns for DNS configuration management #1154

Merged
merged 32 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
62f07a4
Define schema for the NSX-T Edge Gateway DNS resource
Nov 7, 2023
d95b8d5
Implement Terraform CRUD operations for the Edge Gateway DNS resource
Nov 7, 2023
b33a034
Add datasource
Nov 7, 2023
6de9ad4
Create tests for Edge Gateway DNS Feature
Nov 8, 2023
7539487
Start writing the docs for the DNS resource
Nov 8, 2023
3ec45f4
cherrypick testCheckResourceAttrSetWhenVersionMatches from abarreiro PR
Nov 9, 2023
1723e09
Fix typos
Nov 9, 2023
8dc2b0c
Remove IP Spaces part of test due to complication of running
Nov 13, 2023
636fd95
finish documentation
Nov 13, 2023
ca808b6
go mod tidy
Nov 13, 2023
f438fe1
Add changelog entry, update documentation, add vcd.erb entries
Nov 13, 2023
a9a1048
Merge branch 'main' of https://github.com/vmware/terraform-provider-v…
Nov 13, 2023
5cd551d
update docs
Nov 13, 2023
eeade67
update docs
Nov 13, 2023
a424cc7
add vdc group test
Nov 14, 2023
b030fe3
merge main
Nov 15, 2023
9a7b067
Add tests for Vdc Group Edge Gateway and IP Spaces Edge gateways, fix a
Nov 15, 2023
959c3a0
address comments, fix bugs
Nov 16, 2023
f6fac59
update message
Nov 16, 2023
e0cf5da
update elevated version
Nov 16, 2023
2b02c13
fix things, skip tests, do stuff
Nov 17, 2023
234d4bf
Make DatasourceNotFound test work, also add checks when setting data for
Nov 17, 2023
dd52379
add nosec directive
Nov 17, 2023
50b3980
Move nosec directive
Nov 17, 2023
9020b5a
fix re-create operation
Nov 17, 2023
9827bea
Change place of nosec directive
Nov 17, 2023
353dbe5
fix some bugs on datasource read
Nov 17, 2023
7fb98c3
Skip Ip SPaces test for Org users
Nov 17, 2023
7b2393c
add dataSourcesRequiringSysAdmin l2vpn tunnel
Nov 17, 2023
9f81ce2
Add comment regarding future need of partial matching conditional
Nov 17, 2023
d0df04c
update go.mod
Nov 23, 2023
0aa411d
merge main
Nov 23, 2023
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
2 changes: 2 additions & 0 deletions .changes/v3.11.0/1154-features.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* **New Resource:** `vcd_nsxt_edgegateway_dns` to manage Edge Gateway DNS forwarder configuration [GH-1121]
* **New Data Source:** `vcd_nsxt_edgegateway_dns` to read Edge Gateway DNS forwarder configuration [GH-1121]
adambarreiro marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,5 @@ require (
google.golang.org/grpc v1.57.1 // indirect
google.golang.org/protobuf v1.31.0 // indirect
)

replace github.com/vmware/go-vcloud-director/v2 => github.com/adezxc/go-vcloud-director/v2 v2.20.0-alpha.15.0.20231113092728-5fdcf1502c10
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc
github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95 h1:KLq8BE0KwCL+mmXnjLWEAOYO+2l2AE4YMmqG1ZpZHBs=
github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0=
github.com/acomagu/bufpipe v1.0.4 h1:e3H4WUzM3npvo5uv95QuJM3cQspFNtFBzvJ2oNjKIDQ=
github.com/adezxc/go-vcloud-director/v2 v2.20.0-alpha.15.0.20231113092728-5fdcf1502c10 h1:OtP9TN5Ny7oBB9+2s8LOoJSAr9RFEwqGZ8rJNNoOYz4=
github.com/adezxc/go-vcloud-director/v2 v2.20.0-alpha.15.0.20231113092728-5fdcf1502c10/go.mod h1:QPxGFgrUcSyzy9IlpwDE4UNT3tsOy2047tJOPEJ4nlw=
github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE=
github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec=
Expand Down
64 changes: 64 additions & 0 deletions vcd/datasource_vcd_nsxt_edgegateway_dns.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package vcd

import (
"context"

"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

func datasourceVcdNsxtEdgeGatewayDns() *schema.Resource {
return &schema.Resource{
ReadContext: datasourceVcdNsxtEdgeGatewayDnsRead,
Schema: map[string]*schema.Schema{
"org": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
adambarreiro marked this conversation as resolved.
Show resolved Hide resolved
Description: "The name of organization to use, optional if defined at provider " +
"level. Useful when connected as sysadmin working across different organizations",
},
"edge_gateway_id": {
Type: schema.TypeString,
Required: true,
Description: "Edge gateway ID for DNS configuration",
},
"enabled": {
Type: schema.TypeBool,
Computed: true,
Description: "Status of the DNS Forwarder. Defaults to `true`",
adambarreiro marked this conversation as resolved.
Show resolved Hide resolved
},
"listener_ip": {
Type: schema.TypeString,
Computed: true,
Description: "IP on which the DNS forwarder listens.",
},
"snat_rule_enabled": {
Type: schema.TypeBool,
Computed: true,
Description: "The value is `true` if a SNAT rule exists for the DNS forwarder.",
},
"snat_rule_ip_address": {
Type: schema.TypeString,
Computed: true,
Description: "The external IP address of the SNAT rule. (VCD 10.5.0+)",
},
"default_forwarder_zone": {
Type: schema.TypeList,
Computed: true,
Description: "The default forwarder zone.",
Elem: defaultForwarderZone,
adambarreiro marked this conversation as resolved.
Show resolved Hide resolved
},
"conditional_forwarder_zone": {
Type: schema.TypeSet,
Computed: true,
Description: "Conditional forwarder zone",
Elem: conditionalForwarderZone,
},
},
}
}

func datasourceVcdNsxtEdgeGatewayDnsRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
adambarreiro marked this conversation as resolved.
Show resolved Hide resolved
return genericVcdNsxtEdgegatewayDnsRead(ctx, d, meta, "datasource")
}
2 changes: 2 additions & 0 deletions vcd/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ var globalDataSourceMap = map[string]*schema.Resource{
"vcd_nsxt_global_default_segment_profile_template": datasourceVcdGlobalDefaultSegmentProfileTemplate(), // 3.11
"vcd_org_vdc_nsxt_network_profile": datasourceVcdNsxtOrgVdcNetworkProfile(), // 3.11
"vcd_nsxt_network_segment_profile": datasourceVcdNsxtOrgVdcNetworkSegmentProfileTemplate(), // 3.11
"vcd_nsxt_edgegateway_dns": datasourceVcdNsxtEdgeGatewayDns(), // 3.11
}

var globalResourceMap = map[string]*schema.Resource{
Expand Down Expand Up @@ -256,6 +257,7 @@ var globalResourceMap = map[string]*schema.Resource{
"vcd_nsxt_global_default_segment_profile_template": resourceVcdGlobalDefaultSegmentProfileTemplate(), // 3.11
"vcd_org_vdc_nsxt_network_profile": resourceVcdNsxtOrgVdcNetworkProfile(), // 3.11
"vcd_nsxt_network_segment_profile": resourceVcdNsxtOrgVdcNetworkSegmentProfileTemplate(), // 3.11
"vcd_nsxt_edgegateway_dns": resourceVcdNsxtEdgeGatewayDns(), // 3.11
}

// Provider returns a terraform.ResourceProvider.
Expand Down
Loading