Terraform Level2 Task20 Create DynamoDB Table Using CloudFormation Using Terraform

Task20: The Nautilus DevOps team wants to automate infrastructure provisioning using CloudFormation. As part of the stack setup, they need to create a DynamoDB table.

  1. Create a CloudFormation stack named nautilus-dynamodb-stack.
  2. The stack must create a DynamoDB table named nautilus-cf-dynamodb-table.
  3. Use the main.tf file (do not create a separate .tf file) to provision a CloudFormation stack and DynamoDB table.
  4. Use the variables.tf file with the following variable names:
    • KKE_DYNAMODB_TABLE_NAME: Dynamodb table name.
  5. The locals.tf file is already provided and includes the following:
    • cf_template_body: A local variable that stores the CloudFormation template body.
  6. Use the outputs.tf file to output the following:
    • KKE_stack_name: CloudFormation stack name

My Solution: variables.tf
variable “KKE_DYNAMODB_TABLE_NAME” {
type = string
default = “nautilus-cf-dynamodb-table”
}

main.tf:
resource “aws_cloudformation_stack” “nautilus-dynamodb-stack” {
name = “nautilus-dynamodb-stack”
template_body = local.cf_template_body
}

My verification:
bob@iac-server ~/terraform via :diamond_shape_with_a_dot_inside: default ➜ aws dynamodb describe-table --table-name nautilus-cf-dynamodb-table
{
“Table”: {
“AttributeDefinitions”: [
{
“AttributeName”: “ID”,
“AttributeType”: “S”
}
],
“TableName”: “nautilus-cf-dynamodb-table”,
“KeySchema”: [
{
“AttributeName”: “ID”,
“KeyType”: “HASH”
}
],
“TableStatus”: “ACTIVE”,
“CreationDateTime”: 1752367943.06,
“ProvisionedThroughput”: {
“LastIncreaseDateTime”: 0.0,
“LastDecreaseDateTime”: 0.0,
“NumberOfDecreasesToday”: 0,
“ReadCapacityUnits”: 5,
“WriteCapacityUnits”: 5
},
“TableSizeBytes”: 0,
“ItemCount”: 0,
“TableArn”: “arn:aws:dynamodb:us-east-1:000000000000:table/nautilus-cf-dynamodb-table”,
“TableId”: “97660aca-de02-4415-bef5-023e89d5cc94”,
“DeletionProtectionEnabled”: false
}
}

bob@iac-server ~/terraform via :diamond_shape_with_a_dot_inside: default ➜ aws cloudformation describe-stacks
{
“Stacks”: [
{
“StackId”: “arn:aws:cloudformation:us-east-1:000000000000:stack/nautilus-dynamodb-stack/26ea3201”,
“StackName”: “nautilus-dynamodb-stack”,
“CreationTime”: “2025-07-13T00:52:19.624000Z”,
“LastUpdatedTime”: “2025-07-13T00:52:19.624000Z”,
“RollbackConfiguration”: {},
“StackStatus”: “CREATE_COMPLETE”,
“DisableRollback”: false,
“NotificationARNs”: [],
“Tags”: [],
“EnableTerminationProtection”: false,
“DriftInformation”: {
“StackDriftStatus”: “NOT_CHECKED”
}
}
]
}

bob@iac-server ~/terraform via :diamond_shape_with_a_dot_inside: default ➜ terraform output
KKE_stack_name = “nautilus-dynamodb-stack”

This task expects variable name use for DynamoDB table.

But verification failed with below message:
‘variables.tf’ file does not contains the correct cloudformation stack name .

which means this task verification expects variable name for cloudformation stack as well but what is the variable name is not mentioned in the question.

Please check and update the question or verification for this task.

Hi @V.SIVAKUMAR.MCA

Thanks for your feedback, it is a valid issue, we will fix it and let you know.

Hi @V.SIVAKUMAR.MCA

The issue is fixed, please try again. Thanks for your value feedback.

Hi @raymond.baoly

Thanks for your update. Now I have successfully completed this task.

1 Like