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 support for multiple auth types for azurerm_vpn_server_configuration #12085

Merged
merged 1 commit into from
Jun 10, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,6 @@ func resourceVPNServerConfiguration() *pluginsdk.Resource {
string(network.VpnAuthenticationTypeRadius),
}, false),
},

// StatusCode=400 -- Original Error: Code="MultipleVpnAuthenticationTypesNotSupprtedOnVpnServerConfiguration"
// Message="VpnServerConfiguration XXX/acctestrg-191125124621329676 supports single VpnAuthenticationType at a time.
// Customer has specified 3 number of VpnAuthenticationTypes."
MaxItems: 1,
},

// Optional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,21 @@ func TestAccVPNServerConfiguration_tags(t *testing.T) {
})
}

func TestAccVPNServerConfiguration_multipleAuthTypes(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_vpn_server_configuration", "test")
r := VPNServerConfigurationResource{}

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.multipleAuthTypes(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
data.ImportStep(),
})
}

func (t VPNServerConfigurationResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) {
id, err := parse.VpnServerConfigurationID(state.ID)
if err != nil {
Expand Down Expand Up @@ -520,6 +535,53 @@ EOF
`, r.template(data), data.RandomInteger)
}

func (r VPNServerConfigurationResource) multipleAuthTypes(data acceptance.TestData) string {
return fmt.Sprintf(`
%s

data "azurerm_subscription" "current" {}

resource "azurerm_vpn_server_configuration" "test" {
name = "acctestVPNSC-%d"
resource_group_name = azurerm_resource_group.test.name
location = azurerm_resource_group.test.location
vpn_authentication_types = ["AAD", "Certificate"]

azure_active_directory_authentication {
audience = "00000000-abcd-abcd-abcd-999999999999"
issuer = "https://sts.windows.net/${data.azurerm_subscription.current.tenant_id}/"
tenant = "https://login.microsoftonline.com/${data.azurerm_subscription.current.tenant_id}"
}

client_root_certificate {
name = "DigiCert-Federated-ID-Root-CA"
public_cert_data = <<EOF
MIIDuzCCAqOgAwIBAgIQCHTZWCM+IlfFIRXIvyKSrjANBgkqhkiG9w0BAQsFADBn
MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
d3cuZGlnaWNlcnQuY29tMSYwJAYDVQQDEx1EaWdpQ2VydCBGZWRlcmF0ZWQgSUQg
Um9vdCBDQTAeFw0xMzAxMTUxMjAwMDBaFw0zMzAxMTUxMjAwMDBaMGcxCzAJBgNV
BAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdp
Y2VydC5jb20xJjAkBgNVBAMTHURpZ2lDZXJ0IEZlZGVyYXRlZCBJRCBSb290IENB
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvAEB4pcCqnNNOWE6Ur5j
QPUH+1y1F9KdHTRSza6k5iDlXq1kGS1qAkuKtw9JsiNRrjltmFnzMZRBbX8Tlfl8
zAhBmb6dDduDGED01kBsTkgywYPxXVTKec0WxYEEF0oMn4wSYNl0lt2eJAKHXjNf
GTwiibdP8CUR2ghSM2sUTI8Nt1Omfc4SMHhGhYD64uJMbX98THQ/4LMGuYegou+d
GTiahfHtjn7AboSEknwAMJHCh5RlYZZ6B1O4QbKJ+34Q0eKgnI3X6Vc9u0zf6DH8
Dk+4zQDYRRTqTnVO3VT8jzqDlCRuNtq6YvryOWN74/dq8LQhUnXHvFyrsdMaE1X2
DwIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNV
HQ4EFgQUGRdkFnbGt1EWjKwbUne+5OaZvRYwHwYDVR0jBBgwFoAUGRdkFnbGt1EW
jKwbUne+5OaZvRYwDQYJKoZIhvcNAQELBQADggEBAHcqsHkrjpESqfuVTRiptJfP
9JbdtWqRTmOf6uJi2c8YVqI6XlKXsD8C1dUUaaHKLUJzvKiazibVuBwMIT84AyqR
QELn3e0BtgEymEygMU569b01ZPxoFSnNXc7qDZBDef8WfqAV/sxkTi8L9BkmFYfL
uGLOhRJOFprPdoDIUBB+tmCl3oDcBy3vnUeOEioz8zAkprcb3GHwHAK+vHmmfgcn
WsfMLH4JCLa/tRYL+Rw/N3ybCkDp00s0WUZ+AoDywSl0Q/ZEnNY0MsFiw6LyIdbq
M/s/1JRtO3bDSzD9TazRVzn2oBqzSa8VgIo5C1nOnoAKJTlsClJKvIhnRlaLQqk=
EOF
}
}
`, r.template(data), data.RandomInteger)
}

func (VPNServerConfigurationResource) template(data acceptance.TestData) string {
return fmt.Sprintf(`
provider "azurerm" {
Expand Down
4 changes: 1 addition & 3 deletions website/docs/r/vpn_server_configuration.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ The following arguments are supported:

* `location` - (Required) The Azure location where this VPN Server Configuration should be created. Changing this forces a new resource to be created.

* `vpn_authentication_types` - (Required) A list of one of more Authentication Types applicable for this VPN Server Configuration. Possible values are `AAD` (Azure Active Directory), `Certificate` and `Radius`.

-> **NOTE:** At this time a maximum of one VPN Authentication Types can be specified.
* `vpn_authentication_types` - (Required) A list of Authentication Types applicable for this VPN Server Configuration. Possible values are `AAD` (Azure Active Directory), `Certificate` and `Radius`.

---

Expand Down