Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
Aris van Ommeren committed Apr 10, 2020
1 parent 950fbaf commit 06c4b4d
Show file tree
Hide file tree
Showing 6 changed files with 1,093 additions and 0 deletions.
40 changes: 40 additions & 0 deletions azurerm/internal/services/web/function_app_slot.go
@@ -0,0 +1,40 @@
package web

import (
"fmt"

"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
)

type FunctionAppSlotResourceID struct {
ResourceGroup string
FunctionAppName string
Name string
}

func ParseFunctionAppSlotID(input string) (*FunctionAppSlotResourceID, error) {
id, err := azure.ParseAzureResourceID(input)
if err != nil {
return nil, fmt.Errorf("[ERROR] Unable to parse App Service Slot ID %q: %+v", input, err)
}

slot := FunctionAppSlotResourceID{
ResourceGroup: id.ResourceGroup,
FunctionAppName: id.Path["sites"],
Name: id.Path["slots"],
}

if slot.FunctionAppName, err = id.PopSegment("sites"); err != nil {
return nil, err
}

if slot.Name, err = id.PopSegment("slots"); err != nil {
return nil, err
}

if err := id.ValidateNoEmptySegments(input); err != nil {
return nil, err
}

return &slot, nil
}
1 change: 1 addition & 0 deletions azurerm/internal/services/web/registration.go
Expand Up @@ -44,5 +44,6 @@ func (r Registration) SupportedResources() map[string]*schema.Resource {
"azurerm_app_service_virtual_network_swift_connection": resourceArmAppServiceVirtualNetworkSwiftConnection(),
"azurerm_app_service": resourceArmAppService(),
"azurerm_function_app": resourceArmFunctionApp(),
"azurerm_function_app_slot": resourceArmFunctionAppSlot(),
}
}

0 comments on commit 06c4b4d

Please sign in to comment.