8000 feat: Terraform example by skal111 · Pull Request #1458 · aws-powertools/powertools-lambda-java · GitHub
[go: up one dir, main page]

Skip to content

feat: Terraform example #1458

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

Closed
wants to merge 9 commits into from
Closed

feat: Terraform example #1458

wants to merge 9 commits into from

Conversation

skal111
Copy link
Contributor
@skal111 skal111 commented Oct 6, 2023

Issue #1445:

Description of changes:

Added a core-example with Terraform deployment

Just added a new terraform folder under powertools-examples-core which contain appropriate instructions and template to deploy the sample Lambdas and API Gateway with Terraform

Checklist

Breaking change checklist

RFC issue #:

  • Migration process documented
  • Implement warnings (if it can live side by side)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@jeromevdl jeromevdl changed the title Feat/#1445-terraform-example chore: Terraform example Oct 6, 2023
@jeromevdl jeromevdl changed the title chore: Terraform example feat: Terraform example Oct 6, 2023
To install Terraform if you don't have it yet, you can follow the [Install Terraform Guide](https://developer.hashicorp.com/terraform/downloads?product_intent=terraform).

## Configuration
Serverless Framework uses [serverless.yml](./serverless.yml) to define the application's AWS resources.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

terraform...

}

# Allows API gateway to invoke lambda
resource "aws_lambda_permission" "hello_world_lambda_testinvoke" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this test-invoke-stage ?

Copy link
Contributor Author
@skal111 skal111 Oct 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Required stage to test the lambda invocation from the API Gateway console. Can be removed, but CDK example deploys similar permissions, including that test-invoke-stage.
https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/test-invoke-method.html

}

# Allows API gateway to invoke lambda
resource "aws_lambda_permission" "hello_world_stream_lambda_testinvoke" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here?

variables = {
POWERTOOLS_LOG_LEVEL = "INFO"
POWERTOOLS_LOGGER_SAMPLE_RATE = "0.1"
POWERTOOLS_LOGGER_LOG_EVENT = "true"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this line, we actually don't handle this env var...

8000 Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Terraform example is based on the CDK example configuration which include these environment variables. Are you sure?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, we need to cleanup all the examples (#1444)

variables = {
POWERTOOLS_LOG_LEVEL = "INFO"
POWERTOOLS_LOGGER_SAMPLE_RATE = "0.7"
POWERTOOLS_LOGGER_LOG_EVENT = "true"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this line too

Copy link
Contributor
@jeromevdl jeromevdl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few changes to do. I'll need to test also...

@codecov-commenter
Copy link

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (3ea3fa1) 78.58% compared to head (f6f13a6) 78.58%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #1458   +/-   ##
=========================================
  Coverage     78.58%   78.58%           
  Complexity      650      650           
=========================================
  Files            74       74           
  Lines          2508     2508           
  Branches        259      259           
=========================================
  Hits           1971     1971           
  Misses          455      455           
  Partials         82       82           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -0,0 +1,4 @@
# terraform modules
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do we know that we haven't broken this - can we lint it as part of the build?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we do a terraform validate at least ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is also this: https://github.com/terraform-linters/setup-tflint. Should we add it?

Copy link
Contributor
@jeromevdl jeromevdl Oct 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@scottgerring we should something similar for SAM and the others... sam build / sam validate --lint --template template.yml
(for another issue/pr)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok I will add some form of linting/validation

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@skal111 skal111 closed this Oct 13, 2023
@skal111 skal111 deleted the feat/terraform-examples branch October 13, 2023 08:16
@scottgerring scottgerring mentioned this pull request Oct 13, 2023
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0