Terraform: Feature Request - Alexa skills trigger for lambda

Created on 5 Nov 2016  ยท  12Comments  ยท  Source: hashicorp/terraform

Please can you add the ability to add an Alexa trigger to lambda functoins.

Cheers

Keith

enhancement new-resource

Most helpful comment

for those who see this, all you need to do is add a permission resource like this:

resource "aws_lambda_permission" "with_alexa" {
  statement_id  = "AllowExecutionFromAlexa"
  action        = "lambda:InvokeFunction"
  function_name = "${aws_lambda_function.my-function.function_name}"
  principal     = "alexa-appkit.amazon.com"
}

All 12 comments

Hi @keedon. Thanks for the feature request!

We don't currently have any Alexa-specific resources in Terraform, so I assume there would be some foundational work here to support even basic interactions with Alexa.

I did some quick research to see if I could figure out what we'd need to add here, but my unfamiliarity with Alexa caused me to hit a wall; the docs for Alexa are not presented in the usual way AWS docs are supported, and are written more as a developer guide than as API docs, and thus it's hard to get a sense of what exactly Terraform would be interacting with in order to implement this.

Unfortunately, the "Triggers" UI in the AWS Lambda console does not have a direct equivalent in the underlying API, but instead is a higher-level abstraction over a number of service-specific APIs that need to be used to separately configure each integration. Thus in order to implement this we would need to figure out what underlying operations are performed when adding an Alexa Skills trigger in that UI.

Do you have familiarity with the APIs, if any, that can be used to set up the Alexa trigger? If you could point to the relevant API docs then it's more likely that I or someone else could pick out the relevant parts to add this to Terraform, though the additional caveat is that I don't have an any Alexa devices and so I'm not sure to what extent I'd be able to test such a thing.

I've had a look at the documentation, and there doesn't seem to be any api or cli method of adding a trigger, so I think this might be a non-starter. I'll keep an eye out and if this changes, I'll let you know

Cheers

Keith

+1 for this, if and when API support is available

Hi @keedon,

Thanks so much for the request for this enhancement!

While we'd love to see something like this, we don't currently have any plans to implement this ourselves. Until then, this issue is unlikely to see any movement and remain stale. We're trying to prune the stale issues (that aren't going to be addressed anytime soon) by closing them. Note that we only do this for enhancement requests and not bugs.

Thanks!

@stack72

for those who see this, all you need to do is add a permission resource like this:

resource "aws_lambda_permission" "with_alexa" {
  statement_id  = "AllowExecutionFromAlexa"
  action        = "lambda:InvokeFunction"
  function_name = "${aws_lambda_function.my-function.function_name}"
  principal     = "alexa-appkit.amazon.com"
}

Oh good.. thanks @flyinprogrammer!

Should this be added as an example in the docs?

Since we don't currently have any Alexa-related resources there isn't a great place to put an example like that; it doesn't really scale for us to show on the lambda resource docs how to use every separate AWS service with it. However, if there's a section of the AWS Lambda manual we could link to that in turn links to guides for using different services with Lambda we could potentially link to _that_, which will presumably be more useful since AWS will continue to update it as new services are added.

Maybe this is a happy medium?

https://github.com/terraform-providers/terraform-provider-aws/pull/1188

I'm just herpin' and derpin'.

I was thinking something along the lines of what @flyinprogrammer PR'd but I also see the concern of having to update the docs for every possible trigger that AWS may add.

Right now the API Gateway docs have an example which creates aws_lambda_permission resource, but I found that to be very confusing. I did not realize until today that the aws_lambda_permission resource was equivalent to adding a trigger on the console.

but I also see the concern of having to update the docs for every possible trigger that AWS may add.

I definitely agree that this will become a documentation nightmare in the mid-long term future.

I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

c4milo picture c4milo  ยท  3Comments

franklinwise picture franklinwise  ยท  3Comments

ketzacoatl picture ketzacoatl  ยท  3Comments

shanmugakarna picture shanmugakarna  ยท  3Comments

pawelsawicz picture pawelsawicz  ยท  3Comments