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.
- Create a CloudFormation stack named nautilus-dynamodb-stack.
- The stack must create a DynamoDB table named nautilus-cf-dynamodb-table.
- Use the main.tf file (do not create a separate .tf file) to provision a CloudFormation stack and DynamoDB table.
- Use the variables.tf file with the following variable names:
- KKE_DYNAMODB_TABLE_NAME: Dynamodb table name.
- The locals.tf file is already provided and includes the following:
- cf_template_body: A local variable that stores the CloudFormation template body.
- 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 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 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 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.