Skip to content

"Unresolved resource dependencies" when doing a CDK Deployment of Global DynamoDB Table #4676

@mmesserman-verimatrix

Description

@mmesserman-verimatrix

As detailed in this bug report: #2900 , there was an issue where it was not possible to create a DynamoDB Global Table in CDK with a stack as the scope - it must be the top-level application that is used for the scope. This was supposedly fixed in #2900 / CDK 1.14.0, and the issue that was previously there IS gone, but now I have a new error when I attempt to deploy:


❌ GlobalDataTesttableCustomResourceD8874B5D failed: ValidationError: Template format error: Unresolved resource dependencies [tableGlobalTableuswest1B808DC21, tableGlobalTableuseast20418E1CB] in the Resources block of the template
Template format error: Unresolved resource dependencies [tableGlobalTableuswest1B808DC21, tableGlobalTableuseast20418E1CB] in the Resources block of the template

No issues are encountered when running cdk synth.

Please note I am using CDK 1.14.0, and python 3.7. I've attached the files which cause this problem to occur. If the declaration of "ddbg.GlobalTable" in data_stack.py uses "scope" instead of "self", this problem goes away (but this is counter to the way scope is usually used in every CDK example I've seen).

Reproduction Steps

app.py

#!/usr/bin/env python3
from aws_cdk import core
from service import data_stack

app = core.App()
east = {'region':'us-east-2'}
west = {'region':'us-west-1'}
data_stack = data_stack.DataStack(app, 'GlobalDataTest', regions=[east['region'], west['region']], env=east)
app.synth()

###############

data_stack.py

from aws_cdk import core
from aws_cdk import aws_dynamodb as ddb
from aws_cdk import aws_dynamodb_global as ddbg

class DataStack(core.Stack):
    def __init__(self, scope: core.Construct, id: str, regions: list, **kwargs) -> None:
        super().__init__(scope, id, **kwargs)
        self.table_name = 'globaldatatest.global.table'
        self.table = ddbg.GlobalTable(
            self, # FAILURE OCCURS DUE TO THIS LINE - putting "scope" works
            'table',
            partition_key={'name': 'key', 'type': ddb.AttributeType.NUMBER},
            table_name=self.table_name,
            regions=regions,
        )

###############

Error Log

❌ GlobalDataTesttableCustomResourceD8874B5D failed: ValidationError: Template format error: Unresolved resource dependencies [tableGlobalTableuswest1B808DC21, tableGlobalTableuseast20418E1CB] in the Resources block of the template
Template format error: Unresolved resource dependencies [tableGlobalTableuswest1B808DC21, tableGlobalTableuseast20418E1CB] in the Resources block of the template

Environment

  • CLI Version :1.16.219
  • Framework Version:1.14.0
  • OS :OS X 10.15
  • Language :python 3.6

Other


This is 🐛 Bug Report

Metadata

Metadata

Assignees

Labels

@aws-cdk/aws-dynamodbRelated to Amazon DynamoDBbugThis issue is a bug.in-progressThis issue is being actively worked on.p1

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions