pulumi-azure icon indicating copy to clipboard operation
pulumi-azure copied to clipboard

Including a SiteConfig on an App Service fails creation in specific scenarios

Open Hawxy opened this issue 5 years ago • 8 comments

Was testing out the C# client today and added a SiteConfig block to an AppService definition:

SiteConfig = new AppServiceSiteConfigArgs()
{
   Http2Enabled = true
}

Resulting in:

Plan apply failed: Error creating App Service "..." (Resource Group "..."): web.AppsClient#CreateOrUpdate: Failure sending request: StatusCode=0 -- Original Error: autorest/azure: Service returned an error. Status=<nil> <nil>

Appears to be due to an terraform bug that hasn't been fixed in over a year: https://github.com/terraform-providers/terraform-provider-azurerm/issues/1560

In my case the issue went away by bumping the app service plan to at least Basic/B1, however the issue thread does mention other cases where this happens. Unsure if there's anything you guys can do about it, but I thought it should be noted somewhere.

Hawxy avatar Nov 12 '19 08:11 Hawxy

Thanks for reporting this @Hawxy We likely need to contribute a fix to the terraform provider here.

mikhailshilkov avatar Nov 12 '19 08:11 mikhailshilkov

@mikhailshilkov what are your thoughts on what the correct fix that we need to send upstream is?

stack72 avatar Dec 01 '19 22:12 stack72

@stack72 Fix https://github.com/terraform-providers/terraform-provider-azurerm/issues/1560

mikhailshilkov avatar Dec 01 '19 22:12 mikhailshilkov

@mikhailshilkov LOL I understand that part :) There are like 5 bug reports in the comments of different parameters causing issues - do we know what the actual bug is or is it a combination of them all (i.e. due to default values)

stack72 avatar Dec 01 '19 22:12 stack72

Sorry for being a Captain Obvious :) I do not know the details of what exactly goes wrong, we still need to investigate that if we want to contribute.

mikhailshilkov avatar Dec 01 '19 22:12 mikhailshilkov

Oh I see, I thought you had a fix in mind already! My bad :)

stack72 avatar Dec 01 '19 22:12 stack72

Hi All, I also faced this issue today. I hope the fix will soon release as this is a blocker of my project. Cheers.

baoduy avatar Feb 01 '20 02:02 baoduy

If it helps anyone who actually wants to have a Free F1 plan for some purposes, I have found a configuration that works to create a Free App Service Plan (F1) (I am using Linux/Docker).

azure.appservice.Plan with sku.tier = 'Free' and sku.size = 'F1'

azure.appservice.AppService with siteConfig.alwaysOn: false and siteConfig.use32BitWorkerProcess: true

Below is the full code if it helps anyone:

// Create App Service Plan
...
const appServicePlan = new azure.appservice.Plan(appServicePlanName, {
  name: appServicePlanName,
  resourceGroupName: resourceGroup.name,
  kind: 'Linux',
  reserved: true, // Required to be true for Linux
  sku: {
    tier: 'Free',
    size: 'F1',
  },
});

// Create App Service
...
const appService = new azure.appservice.AppService(appServiceName, {
  name: appServiceName,
  resourceGroupName: resourceGroup.name,
  appServicePlanId: appServicePlan.id,
  httpsOnly: true,
  siteConfig: {
    alwaysOn: false, // Set to true when scaling up to B1 size or greater, needs to be false for F1 size
    linuxFxVersion: pulumi.interpolate`DOCKER|${containerRegistryLoginServer}/service-tag:${pipelineBuildNumber}`,
    use32BitWorkerProcess: true,
  },
  identity: {
    type: 'SystemAssigned',
  },
  appSettings: {
    WEBSITES_ENABLE_APP_SERVICE_STORAGE: 'false',
    DOCKER_REGISTRY_SERVER_URL: pulumi.interpolate`https://${containerRegistryLoginServer}`,
    DOCKER_REGISTRY_SERVER_USERNAME: containerRegistryAdminUsername,
    DOCKER_REGISTRY_SERVER_PASSWORD: containerRegistryAdminPassword,
    APPINSIGHTS_INSTRUMENTATIONKEY: appInsightsInstrumentationKey,
  },
  logs: {
    httpLogs: {
      fileSystem: {
        retentionInMb: 35,
        retentionInDays: 7,
      },
    },
  },
});

jdudleyie avatar Jan 09 '21 23:01 jdudleyie