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

CodeDeploy: how to specify Lambda hooks for lifecycle events? #10440

Closed
finferflu opened this issue Oct 9, 2019 · 8 comments
Closed

CodeDeploy: how to specify Lambda hooks for lifecycle events? #10440

finferflu opened this issue Oct 9, 2019 · 8 comments
Labels
question A question about existing functionality; most questions are re-routed to discuss.hashicorp.com. service/lambda Issues and PRs that pertain to the lambda service.

Comments

@finferflu
Copy link
Contributor

Hi all,

I've been looking through the documentation, however, there seems to be no mention of Lambda hooks that can be triggered by lifecycle events during a CodeDeploy deployment. These seem to be vital to, e.g. run automated tests before traffic is sent to a new deployment.

Am I missing something, or is it lacking in the Terraform AWS provider? Failing that, is there anything that this provider can do to facilitate the use of AppSpec files?

Thanks!

@finferflu finferflu added the question A question about existing functionality; most questions are re-routed to discuss.hashicorp.com. label Oct 9, 2019
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Oct 9, 2019
@jpmontez
Copy link

Yeah, I noticed this too. Is this not supported by Terraform?

@DrFaust92 DrFaust92 added service/codedeploy service/lambda Issues and PRs that pertain to the lambda service. labels May 21, 2020
@harryherbig
Copy link

Are there any news on the missing features?

While researching how to establish a proper CI/CD pipeline for aws lambdas I ended up choosing CodeDeploy, mostly because of the pre traffic hooks and the automated alias switiching.
Now it looks like, that we would need to use SAM to get this feature, but this would mean, that all resources would be created with SAM and be written in CloudFormation.
For our team we agreed on terraform for IaaC, so using SAM / CF for this would mean, that we would have resources coming from two different sources, which we wanted to avoid.

@alexandergunnarson
Copy link

alexandergunnarson commented Aug 29, 2020

We've gone with using triggers (see trigger_configuration in TF docs) to emulate this functionality. Don't love that we have to use a workaround, but at least a workaround exists!

We tried this example but it didn't really work for our CD use case.

@justinretzolk
Copy link
Member

Hey y'all 👋 Thank you for taking the time to file this issue! Given that there's been a number of AWS provider releases since you initially filed it, can you confirm whether you're still missing this functionality?

@justinretzolk justinretzolk added waiting-response Maintainers are waiting on response from community or contributor. and removed needs-triage Waiting for first response or review from a maintainer. labels Dec 9, 2021
@MatthewEdwards
Copy link

I believe this is still missing functionality

@github-actions github-actions bot removed the waiting-response Maintainers are waiting on response from community or contributor. label Jul 11, 2022
@MatthewEdwards
Copy link

Upon further investigation I've found the hook needs to be added to the revision.json if you're not using the AppSpec so I believe there's nothing for the provider to do here.

{
  "version": 1,
  "Resources": [
    {
      "TargetService": {
        "Type": "AWS::ECS::Service",
        "Properties": {
          "TaskDefinition": "arn:aws:ecs:eu-west-1:<redacted>:task-definition/<redacted>",
          "LoadBalancerInfo": {
            "ContainerName": "<redacted>",
            "ContainerPort": 3000
          }
        }
      }
    }
  ],
  "Hooks": [
    {
      "BeforeAllowTraffic": "arn:aws:lambda:eu-west-1:<redacted>:<redacted>"
    }
  ]
}

@justinretzolk
Copy link
Member

justinretzolk commented Jul 25, 2022

Hey @MatthewEdwards 👋 Thank you for taking the time to follow up with your findings here! Always great to see someone provide their solution in case someone else stumbles across this issue in the future 🎉.

Given your findings, I'll mark this issue as closed. If you feel we've done this in error, please open a new issue with any updated information you may have.

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question A question about existing functionality; most questions are re-routed to discuss.hashicorp.com. service/lambda Issues and PRs that pertain to the lambda service.
Projects
None yet
Development

No branches or pull requests

8 participants