-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Notes on bringing up a Functions example in Azure #6
Comments
Yes, the consumption plan Y1 can only be used with kind functionapp. Y1 is likely documented in the REST API docs. The problem is probably that the documentation is using a newer version of the REST API then TF. At any rate you can test creation using a regular app service plan with SKU B1. Even F1 "free" should work. ListKeys is indeed horrible, that's where the ARM DSL comes in. You can even test that part of the code by using a regular web app. |
Thanks @lindydonna 👍 I couldn't actually find any docs on Good point on using a non-consumption plan - though we definitely want to support consumption plans for anything we do in Agreed that Sounds like next step will need to be patching the TF azure provider to support passing |
Just so this is recorded here, I think Y1 was the old SKU name with an older version of the App Service ARM REST API. Terraform is probably using an older version of the API, so only the new one is documented. In lieu of real reference documentation, this is actually how you create a Function App: I've followed up on the Azure REST spec feature that was linked from hashicorp/terraform-provider-azurerm#131 and asked David Ebbo to confirm the approach I suggested. |
There's an API for SKU options: https://github.com/Azure/azure-rest-api-specs/blob/current/specification/web/resource-manager/Microsoft.Web/2016-09-01/AppServicePlans.json#L790-L825 I gave the App Service team feedback that they should link it more prominently. :) |
I don't think there's any action item here, so closing out. |
Not a bug per se - just a story. (though the story ends with it being seemingly impossible to use Azure Functions from Terraform/Pulumi - which we certainly will want to figure out how to fix).
Azure docs tell us how to stand up Azure Functions: https://docs.microsoft.com/en-us/azure/azure-functions/functions-infrastructure-as-code.
Starting off is simple:
This works like a charm!
Next we need what Azure docs call a
HostingPlan
(though it's name is actuallyserverFarm
). We find aPlan
type that looks right. Azure docs make it sound like we should pass magic constant "Dynamic" as SKU properties on this Plan. The names for TF are totally different than for AzureRM (and the names for the Azure SDK are different than either of these). All with unclear mappings between them (computeMode
vs.name
vs.size
- which I think are actually all the same thing??).Okay - that didn't work. Googling we find hashicorp/terraform-provider-azurerm#131 (comment) which suggests we use
Y1
instead ofDynamic
. I'm serious.Y1
. No explanation - justY1
.And that worked! Except the next step failed.
Any guesses what that error means? Nope. And not a single piece of useful content there to help with googling. I suppose the
<nil>
s were probably where the useful information was supposed to be :-).Let's look at TF sources to see if that helps: https://github.com/terraform-providers/terraform-provider-azurerm/blob/master/azurerm/resource_arm_app_service.go#L270.
Well - that first section doesn't inspire confidence does it! Nothing obvious there, let's go back to the docs.
Well - the docs told me there were some required
appSettings
- let's try adding those:Hmm - what on earth is that
listKeys
thing. Even after reading the docs for 10 mins I can't figure out what the above is actually going to do. But there is aprimaryAccessKey
on the output properties of the resource we created earlier - let's just try using that.Actually kind of nice how Pulumi let's us factor out that crazy connection string construction.
But results in the same error. :-(
Diving into the template linked from the the docs, we see they actually pass a bunch of other settings beyond what's listed in the docs. Let's try adding those:
And updating:
f_u_n_c_t_i_o_n_s__e_x_t_e_n_s_i_o_n__v_e_r_s_i_o_n
. Well that's fun :-). And this time it's our fault.Reading the TF impl, it looks like these settings aren't even applied till after the initial Create succeeds, so let's try something else.
The docs mention setting
"kind": "function"
. But there's nokind
on the TF resource. And - indeed, the TF provider implementation does not offer any way to pass a value there. Perhaps that's why hashicorp/terraform-provider-azurerm#131 (comment) is still open :-).Maybe this really is impossible in current state after all.
So, my current guess is that when you pick
Y1
as your plan, it somehow requires you to setkind=function
? But reports an unusable error message if you don't do that.Oh well - maybe next time...
The text was updated successfully, but these errors were encountered: