From 8af83f7c1171d152c4ebd42eb6f80977ea2a4117 Mon Sep 17 00:00:00 2001 From: kakakakakku Date: Thu, 23 Apr 2026 09:32:33 +0900 Subject: [PATCH 1/4] apigw-dynamodb-terraform: Update AWS Provider to v6 --- apigw-dynamodb-terraform/main.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apigw-dynamodb-terraform/main.tf b/apigw-dynamodb-terraform/main.tf index b7fc36612c..b782a1b92c 100644 --- a/apigw-dynamodb-terraform/main.tf +++ b/apigw-dynamodb-terraform/main.tf @@ -2,7 +2,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = "~> 3.27" + version = "~> 6.0" } } @@ -349,4 +349,4 @@ output "APIGW-URL" { output "APIGW-Key" { value = aws_api_gateway_usage_plan_key.MyAPIGWUsagePlanKey.value description = "The APIGW Key to use for testing" -} \ No newline at end of file +} From c0693673a37e21e23bb25ed0a6483bcc289d8eb9 Mon Sep 17 00:00:00 2001 From: kakakakakku Date: Thu, 23 Apr 2026 09:38:52 +0900 Subject: [PATCH 2/4] apigw-dynamodb-terraform: Replace deprecated hash_key with key_schema in GSI --- apigw-dynamodb-terraform/main.tf | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apigw-dynamodb-terraform/main.tf b/apigw-dynamodb-terraform/main.tf index b782a1b92c..342746eccd 100644 --- a/apigw-dynamodb-terraform/main.tf +++ b/apigw-dynamodb-terraform/main.tf @@ -81,8 +81,11 @@ resource "aws_dynamodb_table" "MyDynamoDBTable" { } global_secondary_index { - name = "PetType-index" - hash_key = "PetType" + name = "PetType-index" + key_schema { + attribute_name = "PetType" + key_type = "HASH" + } write_capacity = 5 read_capacity = 5 projection_type = "INCLUDE" From 435e9503bb5d7978889d2f462a28bfb4af453369 Mon Sep 17 00:00:00 2001 From: kakakakakku Date: Thu, 23 Apr 2026 10:24:30 +0900 Subject: [PATCH 3/4] apigw-dynamodb-terraform: Replace deprecated aws_region name with id --- apigw-dynamodb-terraform/main.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apigw-dynamodb-terraform/main.tf b/apigw-dynamodb-terraform/main.tf index 342746eccd..66b7d639be 100644 --- a/apigw-dynamodb-terraform/main.tf +++ b/apigw-dynamodb-terraform/main.tf @@ -122,7 +122,7 @@ resource "aws_api_gateway_rest_api" "MyApiGatewayRestApi" { "type" : "aws", "credentials" : "${aws_iam_role.APIGWRole.arn}", "httpMethod" : "POST", - "uri" : "arn:aws:apigateway:${data.aws_region.current.name}:dynamodb:action/PutItem", + "uri" : "arn:aws:apigateway:${data.aws_region.current.id}:dynamodb:action/PutItem", "responses" : { "default" : { "statusCode" : "200", @@ -160,7 +160,7 @@ resource "aws_api_gateway_rest_api" "MyApiGatewayRestApi" { "type" : "aws", "credentials" : "${aws_iam_role.APIGWRole.arn}", "httpMethod" : "POST", - "uri" : "arn:aws:apigateway:${data.aws_region.current.name}:dynamodb:action/Query", + "uri" : "arn:aws:apigateway:${data.aws_region.current.id}:dynamodb:action/Query", "responses" : { "default" : { "statusCode" : "200", From 644c8785cda1a22261096d3877db0ff50a315d17 Mon Sep 17 00:00:00 2001 From: kakakakakku Date: Thu, 23 Apr 2026 10:37:20 +0900 Subject: [PATCH 4/4] apigw-dynamodb-terraform: Fix README testing instructions --- apigw-dynamodb-terraform/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apigw-dynamodb-terraform/README.md b/apigw-dynamodb-terraform/README.md index 0f06a4d210..2e4f7c992f 100644 --- a/apigw-dynamodb-terraform/README.md +++ b/apigw-dynamodb-terraform/README.md @@ -54,15 +54,15 @@ Once the application is deployed, you can test it using the following instructio ``` * Repeate the process as many times as you can, try doing it with different Pet Types 1. Invoke the DynamoDB **Query** action to query items by PetType in the DynamoDB table: - * Run the below command after you replace and with the terraform output from earlier. + * Run the below command after you replace and with the terraform output from earlier. Append the PetType to the URL (e.g. `/dog`). ``` - curl -H 'x-api-key: ' --request GET '' + curl -H 'x-api-key: ' --request GET '/dog' ``` * Repeate the process as many times as you can with different Pet Types * You should receive a "200 OK" response with a list of the matching results. Example: ``` { - "music": [ + "pets": [ { "id": "45b33352-fea0-4e8b-8c7a-6be11ec4ff80", "PetType": "dog",