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

Documentation Fix #3947

Merged
merged 1 commit into from
Aug 17, 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
50 changes: 35 additions & 15 deletions ibm/service/vpc/resource_ibm_is_vpn_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func ResourceIBMIsVPNServer() *schema.Resource {
Type: schema.TypeList,
Required: true,
ForceNew: false,
MaxItems: 1,
MaxItems: 2,
Description: "The methods used to authenticate VPN clients to this VPN server. VPN clients must authenticate against all provided methods.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
Expand Down Expand Up @@ -384,15 +384,25 @@ func resourceIBMIsVPNServerCreate(context context.Context, d *schema.ResourceDat
clientAuthPrototype.Method = &method

if method == "certificate" {
crn_val := clientAuth["client_ca_crn"].(string)
certificateInstanceIdentity := &vpcv1.CertificateInstanceIdentity{}
certificateInstanceIdentity.CRN = &crn_val
clientAuthPrototype.ClientCa = certificateInstanceIdentity
if clientAuth["client_ca_crn"] != nil {
crn_val := clientAuth["client_ca_crn"].(string)
certificateInstanceIdentity := &vpcv1.CertificateInstanceIdentity{}
certificateInstanceIdentity.CRN = &crn_val
clientAuthPrototype.ClientCa = certificateInstanceIdentity

} else {
return diag.FromErr(fmt.Errorf("[ERROR] Error method type `certificate` should be passed with `client_ca_crn`"))
}
} else {
providerType := clientAuth["identity_provider"].(string)
clientAuthPrototype.IdentityProvider = &vpcv1.VPNServerAuthenticationByUsernameIDProvider{
ProviderType: &providerType,
if clientAuth["identity_provider"] != nil {
providerType := clientAuth["identity_provider"].(string)
clientAuthPrototype.IdentityProvider = &vpcv1.VPNServerAuthenticationByUsernameIDProvider{
ProviderType: &providerType,
}
} else {
return diag.FromErr(fmt.Errorf("[ERROR] Error method type `username` should be passed with `identity_provider`"))
}

}
clientAuthentication = append(clientAuthentication, clientAuthPrototype)
}
Expand Down Expand Up @@ -744,15 +754,25 @@ func resourceIBMIsVPNServerUpdate(context context.Context, d *schema.ResourceDat
clientAuthPrototype.Method = &method

if method == "certificate" {
crn_val := clientAuth["client_ca_crn"].(string)
certificateInstanceIdentity := &vpcv1.CertificateInstanceIdentity{}
certificateInstanceIdentity.CRN = &crn_val
clientAuthPrototype.ClientCa = certificateInstanceIdentity
if clientAuth["client_ca_crn"] != nil && clientAuth["client_ca_crn"] != "" {
crn_val := clientAuth["client_ca_crn"].(string)
certificateInstanceIdentity := &vpcv1.CertificateInstanceIdentity{}
certificateInstanceIdentity.CRN = &crn_val
clientAuthPrototype.ClientCa = certificateInstanceIdentity

} else {
return diag.FromErr(fmt.Errorf("[ERROR] Error method type `certificate` should be passed with `client_ca_crn`"))
}
} else {
providerType := clientAuth["identity_provider"].(string)
clientAuthPrototype.IdentityProvider = &vpcv1.VPNServerAuthenticationByUsernameIDProvider{
ProviderType: &providerType,
if clientAuth["identity_provider"] != nil && clientAuth["identity_provider"] != "" {
providerType := clientAuth["identity_provider"].(string)
clientAuthPrototype.IdentityProvider = &vpcv1.VPNServerAuthenticationByUsernameIDProvider{
ProviderType: &providerType,
}
} else {
return diag.FromErr(fmt.Errorf("[ERROR] Error method type `username` should be passed with `identity_provider`"))
}

}
clientAuthentication = append(clientAuthentication, clientAuthPrototype)
}
Expand Down
6 changes: 3 additions & 3 deletions website/docs/r/is_vpn_server.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ Review the argument references that you can specify for your resource.
- Constraints: Allowable values are: certificate, username

-> **NOTE:**
`identity_provider` and `client_ca_crn` are mutually exclusive, which means either one must be provided.
`identity_provider` and `client_ca_crn` are mutually exclusive, which means either one must be provided. When `method` has `certificate` as value `client_ca_crn` must be provided and when `method` has `username` as value `identity_provider` must be provided.

- `identity_provider` - (Optional, String) The type of identity provider to be used by VPN client.The type of identity provider to be used by the VPN client.- `iam`: IBM identity and access managementThe enumerated values for this property are expected to expand in the future. When processing this property, check for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the unexpected property value was encountered.
- `identity_provider` - (Required, String) The type of identity provider to be used by VPN client.The type of identity provider to be used by the VPN client.- `iam`: IBM identity and access managementThe enumerated values for this property are expected to expand in the future. When processing this property, check for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the unexpected property value was encountered.
- Constraints: Allowable values are: iam
- `client_ca_crn` - (Optional, String) The CRN of the certificate instance or CRN of the secret from secrets manager to use for the VPN client certificate authority (CA). As the usage of certificate CRN from Certificate Manager is getting deprecated, It is recommended to use Secret manger for same.
- `client_ca_crn` - (Required, String) The CRN of the certificate instance or CRN of the secret from secrets manager to use for the VPN client certificate authority (CA). As the usage of certificate CRN from Certificate Manager is getting deprecated, It is recommended to use Secret manger for same.
- `crl` - (Optional, String) The certificate revocation list contents, encoded in PEM format.
- Constraints: The maximum length is `2` items. The minimum length is `1` item.

Expand Down