Skip to content

(s3tables-alpha): Namespace requires explicit dependency #36671

@brandondahler

Description

@brandondahler

Describe the bug

In most constructs, when an input property is reflected back out in the construct's public properties, that public property will be bound to the underlying resource in a manner which implies a dependency on any future usage.

For the Namespace construct, the namespaceName is input as a property and re-exposed as a public property on the construct; however, the implementation is simply copying the input property string.

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Library Version

No response

Expected Behavior

When consuming namespaceName through the Namespace construct's public property, a token is returned that binds the value in a manner that expresses the implicit dependency.

Current Behavior

No dependency is expressed, deployment may fail on creation or deletion due to lack of dependency being expressed and resource ordering not correctly being applied.

Reproduction Steps

import { CfnTable } from 'aws-cdk-lib/aws-s3tables';
import { Namespace, TableBucket } from '@aws-cdk/aws-s3tables-alpha';

const app = new App();
const stack = new Stack(app, "Foo");


const tableBucket = new TableBucket(this, 'TableBucket', {
    tableBucketName: "foo",
});

const namespace = new Namespace(this, 'Namespace', {
  tableBucket,
  namespaceName: 'bar',
});

new CfnTable(this, 'Table', {
  tableBucketArn: tableBucket.tableBucketArn,
  namespace: namespace.namespaceName,
  tableName: 'fizz',
  openTableFormat: 'ICEBERG',
  icebergMetadata: {
    icebergSchema: {
      schemaFieldList: [
        {
          name: 'id',
          type: 'string',
          required: true,
        }
      ]
    }
  }
});

Possible Solution

Utilize the Ref value returned by the AWS::S3Tables::Namespace resource via the CfnNamespace L1 construct.

Additional Information/Context

No response

AWS CDK Library version (aws-cdk-lib)

2.234.1

AWS CDK CLI version

2.1100.3 (build 0aa3e98)

Node.js Version

v20.19.2

OS

MacOS 15.7.3

Language

TypeScript

Language Version

TypeScript (5.9.3)

Other information

Plan to create a PR to fix this shortly. Related to #33054.

Metadata

Metadata

Assignees

No one assigned

    Labels

    aws-cdk-libRelated to the aws-cdk-lib packagebugThis issue is a bug.effort/mediumMedium work item – several days of effortp2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions