Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions packages/@aws-cdk/aws-s3tables-alpha/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,18 @@ const permissions = new iam.PolicyStatement({
table.addToResourcePolicy(permissions);
```

### Tagging

Both `TableBucket` and `Table` support tagging through CDK's standard tagging mechanism:

```ts
Tags.of(tableBucket).add('Environment', 'Production');
Tags.of(table).add('Team', 'DataEngineering');

// Stack-level tags propagate to all resources
Tags.of(stack).add('Project', 'DataLake');
```

## Coming Soon

L2 Construct support for:
Expand Down
10 changes: 8 additions & 2 deletions packages/@aws-cdk/aws-s3tables-alpha/lib/table-bucket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { EOL } from 'os';
import * as iam from 'aws-cdk-lib/aws-iam';
import * as kms from 'aws-cdk-lib/aws-kms';
import * as s3tables from 'aws-cdk-lib/aws-s3tables';
import type { IResource, RemovalPolicy } from 'aws-cdk-lib/core';
import type { IResource, ITaggableV2, RemovalPolicy, TagManager } from 'aws-cdk-lib/core';
import { Resource, UnscopedValidationError, Token } from 'aws-cdk-lib/core';
import { memoizedGetter } from 'aws-cdk-lib/core/lib/helpers-internal';
import { addConstructMetadata } from 'aws-cdk-lib/core/lib/metadata-resource';
Expand Down Expand Up @@ -432,7 +432,7 @@ export interface TableBucketAttributes {
* });
*/
@propertyInjectable
export class TableBucket extends TableBucketBase {
export class TableBucket extends TableBucketBase implements ITaggableV2 {
/** Uniquely identifies this class. */
public static readonly PROPERTY_INJECTION_ID: string = '@aws-cdk.aws-s3tables-alpha.TableBucket';

Expand Down Expand Up @@ -596,6 +596,11 @@ export class TableBucket extends TableBucketBase {
*/
private readonly resource: s3tables.CfnTableBucket;

/**
* The tag manager for this resource.
*/
public readonly cdkTagManager: TagManager;

/**
* The resource policy for this tableBucket.
*/
Expand Down Expand Up @@ -629,6 +634,7 @@ export class TableBucket extends TableBucketBase {
metricsConfiguration: props.requestMetricsStatus ? { status: props.requestMetricsStatus } : undefined,
});

this.cdkTagManager = this.resource.cdkTagManager;
this.resource.applyRemovalPolicy(props.removalPolicy);
}

Expand Down
10 changes: 9 additions & 1 deletion packages/@aws-cdk/aws-s3tables-alpha/lib/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import * as iam from 'aws-cdk-lib/aws-iam';
import { CfnTable, CfnTablePolicy } from 'aws-cdk-lib/aws-s3tables';
import type {
IResource,
ITaggableV2,
RemovalPolicy,
TagManager,
} from 'aws-cdk-lib/core';
import {
Resource,
Expand Down Expand Up @@ -634,7 +636,7 @@ export interface TableAttributes {
* An S3 Table with helpers.
*/
@propertyInjectable
export class Table extends TableBase {
export class Table extends TableBase implements ITaggableV2 {
/** Uniquely identifies this class. */
public static readonly PROPERTY_INJECTION_ID: string = '@aws-cdk.aws-s3tables-alpha.Table';

Expand Down Expand Up @@ -738,6 +740,11 @@ export class Table extends TableBase {
*/
private readonly _resource: CfnTable;

/**
* The tag manager for this resource.
*/
public readonly cdkTagManager: TagManager;

/**
* The name of this table
*/
Expand Down Expand Up @@ -784,6 +791,7 @@ export class Table extends TableBase {
this.namespace = props.namespace;
this.tableName = props.tableName;
this.tableArn = this._resource.attrTableArn;
this.cdkTagManager = this._resource.cdkTagManager;
this._resource.applyRemovalPolicy(props.removalPolicy);
this.node.addDependency(this.namespace);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Construct } from 'constructs';
import { Stack } from 'aws-cdk-lib';
import { Stack, Tags } from 'aws-cdk-lib';
import { TableBucket, UnreferencedFileRemovalStatus, TableBucketEncryption, RequestMetricsStatus, Namespace, Table, Status, OpenTableFormat, IcebergTransform, SortDirection, NullOrder } from '@aws-cdk/aws-s3tables-alpha';
import * as iam from 'aws-cdk-lib/aws-iam';
import * as kms from 'aws-cdk-lib/aws-kms';
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"Resources": {
"TaggedBucket5A84A2D2": {
"Type": "AWS::S3Tables::TableBucket",
"Properties": {
"TableBucketName": "tagged-table-bucket",
"Tags": [
{
"Key": "Environment",
"Value": "Test"
},
{
"Key": "Project",
"Value": "S3Tables"
}
],
"UnreferencedFileRemoval": {}
},
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
}
},
"Outputs": {
"ExportsOutputFnGetAttTaggedBucket5A84A2D2TableBucketARN325752C1": {
"Value": {
"Fn::GetAtt": [
"TaggedBucket5A84A2D2",
"TableBucketARN"
]
},
"Export": {
"Name": "TaggedTableBucketStack:ExportsOutputFnGetAttTaggedBucket5A84A2D2TableBucketARN325752C1"
}
}
},
"Parameters": {
"BootstrapVersion": {
"Type": "AWS::SSM::Parameter::Value<String>",
"Default": "/cdk-bootstrap/hnb659fds/version",
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
}
},
"Rules": {
"CheckBootstrapVersion": {
"Assertions": [
{
"Assert": {
"Fn::Not": [
{
"Fn::Contains": [
[
"1",
"2",
"3",
"4",
"5"
],
{
"Ref": "BootstrapVersion"
}
]
}
]
},
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
}
]
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading