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

Unable to deploy appsettings for azure static webapp

Open whoiskevinrich opened this issue 3 years ago • 6 comments

From Slack conversation:

Kevin Rich Today at 2:34 PM I'm looking at the typescript @pulumi/azure-native web.StaticSite and would like to deploy some appsettings along with the static site, but don't see a way to set them in the web.StaticSiteArgs object. Is there any guidance for this?

3 replies

Mikhail Shilkov 2 hours ago I checked and the app settings endpoint only have a PUT (create/update) operation but no GET. We depend on being able to read the state of any resource so we couldn’t map it to a Pulumi resource yet. (edited)

Mikhail Shilkov 2 hours ago Actually, there is POST endpoint that lists the settings, so we could do that even though this is a non-standard model.

Mikhail Shilkov 2 hours ago Could you please open an issue?

whoiskevinrich avatar Jun 11 '21 23:06 whoiskevinrich

Any update on this issue? I am missing this as well

XavierGeerinck avatar Dec 27 '21 19:12 XavierGeerinck

Same here, currently i can't add any Environment variables to the StaticSite.

joostliketoast avatar Mar 24 '22 10:03 joostliketoast

@stack72 @mikhailshilkov missing this feature as well. No coverage for

/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/config/appsettings

https://github.com/Azure/azure-rest-api-specs/blob/main/specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/StaticSites.json

tmeckel avatar Jul 15 '22 14:07 tmeckel

This is very annoying.. I was able to set variables using this workaround. Hope it helps any of you too.

new Pulumi.AzureNative.Resources.Deployment("spa-configuration",
	new DeploymentArgs
	{
		ResourceGroupName = resourceGroup.Name,
		Properties = new DeploymentPropertiesArgs
		{
			Mode = DeploymentMode.Incremental,
			Template = new Dictionary<string, object>
			{
				{ "$schema", "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#" },
				{ "contentVersion", "1.0.0.0" },
				{
					"resources", new List<Dictionary<string, object>>()
					{
						new()
						{
							{ "type", "Microsoft.Web/staticSites/config" },
							{ "apiVersion", "2020-10-01" },
							{ "name", spa.Name.Apply(c => $"{c}/appsettings") },
							{ "kind", "string" },
							{
								"properties", new Dictionary<string, object>()
								{
									{ "SPA_AUTH0_DOMAIN", Config.Auth0Domain },
									{ "SPA_AUTH0_CLIENT_ID", webFrontendAuth0Client.ClientId.Apply(c => c) }
								}
							},
						}
					}
				}
			}
		}
	});

klyse avatar Aug 12 '22 17:08 klyse

@klyse Honestly, such things should simply not be necessary. But great that you shared a workaround 👍🏼

tmeckel avatar Aug 12 '22 17:08 tmeckel

Any updates on this?

Isn´t the staticSites basically missing resources from "Microsoft.Web/staticSites/config@x" ?

trylvis avatar Mar 24 '23 14:03 trylvis