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

aws_ec2_client_vpn_endpoint dns_servers input does not preserve order #20690

Closed
wenslayer opened this issue Aug 25, 2021 · 2 comments · Fixed by #22889
Closed

aws_ec2_client_vpn_endpoint dns_servers input does not preserve order #20690

wenslayer opened this issue Aug 25, 2021 · 2 comments · Fixed by #22889
Assignees
Labels
bug Addresses a defect in current functionality. service/ec2 Issues and PRs that pertain to the ec2 service.
Milestone

Comments

@wenslayer
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform AWS Provider Version

$ terraform -v
Terraform v1.0.5
on darwin_amd64
+ provider registry.terraform.io/hashicorp/aws v3.55.0

Affected Resource(s)

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

terraform {
  required_version = "~> 1.0"

  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 3.55"
    }
  }
}

provider "aws" {
  region = "us-west-2"
}

resource "aws_ec2_client_vpn_endpoint" "vpn" {
  description = "Test Client VPN Endpoint"

  client_cidr_block      = "172.16.0.0/22"
  server_certificate_arn = "arn:aws:acm:us-west-2:REDACTED:certificate/REDACTED"
  split_tunnel           = true
  transport_protocol     = "udp"

  # Using sample DNS servers for this example, but note the order desired:
  dns_servers = [
    "8.8.8.8",
    "1.1.1.1",
  ]

  authentication_options {
    type                       = "federated-authentication"
    root_certificate_chain_arn = "arn:aws:acm:us-west-2:REDACTED:certificate/REDACTED"
    saml_provider_arn          = "arn:aws:iam::REDACTED:saml-provider/REDACTED"
  }

  connection_log_options {
    enabled               = false
  }
}

Debug Output

TBD

Expected Behavior

Because DNS server order is important (e.g.: we're trying to add an internal and an external DNS server in that order), one should expect the dns_servers input should preserve the order of the elements given (see example above).

Actual Behavior

The dns_servers input appear to be sorted:

$ terraform init && terraform apply
...
Terraform will perform the following actions:

  # aws_ec2_client_vpn_endpoint.vpn will be created
  + resource "aws_ec2_client_vpn_endpoint" "vpn" {
      ...
      + dns_servers            = [
          + "1.1.1.1",
          + "8.8.8.8",
        ]
      ...
    }

Plan: 1 to add, 0 to change, 0 to destroy.
...

$ aws ec2 describe-client-vpn-endpoints --client-vpn-endpoint-ids cvpn-endpoint-REDACTED --query "ClientVpnEndpoints[*].DnsServers[*]"
[
    [
        "1.1.1.1",
        "8.8.8.8"
    ]
]

Steps to Reproduce

  1. terraform init && terraform apply

Workaround

  1. Manually edit the entries in the AWS Console.

Important Factoids

N/A

References

Source code treats dns_servers input as a set (Type: schema.TypeSet) -- perhaps it should be TypeList instead?

			"dns_servers": {
				Type:     schema.TypeSet,
				Optional: true,
				Elem:     &schema.Schema{Type: schema.TypeString},
			},
@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. service/ec2 Issues and PRs that pertain to the ec2 service. labels Aug 25, 2021
@ewbankkit ewbankkit added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Aug 26, 2021
@ewbankkit ewbankkit added this to the v4.0.0 milestone Jan 30, 2022
@ewbankkit ewbankkit self-assigned this Jan 30, 2022
@github-actions
Copy link

This functionality has been released in v4.0.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/ec2 Issues and PRs that pertain to the ec2 service.
Projects
None yet
2 participants