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

api_management_x.y.api_name - validation fix #8409

Merged
merged 1 commit into from
Sep 9, 2020
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
11 changes: 11 additions & 0 deletions azurerm/helpers/azure/api_management.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,17 @@ func SchemaApiManagementChildName() *schema.Schema {
}
}

// SchemaApiManagementChildName returns the Schema for the identifier
// used by resources within nested under the API Management Service resource
func SchemaApiManagementApiName() *schema.Schema {
return &schema.Schema{
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validate.ApiManagementApiName,
}
}

// SchemaApiManagementChildDataSourceName returns the Schema for the identifier
// used by resources within nested under the API Management Service resource
func SchemaApiManagementChildDataSourceName() *schema.Schema {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf"
helpersvalidate "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/validate"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/clients"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/apimanagement/parse"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/apimanagement/validate"
Expand Down Expand Up @@ -53,12 +52,7 @@ func resourceArmApiManagementApiDiagnostic() *schema.Resource {

"api_management_name": azure.SchemaApiManagementName(),

"api_name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: helpersvalidate.ApiManagementApiName,
},
"api_name": azure.SchemaApiManagementApiName(),

"api_management_logger_id": {
Type: schema.TypeString,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func resourceArmApiManagementApiOperationPolicy() *schema.Resource {

"api_management_name": azure.SchemaApiManagementName(),

"api_name": azure.SchemaApiManagementChildName(),
"api_name": azure.SchemaApiManagementApiName(),

"operation_id": azure.SchemaApiManagementChildName(),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func resourceArmApiManagementApiOperation() *schema.Resource {
Schema: map[string]*schema.Schema{
"operation_id": azure.SchemaApiManagementChildName(),

"api_name": azure.SchemaApiManagementChildName(),
"api_name": azure.SchemaApiManagementApiName(),

"api_management_name": azure.SchemaApiManagementName(),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func resourceArmApiManagementApiPolicy() *schema.Resource {

"api_management_name": azure.SchemaApiManagementName(),

"api_name": azure.SchemaApiManagementChildName(),
"api_name": azure.SchemaApiManagementApiName(),

"xml_content": {
Type: schema.TypeString,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,7 @@ func resourceArmApiManagementApi() *schema.Resource {
},

Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validate.ApiManagementApiName,
},
"name": azure.SchemaApiManagementApiName(),

"api_management_name": azure.SchemaApiManagementName(),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func resourceArmApiManagementApiSchema() *schema.Resource {
Schema: map[string]*schema.Schema{
"schema_id": azure.SchemaApiManagementChildName(),

"api_name": azure.SchemaApiManagementChildName(),
"api_name": azure.SchemaApiManagementApiName(),

"resource_group_name": azure.SchemaResourceGroupName(),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func resourceArmApiManagementProductApi() *schema.Resource {
},

Schema: map[string]*schema.Schema{
"api_name": azure.SchemaApiManagementChildName(),
"api_name": azure.SchemaApiManagementApiName(),

"product_id": azure.SchemaApiManagementChildName(),

Expand Down