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

r/aws_ec2_client_vpn_endpoint: Change dns_servers argument from TypeSet to TypeList #22889

Merged
merged 2 commits into from
Feb 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions .changelog/22889.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:note
resource/aws_ec2_client_vpn_endpoint: The type of the `dns_servers` argument has changed from Set to List
```
12 changes: 6 additions & 6 deletions internal/service/ec2/client_vpn_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func ResourceClientVPNEndpoint() *schema.Resource {
Computed: true,
},
"dns_servers": {
Type: schema.TypeSet,
Type: schema.TypeList,
Optional: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
Expand Down Expand Up @@ -237,8 +237,8 @@ func resourceClientVPNEndpointCreate(d *schema.ResourceData, meta interface{}) e
input.Description = aws.String(v.(string))
}

if v, ok := d.GetOk("dns_servers"); ok {
input.DnsServers = flex.ExpandStringSet(v.(*schema.Set))
if v, ok := d.GetOk("dns_servers"); ok && len(v.([]interface{})) > 0 {
input.DnsServers = flex.ExpandStringList(v.([]interface{}))
}

if v, ok := d.GetOk("self_service_portal"); ok {
Expand Down Expand Up @@ -374,14 +374,14 @@ func resourceClientVPNEndpointUpdate(d *schema.ResourceData, meta interface{}) e
}

if d.HasChange("dns_servers") {
dnsServers := d.Get("dns_servers").(*schema.Set)
enabled := dnsServers.Len() > 0
dnsServers := d.Get("dns_servers").([]interface{})
enabled := len(dnsServers) > 0

input.DnsServers = &ec2.DnsServersOptionsModifyStructure{
Enabled: aws.Bool(enabled),
}
if enabled {
input.DnsServers.CustomDnsServers = flex.ExpandStringSet(dnsServers)
input.DnsServers.CustomDnsServers = flex.ExpandStringList(dnsServers)
}
}

Expand Down
6 changes: 3 additions & 3 deletions internal/service/ec2/client_vpn_endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -505,8 +505,8 @@ func testAccClientVPNEndpoint_withDNSServers(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
testAccCheckClientVPNEndpointExists(resourceName, &v),
resource.TestCheckResourceAttr(resourceName, "dns_servers.#", "2"),
resource.TestCheckTypeSetElemAttr(resourceName, "dns_servers.*", "8.8.8.8"),
resource.TestCheckTypeSetElemAttr(resourceName, "dns_servers.*", "8.8.4.4"),
resource.TestCheckResourceAttr(resourceName, "dns_servers.0", "8.8.8.8"),
resource.TestCheckResourceAttr(resourceName, "dns_servers.1", "8.8.4.4"),
),
},
{
Expand All @@ -519,7 +519,7 @@ func testAccClientVPNEndpoint_withDNSServers(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
testAccCheckClientVPNEndpointExists(resourceName, &v),
resource.TestCheckResourceAttr(resourceName, "dns_servers.#", "1"),
resource.TestCheckTypeSetElemAttr(resourceName, "dns_servers.*", "4.4.4.4"),
resource.TestCheckResourceAttr(resourceName, "dns_servers.0", "4.4.4.4"),
),
},
{
Expand Down