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

Adding apigw-sfn-crud-terraform pattern #2444

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

enmata
Copy link

@enmata enmata commented Aug 21, 2024

Issue #, if available:
#2443

Description of changes:
Adding terraform version of apigw-sfn-crud pattern
https://serverlessland.com/patterns/apigw-sfn-crud

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

Copy link
Contributor

@bfreiberg bfreiberg left a comment

Choose a reason for hiding this comment

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

I get an error when running `terraform apply´ due to CloudWatch Logs ARN not being specified. Please add instructions or link to documentation on how to do this.

│ Error: error updating API Gateway Stage (ags-6omth9g63d-Prod): BadRequestException: CloudWatch Logs role ARN must be set in account settings to enable logging
│
│   with aws_api_gateway_stage.API_SF_CRUD-tf_API_Stage_Prod,
│   on main.tf line 222, in resource "aws_api_gateway_stage" "API_SF_CRUD-tf_API_Stage_Prod":
│  222: resource "aws_api_gateway_stage" "API_SF_CRUD-tf_API_Stage_Prod" {

required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.27"
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use the most recent version

resource "aws_sfn_state_machine" "API_SF_CRUD-tf_CF" {
name = "API_SF_CRUD-tf_CF"
role_arn = aws_iam_role.API_SF_CRUD-tf_CFRole.arn
definition = file("./crud.asl.json")
Copy link
Contributor

Choose a reason for hiding this comment

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

File is named crud-asl.json


## How it works

Amazon API Gateway creates a direct integration with AWS Step Functions utilizing a synchronous call. Step functions evaluates the path and method to choose the proper action. The action steps can be modified to meet your needs.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Amazon API Gateway creates a direct integration with AWS Step Functions utilizing a synchronous call. Step functions evaluates the path and method to choose the proper action. The action steps can be modified to meet your needs.
Amazon API Gateway creates a direct integration with AWS Step Functions utilizing a synchronous call. The Step Functions state machine evaluates the path and method to choose the proper action. The action steps can be modified to meet your needs.


*CRUD = Create, Read, Update, Delete*

Once the application is deployed, use a tool like Postman or Curl to call the different CRUD endpoints. If you would like to import the Postman package, update the endpoint and import into Postman.
Copy link
Contributor

Choose a reason for hiding this comment

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

It isn't clear to me what is meant be updating the endpoint and importing it? Please also add an example of a curl request

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 this pull request may close these issues.

3 participants