Skip to content
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

feat: terraform deployment alternative #109

Closed
nitrocode opened this issue Sep 8, 2020 · 7 comments · Fixed by #120
Closed

feat: terraform deployment alternative #109

nitrocode opened this issue Sep 8, 2020 · 7 comments · Fixed by #120

Comments

@nitrocode
Copy link

It would be nice to have an alternative to cloud formation so this can be easily deployed to aws using terraform.

@alexcasalboni
Copy link
Owner

Hey @nitrocode, thanks for sharing!

I've been monitoring this issue, which would allow you to use SAR directly: hashicorp/terraform-provider-aws#3981

In the meantime, it looks like you can use aws_cloudformation_stack and deploy this resource (AWS::Serverless::Application).

I admit I haven't tried this as I don't have a lot of experience with Terraform myself. But it'd be great if we could document an official way to deploy Lambda Power Tuning with Terraform. Using the SAR app looks like a much easier mechanism that doesn't require to maintain two independent templates for SAM/CloudFormation and Terraform.

Do you think you could help me look into this?

@nitrocode
Copy link
Author

I believe you are referring to something like in this comment.

buildkite/elastic-ci-stack-for-aws#246 (comment)

Not my preference but it should be easy enough. Waiting for the day when we can easily convert between the two.

@alexcasalboni
Copy link
Owner

@nitrocode, same here!

Check out this comment too, as referencing a SAR application via template_body looks much easier :)

hashicorp/terraform-provider-aws#3981 (comment)

@Clete2
Copy link
Contributor

Clete2 commented Dec 3, 2020

Terraform supports SAR CF stacks natively now.

Try something like this:

# Deploys a shared Lambda Power Tuning stack
# https://github.com/alexcasalboni/aws-lambda-power-tuning
resource "aws_serverlessapplicationrepository_cloudformation_stack" "lambda-power-tuning" {
  name           = "my-cool-lambda-power-tuner"
  application_id = "arn:aws:serverlessrepo:us-east-1:451282441545:applications/aws-lambda-power-tuning"
  capabilities   = ["CAPABILITY_IAM"]

  parameters = {
    PowerValues           = "128,192,256,512,1024,2048,3072,4096,5120,6144,7168,8192,9216,10240" # These are defaults, you can override when running the step function
    lambdaResource        = "*"
    totalExecutionTimeout = 900
    visualizationURL      = "https://lambda-power-tuning.show/"
  }
}

Terraform Documentation

(PS this is hot off the press: support was added about a week ago)

@alexcasalboni
Copy link
Owner

Thanks for sharing, @Clete2!

I'm going to document this asap :)

It still sounds a bit odd to deploy a CFN stack with Terraform, but I'm sure it will be useful to a lot of folks.

@Clete2
Copy link
Contributor

Clete2 commented Dec 3, 2020

@alexcasalboni I'm working on a PR to merge documentation for it.

It is indeed "weird" but it allows us to integrate the stacks with the rest of our Terraform code.

@Clete2
Copy link
Contributor

Clete2 commented Dec 3, 2020

See #120

@alexcasalboni alexcasalboni linked a pull request Dec 3, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants