-
Notifications
You must be signed in to change notification settings - Fork 50
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
Add functions to list keys of Function Apps #297
Conversation
Note that we might get this from Terraform at some point, but they are blocked upstream, so probably not in short-term. See hashicorp/terraform-provider-azurerm#699 |
sdk/nodejs/appservice/zMixins.ts
Outdated
}; | ||
|
||
FunctionApp.prototype.getFunctionKeys = function(this: FunctionApp, functionName) { | ||
return pulumi.all([this.id, functionName]).apply(async ([id, name]) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm feeling dumb, but i cannot understand what this functionName is for. is it just to ensure that hte function has been created first before getFunctionKeys has been called? it seems weird...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its used below in line 773 in the API call to the ARM Api to identify the function inside of the function app.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Each function has its own set of keys in addition to the host keys, so the request URL contains the name as @ChristianEder kindly noticed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh... doh. I see now. i was looking for functionName, and not 'name'. In general we actually like reusing the names (i.e. pulumi.all([this.id, functionName]).apply(async ([id, functionName])
. It helps indicate they represent the same thing, and it makes sure that the outer variable is blocked from being used in the inner scope. I was looking for that pattern and that's what threw me off. This is all good, thanks for clarifying!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense, I'll rename and pick up this pattern.
Done with review pass. LGTM, but i did hav ea question about something odd... |
} else { | ||
// `create()` will throw an error if the Az CLI is not installed or `az login` has never been run. | ||
credentials = await msnodeauth.AzureCliCredentials.create(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we sure these are the complete set of configuration options supported by the Azure provider? I'm a little nervous re-creating this logic outside of the provider. Could we perhaps cross-reference to the primary source for this logic? (Ideally in the backing provider to make sure it's really the same as what the user is seeing for other @pulumi/azure
operations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, me too... I don't know of the source of truth for this.
Ideally, I'd use some function provided by Pulumi core/Terraform which would give me an access token that the provider is already using. Is there something like that? I asked on Slack once but didn't get an answer.
Adds mixin functions to wrap ARM API calls to List Keys of Function Apps, as described in this issue.
Required for #295 or in case we want to support non-anonymous HTTP callback functions.
A function
getServiceClientCredentials
got introduced incore
package. It might be useful for any REST interaction with the Azure Management API.I enabled "format on save" in my VS Code, so some old lines got re-formated. Let me know if that's too annoying.