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: azurerm_api_management_backend #3676

Merged
merged 17 commits into from
Jul 6, 2019
11 changes: 11 additions & 0 deletions azurerm/helpers/validate/api_management.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,14 @@ func ApiManagementApiPath(v interface{}, k string) (ws []string, es []error) {
}
return ws, es
}

func ApiManagementBackendName(v interface{}, k string) (warnings []string, errors []error) {
value := v.(string)

// From https://docs.microsoft.com/en-us/rest/api/apimanagement/2018-01-01/backend/createorupdate#uri-parameters
if matched := regexp.MustCompile(`(^[\w]+$)|(^[\w][\w\-]+[\w]$)`).Match([]byte(value)); !matched {
errors = append(errors, fmt.Errorf("%q may only contain alphanumeric characters and dashes up to 50 characters in length", k))
}

return warnings, errors
}
4 changes: 4 additions & 0 deletions azurerm/internal/services/apimanagement/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type Client struct {
ApiSchemasClient apimanagement.APISchemaClient
ApiVersionSetClient apimanagement.APIVersionSetClient
AuthorizationServersClient apimanagement.AuthorizationServerClient
BackendClient apimanagement.BackendClient
CertificatesClient apimanagement.CertificateClient
GroupClient apimanagement.GroupClient
GroupUsersClient apimanagement.GroupUserClient
Expand Down Expand Up @@ -55,6 +56,9 @@ func BuildClient(o *common.ClientOptions) *Client {
c.AuthorizationServersClient = apimanagement.NewAuthorizationServerClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId)
o.ConfigureClient(&c.AuthorizationServersClient.Client, o.ResourceManagerAuthorizer)

c.BackendClient = apimanagement.NewBackendClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId)
o.ConfigureClient(&c.BackendClient.Client, o.ResourceManagerAuthorizer)

c.CertificatesClient = apimanagement.NewCertificateClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId)
o.ConfigureClient(&c.CertificatesClient.Client, o.ResourceManagerAuthorizer)

Expand Down
1 change: 1 addition & 0 deletions azurerm/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ func Provider() terraform.ResourceProvider {
"azurerm_api_management_api_schema": resourceArmApiManagementApiSchema(),
"azurerm_api_management_api_version_set": resourceArmApiManagementApiVersionSet(),
"azurerm_api_management_authorization_server": resourceArmApiManagementAuthorizationServer(),
"azurerm_api_management_backend": resourceArmApiManagementBackend(),
"azurerm_api_management_certificate": resourceArmApiManagementCertificate(),
"azurerm_api_management_group": resourceArmApiManagementGroup(),
"azurerm_api_management_group_user": resourceArmApiManagementGroupUser(),
Expand Down
Loading