aws / aws/aws-cdk

(s3tables-alpha): Namespace requires explicit dependency

Open
#36,671 6 comments 0 reactions 0 assignees View on GitHub
aws-cdk-lib bug effort/medium p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### 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](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-s3tables-namespace.html#aws-resource-s3tables-namespace-return-values) 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.

Contributor guide

Open the contributing guide

Research direction

Start at the alpha Namespace construct and its CfnNamespace L1 resource, focusing on how the public namespaceName property is produced. Compare it with the AWS::S3Tables::Namespace Ref return value and run the reproduction involving CfnTable; done means consuming namespace.namespaceName expresses the dependency and resource ordering works.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.