All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.azure.appservice.kotlin.FunctionApp.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 6.15.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.appservice.kotlin

import com.pulumi.azure.appservice.kotlin.outputs.FunctionAppAuthSettings
import com.pulumi.azure.appservice.kotlin.outputs.FunctionAppConnectionString
import com.pulumi.azure.appservice.kotlin.outputs.FunctionAppIdentity
import com.pulumi.azure.appservice.kotlin.outputs.FunctionAppSiteConfig
import com.pulumi.azure.appservice.kotlin.outputs.FunctionAppSiteCredential
import com.pulumi.azure.appservice.kotlin.outputs.FunctionAppSourceControl
import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import com.pulumi.azure.appservice.kotlin.outputs.FunctionAppAuthSettings.Companion.toKotlin as functionAppAuthSettingsToKotlin
import com.pulumi.azure.appservice.kotlin.outputs.FunctionAppConnectionString.Companion.toKotlin as functionAppConnectionStringToKotlin
import com.pulumi.azure.appservice.kotlin.outputs.FunctionAppIdentity.Companion.toKotlin as functionAppIdentityToKotlin
import com.pulumi.azure.appservice.kotlin.outputs.FunctionAppSiteConfig.Companion.toKotlin as functionAppSiteConfigToKotlin
import com.pulumi.azure.appservice.kotlin.outputs.FunctionAppSiteCredential.Companion.toKotlin as functionAppSiteCredentialToKotlin
import com.pulumi.azure.appservice.kotlin.outputs.FunctionAppSourceControl.Companion.toKotlin as functionAppSourceControlToKotlin

/**
 * Builder for [FunctionApp].
 */
@PulumiTagMarker
public class FunctionAppResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: FunctionAppArgs = FunctionAppArgs()

    public var opts: CustomResourceOptions = CustomResourceOptions()

    /**
     * @param name The _unique_ name of the resulting resource.
     */
    public fun name(`value`: String) {
        this.name = value
    }

    /**
     * @param block The arguments to use to populate this resource's properties.
     */
    public suspend fun args(block: suspend FunctionAppArgsBuilder.() -> Unit) {
        val builder = FunctionAppArgsBuilder()
        block(builder)
        this.args = builder.build()
    }

    /**
     * @param block A bag of options that control this resource's behavior.
     */
    public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
        this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
    }

    internal fun build(): FunctionApp {
        val builtJavaResource = com.pulumi.azure.appservice.FunctionApp(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return FunctionApp(builtJavaResource)
    }
}

/**
 * Manages a Function App.
 * !> **NOTE:** This resource has been deprecated in version 5.0 of the provider and will be removed in version 6.0. Please use `azure.appservice.LinuxFunctionApp` resources instead.
 * > **Note:** To connect an Azure Function App and a subnet within the same region `azure.appservice.VirtualNetworkSwiftConnection` can be used.
 * For an example, check the `azure.appservice.VirtualNetworkSwiftConnection` documentation.
 * ## Example Usage
 * ### With App Service Plan)
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "azure-functions-test-rg",
 *     location: "West Europe",
 * });
 * const exampleAccount = new azure.storage.Account("example", {
 *     name: "functionsapptestsa",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     accountTier: "Standard",
 *     accountReplicationType: "LRS",
 * });
 * const examplePlan = new azure.appservice.Plan("example", {
 *     name: "azure-functions-test-service-plan",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     sku: {
 *         tier: "Standard",
 *         size: "S1",
 *     },
 * });
 * const exampleFunctionApp = new azure.appservice.FunctionApp("example", {
 *     name: "test-azure-functions",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     appServicePlanId: examplePlan.id,
 *     storageAccountName: exampleAccount.name,
 *     storageAccountAccessKey: exampleAccount.primaryAccessKey,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="azure-functions-test-rg",
 *     location="West Europe")
 * example_account = azure.storage.Account("example",
 *     name="functionsapptestsa",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     account_tier="Standard",
 *     account_replication_type="LRS")
 * example_plan = azure.appservice.Plan("example",
 *     name="azure-functions-test-service-plan",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     sku={
 *         "tier": "Standard",
 *         "size": "S1",
 *     })
 * example_function_app = azure.appservice.FunctionApp("example",
 *     name="test-azure-functions",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     app_service_plan_id=example_plan.id,
 *     storage_account_name=example_account.name,
 *     storage_account_access_key=example_account.primary_access_key)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "azure-functions-test-rg",
 *         Location = "West Europe",
 *     });
 *     var exampleAccount = new Azure.Storage.Account("example", new()
 *     {
 *         Name = "functionsapptestsa",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         AccountTier = "Standard",
 *         AccountReplicationType = "LRS",
 *     });
 *     var examplePlan = new Azure.AppService.Plan("example", new()
 *     {
 *         Name = "azure-functions-test-service-plan",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         Sku = new Azure.AppService.Inputs.PlanSkuArgs
 *         {
 *             Tier = "Standard",
 *             Size = "S1",
 *         },
 *     });
 *     var exampleFunctionApp = new Azure.AppService.FunctionApp("example", new()
 *     {
 *         Name = "test-azure-functions",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         AppServicePlanId = examplePlan.Id,
 *         StorageAccountName = exampleAccount.Name,
 *         StorageAccountAccessKey = exampleAccount.PrimaryAccessKey,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/appservice"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/storage"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("azure-functions-test-rg"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleAccount, err := storage.NewAccount(ctx, "example", &storage.AccountArgs{
 * 			Name:                   pulumi.String("functionsapptestsa"),
 * 			ResourceGroupName:      example.Name,
 * 			Location:               example.Location,
 * 			AccountTier:            pulumi.String("Standard"),
 * 			AccountReplicationType: pulumi.String("LRS"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		examplePlan, err := appservice.NewPlan(ctx, "example", &appservice.PlanArgs{
 * 			Name:              pulumi.String("azure-functions-test-service-plan"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			Sku: &appservice.PlanSkuArgs{
 * 				Tier: pulumi.String("Standard"),
 * 				Size: pulumi.String("S1"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = appservice.NewFunctionApp(ctx, "example", &appservice.FunctionAppArgs{
 * 			Name:                    pulumi.String("test-azure-functions"),
 * 			Location:                example.Location,
 * 			ResourceGroupName:       example.Name,
 * 			AppServicePlanId:        examplePlan.ID(),
 * 			StorageAccountName:      exampleAccount.Name,
 * 			StorageAccountAccessKey: exampleAccount.PrimaryAccessKey,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.azure.core.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.storage.Account;
 * import com.pulumi.azure.storage.AccountArgs;
 * import com.pulumi.azure.appservice.Plan;
 * import com.pulumi.azure.appservice.PlanArgs;
 * import com.pulumi.azure.appservice.inputs.PlanSkuArgs;
 * import com.pulumi.azure.appservice.FunctionApp;
 * import com.pulumi.azure.appservice.FunctionAppArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 *     public static void stack(Context ctx) {
 *         var example = new ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("azure-functions-test-rg")
 *             .location("West Europe")
 *             .build());
 *         var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
 *             .name("functionsapptestsa")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .accountTier("Standard")
 *             .accountReplicationType("LRS")
 *             .build());
 *         var examplePlan = new Plan("examplePlan", PlanArgs.builder()
 *             .name("azure-functions-test-service-plan")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .sku(PlanSkuArgs.builder()
 *                 .tier("Standard")
 *                 .size("S1")
 *                 .build())
 *             .build());
 *         var exampleFunctionApp = new FunctionApp("exampleFunctionApp", FunctionAppArgs.builder()
 *             .name("test-azure-functions")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .appServicePlanId(examplePlan.id())
 *             .storageAccountName(exampleAccount.name())
 *             .storageAccountAccessKey(exampleAccount.primaryAccessKey())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: azure-functions-test-rg
 *       location: West Europe
 *   exampleAccount:
 *     type: azure:storage:Account
 *     name: example
 *     properties:
 *       name: functionsapptestsa
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       accountTier: Standard
 *       accountReplicationType: LRS
 *   examplePlan:
 *     type: azure:appservice:Plan
 *     name: example
 *     properties:
 *       name: azure-functions-test-service-plan
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       sku:
 *         tier: Standard
 *         size: S1
 *   exampleFunctionApp:
 *     type: azure:appservice:FunctionApp
 *     name: example
 *     properties:
 *       name: test-azure-functions
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       appServicePlanId: ${examplePlan.id}
 *       storageAccountName: ${exampleAccount.name}
 *       storageAccountAccessKey: ${exampleAccount.primaryAccessKey}
 * ```
 * 
 * ### In A Consumption Plan)
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "azure-functions-cptest-rg",
 *     location: "West Europe",
 * });
 * const exampleAccount = new azure.storage.Account("example", {
 *     name: "functionsapptestsa",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     accountTier: "Standard",
 *     accountReplicationType: "LRS",
 * });
 * const examplePlan = new azure.appservice.Plan("example", {
 *     name: "azure-functions-test-service-plan",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     kind: "FunctionApp",
 *     sku: {
 *         tier: "Dynamic",
 *         size: "Y1",
 *     },
 * });
 * const exampleFunctionApp = new azure.appservice.FunctionApp("example", {
 *     name: "test-azure-functions",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     appServicePlanId: examplePlan.id,
 *     storageAccountName: exampleAccount.name,
 *     storageAccountAccessKey: exampleAccount.primaryAccessKey,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="azure-functions-cptest-rg",
 *     location="West Europe")
 * example_account = azure.storage.Account("example",
 *     name="functionsapptestsa",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     account_tier="Standard",
 *     account_replication_type="LRS")
 * example_plan = azure.appservice.Plan("example",
 *     name="azure-functions-test-service-plan",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     kind="FunctionApp",
 *     sku={
 *         "tier": "Dynamic",
 *         "size": "Y1",
 *     })
 * example_function_app = azure.appservice.FunctionApp("example",
 *     name="test-azure-functions",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     app_service_plan_id=example_plan.id,
 *     storage_account_name=example_account.name,
 *     storage_account_access_key=example_account.primary_access_key)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "azure-functions-cptest-rg",
 *         Location = "West Europe",
 *     });
 *     var exampleAccount = new Azure.Storage.Account("example", new()
 *     {
 *         Name = "functionsapptestsa",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         AccountTier = "Standard",
 *         AccountReplicationType = "LRS",
 *     });
 *     var examplePlan = new Azure.AppService.Plan("example", new()
 *     {
 *         Name = "azure-functions-test-service-plan",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         Kind = "FunctionApp",
 *         Sku = new Azure.AppService.Inputs.PlanSkuArgs
 *         {
 *             Tier = "Dynamic",
 *             Size = "Y1",
 *         },
 *     });
 *     var exampleFunctionApp = new Azure.AppService.FunctionApp("example", new()
 *     {
 *         Name = "test-azure-functions",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         AppServicePlanId = examplePlan.Id,
 *         StorageAccountName = exampleAccount.Name,
 *         StorageAccountAccessKey = exampleAccount.PrimaryAccessKey,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/appservice"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/storage"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("azure-functions-cptest-rg"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleAccount, err := storage.NewAccount(ctx, "example", &storage.AccountArgs{
 * 			Name:                   pulumi.String("functionsapptestsa"),
 * 			ResourceGroupName:      example.Name,
 * 			Location:               example.Location,
 * 			AccountTier:            pulumi.String("Standard"),
 * 			AccountReplicationType: pulumi.String("LRS"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		examplePlan, err := appservice.NewPlan(ctx, "example", &appservice.PlanArgs{
 * 			Name:              pulumi.String("azure-functions-test-service-plan"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			Kind:              pulumi.Any("FunctionApp"),
 * 			Sku: &appservice.PlanSkuArgs{
 * 				Tier: pulumi.String("Dynamic"),
 * 				Size: pulumi.String("Y1"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = appservice.NewFunctionApp(ctx, "example", &appservice.FunctionAppArgs{
 * 			Name:                    pulumi.String("test-azure-functions"),
 * 			Location:                example.Location,
 * 			ResourceGroupName:       example.Name,
 * 			AppServicePlanId:        examplePlan.ID(),
 * 			StorageAccountName:      exampleAccount.Name,
 * 			StorageAccountAccessKey: exampleAccount.PrimaryAccessKey,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.azure.core.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.storage.Account;
 * import com.pulumi.azure.storage.AccountArgs;
 * import com.pulumi.azure.appservice.Plan;
 * import com.pulumi.azure.appservice.PlanArgs;
 * import com.pulumi.azure.appservice.inputs.PlanSkuArgs;
 * import com.pulumi.azure.appservice.FunctionApp;
 * import com.pulumi.azure.appservice.FunctionAppArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 *     public static void stack(Context ctx) {
 *         var example = new ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("azure-functions-cptest-rg")
 *             .location("West Europe")
 *             .build());
 *         var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
 *             .name("functionsapptestsa")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .accountTier("Standard")
 *             .accountReplicationType("LRS")
 *             .build());
 *         var examplePlan = new Plan("examplePlan", PlanArgs.builder()
 *             .name("azure-functions-test-service-plan")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .kind("FunctionApp")
 *             .sku(PlanSkuArgs.builder()
 *                 .tier("Dynamic")
 *                 .size("Y1")
 *                 .build())
 *             .build());
 *         var exampleFunctionApp = new FunctionApp("exampleFunctionApp", FunctionAppArgs.builder()
 *             .name("test-azure-functions")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .appServicePlanId(examplePlan.id())
 *             .storageAccountName(exampleAccount.name())
 *             .storageAccountAccessKey(exampleAccount.primaryAccessKey())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: azure-functions-cptest-rg
 *       location: West Europe
 *   exampleAccount:
 *     type: azure:storage:Account
 *     name: example
 *     properties:
 *       name: functionsapptestsa
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       accountTier: Standard
 *       accountReplicationType: LRS
 *   examplePlan:
 *     type: azure:appservice:Plan
 *     name: example
 *     properties:
 *       name: azure-functions-test-service-plan
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       kind: FunctionApp
 *       sku:
 *         tier: Dynamic
 *         size: Y1
 *   exampleFunctionApp:
 *     type: azure:appservice:FunctionApp
 *     name: example
 *     properties:
 *       name: test-azure-functions
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       appServicePlanId: ${examplePlan.id}
 *       storageAccountName: ${exampleAccount.name}
 *       storageAccountAccessKey: ${exampleAccount.primaryAccessKey}
 * ```
 * 
 * ### Linux)
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "azure-functions-cptest-rg",
 *     location: "West Europe",
 * });
 * const exampleAccount = new azure.storage.Account("example", {
 *     name: "functionsapptestsa",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     accountTier: "Standard",
 *     accountReplicationType: "LRS",
 * });
 * const examplePlan = new azure.appservice.Plan("example", {
 *     name: "azure-functions-test-service-plan",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     kind: "Linux",
 *     reserved: true,
 *     sku: {
 *         tier: "Dynamic",
 *         size: "Y1",
 *     },
 * });
 * const exampleFunctionApp = new azure.appservice.FunctionApp("example", {
 *     name: "test-azure-functions",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     appServicePlanId: examplePlan.id,
 *     storageAccountName: exampleAccount.name,
 *     storageAccountAccessKey: exampleAccount.primaryAccessKey,
 *     osType: "linux",
 *     version: "~3",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="azure-functions-cptest-rg",
 *     location="West Europe")
 * example_account = azure.storage.Account("example",
 *     name="functionsapptestsa",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     account_tier="Standard",
 *     account_replication_type="LRS")
 * example_plan = azure.appservice.Plan("example",
 *     name="azure-functions-test-service-plan",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     kind="Linux",
 *     reserved=True,
 *     sku={
 *         "tier": "Dynamic",
 *         "size": "Y1",
 *     })
 * example_function_app = azure.appservice.FunctionApp("example",
 *     name="test-azure-functions",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     app_service_plan_id=example_plan.id,
 *     storage_account_name=example_account.name,
 *     storage_account_access_key=example_account.primary_access_key,
 *     os_type="linux",
 *     version="~3")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "azure-functions-cptest-rg",
 *         Location = "West Europe",
 *     });
 *     var exampleAccount = new Azure.Storage.Account("example", new()
 *     {
 *         Name = "functionsapptestsa",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         AccountTier = "Standard",
 *         AccountReplicationType = "LRS",
 *     });
 *     var examplePlan = new Azure.AppService.Plan("example", new()
 *     {
 *         Name = "azure-functions-test-service-plan",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         Kind = "Linux",
 *         Reserved = true,
 *         Sku = new Azure.AppService.Inputs.PlanSkuArgs
 *         {
 *             Tier = "Dynamic",
 *             Size = "Y1",
 *         },
 *     });
 *     var exampleFunctionApp = new Azure.AppService.FunctionApp("example", new()
 *     {
 *         Name = "test-azure-functions",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         AppServicePlanId = examplePlan.Id,
 *         StorageAccountName = exampleAccount.Name,
 *         StorageAccountAccessKey = exampleAccount.PrimaryAccessKey,
 *         OsType = "linux",
 *         Version = "~3",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/appservice"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/storage"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("azure-functions-cptest-rg"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleAccount, err := storage.NewAccount(ctx, "example", &storage.AccountArgs{
 * 			Name:                   pulumi.String("functionsapptestsa"),
 * 			ResourceGroupName:      example.Name,
 * 			Location:               example.Location,
 * 			AccountTier:            pulumi.String("Standard"),
 * 			AccountReplicationType: pulumi.String("LRS"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		examplePlan, err := appservice.NewPlan(ctx, "example", &appservice.PlanArgs{
 * 			Name:              pulumi.String("azure-functions-test-service-plan"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			Kind:              pulumi.Any("Linux"),
 * 			Reserved:          pulumi.Bool(true),
 * 			Sku: &appservice.PlanSkuArgs{
 * 				Tier: pulumi.String("Dynamic"),
 * 				Size: pulumi.String("Y1"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = appservice.NewFunctionApp(ctx, "example", &appservice.FunctionAppArgs{
 * 			Name:                    pulumi.String("test-azure-functions"),
 * 			Location:                example.Location,
 * 			ResourceGroupName:       example.Name,
 * 			AppServicePlanId:        examplePlan.ID(),
 * 			StorageAccountName:      exampleAccount.Name,
 * 			StorageAccountAccessKey: exampleAccount.PrimaryAccessKey,
 * 			OsType:                  pulumi.String("linux"),
 * 			Version:                 pulumi.String("~3"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.azure.core.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.storage.Account;
 * import com.pulumi.azure.storage.AccountArgs;
 * import com.pulumi.azure.appservice.Plan;
 * import com.pulumi.azure.appservice.PlanArgs;
 * import com.pulumi.azure.appservice.inputs.PlanSkuArgs;
 * import com.pulumi.azure.appservice.FunctionApp;
 * import com.pulumi.azure.appservice.FunctionAppArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 *     public static void stack(Context ctx) {
 *         var example = new ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("azure-functions-cptest-rg")
 *             .location("West Europe")
 *             .build());
 *         var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
 *             .name("functionsapptestsa")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .accountTier("Standard")
 *             .accountReplicationType("LRS")
 *             .build());
 *         var examplePlan = new Plan("examplePlan", PlanArgs.builder()
 *             .name("azure-functions-test-service-plan")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .kind("Linux")
 *             .reserved(true)
 *             .sku(PlanSkuArgs.builder()
 *                 .tier("Dynamic")
 *                 .size("Y1")
 *                 .build())
 *             .build());
 *         var exampleFunctionApp = new FunctionApp("exampleFunctionApp", FunctionAppArgs.builder()
 *             .name("test-azure-functions")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .appServicePlanId(examplePlan.id())
 *             .storageAccountName(exampleAccount.name())
 *             .storageAccountAccessKey(exampleAccount.primaryAccessKey())
 *             .osType("linux")
 *             .version("~3")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: azure-functions-cptest-rg
 *       location: West Europe
 *   exampleAccount:
 *     type: azure:storage:Account
 *     name: example
 *     properties:
 *       name: functionsapptestsa
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       accountTier: Standard
 *       accountReplicationType: LRS
 *   examplePlan:
 *     type: azure:appservice:Plan
 *     name: example
 *     properties:
 *       name: azure-functions-test-service-plan
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       kind: Linux
 *       reserved: true
 *       sku:
 *         tier: Dynamic
 *         size: Y1
 *   exampleFunctionApp:
 *     type: azure:appservice:FunctionApp
 *     name: example
 *     properties:
 *       name: test-azure-functions
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       appServicePlanId: ${examplePlan.id}
 *       storageAccountName: ${exampleAccount.name}
 *       storageAccountAccessKey: ${exampleAccount.primaryAccessKey}
 *       osType: linux
 *       version: ~3
 * ```
 * 
 * > **Note:** Version `~3` or `~4` is required for Linux Function Apps.
 * ### Python In A Consumption Plan)
 * 
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.azure.core.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.storage.Account;
 * import com.pulumi.azure.storage.AccountArgs;
 * import com.pulumi.azure.appservice.Plan;
 * import com.pulumi.azure.appservice.PlanArgs;
 * import com.pulumi.azure.appservice.inputs.PlanSkuArgs;
 * import com.pulumi.azure.appservice.FunctionApp;
 * import com.pulumi.azure.appservice.FunctionAppArgs;
 * import com.pulumi.azure.appservice.inputs.FunctionAppSiteConfigArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 *     public static void stack(Context ctx) {
 *         var example = new ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("azure-functions-example-rg")
 *             .location("West Europe")
 *             .build());
 *         var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
 *             .name("functionsappexamlpesa")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .accountTier("Standard")
 *             .accountReplicationType("LRS")
 *             .build());
 *         var examplePlan = new Plan("examplePlan", PlanArgs.builder()
 *             .name("azure-functions-example-sp")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .kind("Linux")
 *             .reserved(true)
 *             .sku(PlanSkuArgs.builder()
 *                 .tier("Dynamic")
 *                 .size("Y1")
 *                 .build())
 *             .build());
 *         var exampleFunctionApp = new FunctionApp("exampleFunctionApp", FunctionAppArgs.builder()
 *             .name("example-azure-function")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .appServicePlanId(examplePlan.id())
 *             .storageAccountName(exampleAccount.name())
 *             .storageAccountAccessKey(exampleAccount.primaryAccessKey())
 *             .osType("linux")
 *             .version("~4")
 *             .appSettings(Map.of("FUNCTIONS_WORKER_RUNTIME", "python"))
 *             .siteConfig(FunctionAppSiteConfigArgs.builder()
 *                 .linuxFxVersion("python|3.9")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: azure-functions-example-rg
 *       location: West Europe
 *   exampleAccount:
 *     type: azure:storage:Account
 *     name: example
 *     properties:
 *       name: functionsappexamlpesa
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       accountTier: Standard
 *       accountReplicationType: LRS
 *   examplePlan:
 *     type: azure:appservice:Plan
 *     name: example
 *     properties:
 *       name: azure-functions-example-sp
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       kind: Linux
 *       reserved: true
 *       sku:
 *         tier: Dynamic
 *         size: Y1
 *   exampleFunctionApp:
 *     type: azure:appservice:FunctionApp
 *     name: example
 *     properties:
 *       name: example-azure-function
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       appServicePlanId: ${examplePlan.id}
 *       storageAccountName: ${exampleAccount.name}
 *       storageAccountAccessKey: ${exampleAccount.primaryAccessKey}
 *       osType: linux
 *       version: ~4
 *       appSettings:
 *         - FUNCTIONS_WORKER_RUNTIME: python
 *       siteConfig:
 *         linuxFxVersion: python|3.9
 * ```
 * 
 * > **Note:** The Python runtime is only supported on a Linux based hosting plan.  See [the documentation for additional information](https://docs.microsoft.com/azure/azure-functions/functions-reference-python).
 * ## Import
 * Function Apps can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:appservice/functionApp:FunctionApp functionapp1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Web/sites/functionapp1
 * ```
 */
public class FunctionApp internal constructor(
    override val javaResource: com.pulumi.azure.appservice.FunctionApp,
) : KotlinCustomResource(javaResource, FunctionAppMapper) {
    /**
     * The ID of the App Service Plan within which to create this Function App.
     */
    public val appServicePlanId: Output
        get() = javaResource.appServicePlanId().applyValue({ args0 -> args0 })

    /**
     * A map of key-value pairs for [App Settings](https://docs.microsoft.com/azure/azure-functions/functions-app-settings) and custom values.
     * > **NOTE:** The values for `AzureWebJobsStorage` and `FUNCTIONS_EXTENSION_VERSION` will be filled by other input arguments and shouldn't be configured separately. `AzureWebJobsStorage` is filled based on `storage_account_name` and `storage_account_access_key`. `FUNCTIONS_EXTENSION_VERSION` is filled based on `version`.
     */
    public val appSettings: Output>
        get() = javaResource.appSettings().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * A `auth_settings` block as defined below.
     */
    public val authSettings: Output
        get() = javaResource.authSettings().applyValue({ args0 ->
            args0.let({ args0 ->
                functionAppAuthSettingsToKotlin(args0)
            })
        })

    /**
     * The mode of the Function App's client certificates requirement for incoming requests. Possible values are `Required` and `Optional`.
     */
    public val clientCertMode: Output?
        get() = javaResource.clientCertMode().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * An `connection_string` block as defined below.
     */
    public val connectionStrings: Output>
        get() = javaResource.connectionStrings().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> functionAppConnectionStringToKotlin(args0) })
            })
        })

    /**
     * An identifier used by App Service to perform domain ownership verification via DNS TXT record.
     */
    public val customDomainVerificationId: Output
        get() = javaResource.customDomainVerificationId().applyValue({ args0 -> args0 })

    /**
     * The amount of memory in gigabyte-seconds that your application is allowed to consume per day. Setting this value only affects function apps under the consumption plan.
     */
    public val dailyMemoryTimeQuota: Output?
        get() = javaResource.dailyMemoryTimeQuota().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The default hostname associated with the Function App - such as `mysite.azurewebsites.net`
     */
    public val defaultHostname: Output
        get() = javaResource.defaultHostname().applyValue({ args0 -> args0 })

    /**
     * Should the built-in logging of this Function App be enabled? Defaults to `true`.
     */
    public val enableBuiltinLogging: Output?
        get() = javaResource.enableBuiltinLogging().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Is the Function App enabled? Defaults to `true`.
     */
    public val enabled: Output?
        get() = javaResource.enabled().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Can the Function App only be accessed via HTTPS? Defaults to `false`.
     */
    public val httpsOnly: Output?
        get() = javaResource.httpsOnly().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * An `identity` block as defined below.
     */
    public val identity: Output?
        get() = javaResource.identity().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    functionAppIdentityToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * The User Assigned Identity Id used for looking up KeyVault secrets. The identity must be assigned to the application. See [Access vaults with a user-assigned identity](https://docs.microsoft.com/azure/app-service/app-service-key-vault-references#access-vaults-with-a-user-assigned-identity) for more information.
     */
    public val keyVaultReferenceIdentityId: Output
        get() = javaResource.keyVaultReferenceIdentityId().applyValue({ args0 -> args0 })

    /**
     * The Function App kind - such as `functionapp,linux,container`
     */
    public val kind: Output
        get() = javaResource.kind().applyValue({ args0 -> args0 })

    /**
     * Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * Specifies the name of the Function App. Changing this forces a new resource to be created. Limit the function name to 32 characters to avoid naming collisions. For more information about [Function App naming rule](https://docs.microsoft.com/azure/azure-resource-manager/management/resource-name-rules#microsoftweb).
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * A string indicating the Operating System type for this function app. Possible values are `linux` and ``(empty string). Changing this forces a new resource to be created. Defaults to `""`.
     * > **NOTE:** This value will be `linux` for Linux derivatives, or an empty string for Windows (default). When set to `linux` you must also set `azure.appservice.Plan` arguments as `kind = "Linux"` and `reserved = true`
     */
    public val osType: Output?
        get() = javaResource.osType().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * A comma separated list of outbound IP addresses - such as `52.23.25.3,52.143.43.12`
     */
    public val outboundIpAddresses: Output
        get() = javaResource.outboundIpAddresses().applyValue({ args0 -> args0 })

    /**
     * A comma separated list of outbound IP addresses - such as `52.23.25.3,52.143.43.12,52.143.43.17` - not all of which are necessarily in use. Superset of `outbound_ip_addresses`.
     */
    public val possibleOutboundIpAddresses: Output
        get() = javaResource.possibleOutboundIpAddresses().applyValue({ args0 -> args0 })

    /**
     * The name of the resource group in which to create the Function App. Changing this forces a new resource to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })

    /**
     * A `site_config` object as defined below.
     */
    public val siteConfig: Output
        get() = javaResource.siteConfig().applyValue({ args0 ->
            args0.let({ args0 ->
                functionAppSiteConfigToKotlin(args0)
            })
        })

    /**
     * A `site_credential` block as defined below, which contains the site-level credentials used to publish to this App Service.
     */
    public val siteCredentials: Output>
        get() = javaResource.siteCredentials().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> functionAppSiteCredentialToKotlin(args0) })
            })
        })

    /**
     * A `source_control` block, as defined below.
     */
    public val sourceControl: Output
        get() = javaResource.sourceControl().applyValue({ args0 ->
            args0.let({ args0 ->
                functionAppSourceControlToKotlin(args0)
            })
        })

    /**
     * The access key which will be used to access the backend storage account for the Function App.
     * > **Note:** When integrating a `CI/CD pipeline` and expecting to run from a deployed package in `Azure` you must seed your `app settings` as part of the application code for function app to be successfully deployed. `Important Default key pairs`: (`"WEBSITE_RUN_FROM_PACKAGE" = ""`, `"FUNCTIONS_WORKER_RUNTIME" = "node"` (or python, etc), `"WEBSITE_NODE_DEFAULT_VERSION" = "10.14.1"`, `"APPINSIGHTS_INSTRUMENTATIONKEY" = ""`).
     * > **Note:**  When using an App Service Plan in the `Free` or `Shared` Tiers `use_32_bit_worker_process` must be set to `true`.
     */
    public val storageAccountAccessKey: Output
        get() = javaResource.storageAccountAccessKey().applyValue({ args0 -> args0 })

    /**
     * The backend storage account name which will be used by this Function App (such as the dashboard, logs). Changing this forces a new resource to be created.
     */
    public val storageAccountName: Output
        get() = javaResource.storageAccountName().applyValue({ args0 -> args0 })

    /**
     * A mapping of tags to assign to the resource.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * The runtime version associated with the Function App. Defaults to `~1`.
     */
    public val version: Output?
        get() = javaResource.version().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
}

public object FunctionAppMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.appservice.FunctionApp::class == javaResource::class

    override fun map(javaResource: Resource): FunctionApp = FunctionApp(
        javaResource as
            com.pulumi.azure.appservice.FunctionApp,
    )
}

/**
 * @see [FunctionApp].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [FunctionApp].
 */
public suspend fun functionApp(name: String, block: suspend FunctionAppResourceBuilder.() -> Unit): FunctionApp {
    val builder = FunctionAppResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [FunctionApp].
 * @param name The _unique_ name of the resulting resource.
 */
public fun functionApp(name: String): FunctionApp {
    val builder = FunctionAppResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy