github.com/myhau/pulumi/pkg/v3@v3.70.2-0.20221116134521-f2775972e587/codegen/testing/test/testdata/transpiled_examples/azure-app-service-pp/azure-app-service.pp (about)

     1  config sqlAdmin string {
     2  	__logicalName = "sqlAdmin"
     3  	default = "pulumi"
     4  }
     5  
     6  blobAccessToken = secret(invoke("azure-native:storage:listStorageAccountServiceSAS", {
     7  	accountName = sa.name,
     8  	protocols = "https",
     9  	sharedAccessStartTime = "2022-01-01",
    10  	sharedAccessExpiryTime = "2030-01-01",
    11  	resource = "c",
    12  	resourceGroupName = appservicegroup.name,
    13  	permissions = "r",
    14  	canonicalizedResource = "/blob/${sa.name}/${container.name}",
    15  	contentType = "application/json",
    16  	cacheControl = "max-age=5",
    17  	contentDisposition = "inline",
    18  	contentEncoding = "deflate"
    19  }).serviceSasToken)
    20  
    21  resource appservicegroup "azure-native:resources:ResourceGroup" {
    22  	__logicalName = "appservicegroup"
    23  }
    24  
    25  resource sa "azure-native:storage:StorageAccount" {
    26  	__logicalName = "sa"
    27  	resourceGroupName = appservicegroup.name
    28  	kind = "StorageV2"
    29  	sku = {
    30  		name = "Standard_LRS"
    31  	}
    32  }
    33  
    34  resource appserviceplan "azure-native:web:AppServicePlan" {
    35  	__logicalName = "appserviceplan"
    36  	resourceGroupName = appservicegroup.name
    37  	kind = "App"
    38  	sku = {
    39  		name = "B1",
    40  		tier = "Basic"
    41  	}
    42  }
    43  
    44  resource container "azure-native:storage:BlobContainer" {
    45  	__logicalName = "container"
    46  	resourceGroupName = appservicegroup.name
    47  	accountName = sa.name
    48  	publicAccess = "None"
    49  }
    50  
    51  resource blob "azure-native:storage:Blob" {
    52  	__logicalName = "blob"
    53  	resourceGroupName = appservicegroup.name
    54  	accountName = sa.name
    55  	containerName = container.name
    56  	type = "Block"
    57  	source = fileArchive("./www")
    58  }
    59  
    60  resource appInsights "azure-native:insights:Component" {
    61  	__logicalName = "appInsights"
    62  	resourceGroupName = appservicegroup.name
    63  	applicationType = "web"
    64  	kind = "web"
    65  }
    66  
    67  resource sqlPassword "random:index/randomPassword:RandomPassword" {
    68  	__logicalName = "sqlPassword"
    69  	length = 16
    70  	special = true
    71  }
    72  
    73  resource sqlServer "azure-native:sql:Server" {
    74  	__logicalName = "sqlServer"
    75  	resourceGroupName = appservicegroup.name
    76  	administratorLogin = sqlAdmin
    77  	administratorLoginPassword = sqlPassword.result
    78  	version = "12.0"
    79  }
    80  
    81  resource db "azure-native:sql:Database" {
    82  	__logicalName = "db"
    83  	resourceGroupName = appservicegroup.name
    84  	serverName = sqlServer.name
    85  	sku = {
    86  		name = "S0"
    87  	}
    88  }
    89  
    90  resource app "azure-native:web:WebApp" {
    91  	__logicalName = "app"
    92  	resourceGroupName = appservicegroup.name
    93  	serverFarmId = appserviceplan.id
    94  	siteConfig = {
    95  		appSettings = [
    96  			{
    97  				name = "WEBSITE_RUN_FROM_PACKAGE",
    98  				value = "https://${sa.name}.blob.core.windows.net/${container.name}/${blob.name}?${blobAccessToken}"
    99  			},
   100  			{
   101  				name = "APPINSIGHTS_INSTRUMENTATIONKEY",
   102  				value = appInsights.instrumentationKey
   103  			},
   104  			{
   105  				name = "APPLICATIONINSIGHTS_CONNECTION_STRING",
   106  				value = "InstrumentationKey=${appInsights.instrumentationKey}"
   107  			},
   108  			{
   109  				name = "ApplicationInsightsAgent_EXTENSION_VERSION",
   110  				value = "~2"
   111  			}
   112  		],
   113  		connectionStrings = [{
   114  			name = "db",
   115  			type = "SQLAzure",
   116  			connectionString = "Server= tcp:${sqlServer.name}.database.windows.net;initial catalog=${db.name};userID=${sqlAdmin};password=${sqlPassword.result};Min Pool Size=0;Max Pool Size=30;Persist Security Info=true;"
   117  		}]
   118  	}
   119  }
   120  
   121  output endpoint {
   122  	__logicalName = "endpoint"
   123  	value = app.defaultHostName
   124  }