Skip to content

Commit 7df4a58

Browse files
authored
docs: discourage creation of resource policies (#18227)
Add docs explaining that `addToResourcePolicy()` should be used instead. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent c3c4a97 commit 7df4a58

File tree

5 files changed

+60
-5
lines changed

5 files changed

+60
-5
lines changed

packages/@aws-cdk/aws-logs/lib/policy.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,18 @@ export interface ResourcePolicyProps {
2222
}
2323

2424
/**
25-
* Creates Cloudwatch log group resource policies
25+
* Resource Policy for CloudWatch Log Groups
26+
*
27+
* Policies define the operations that are allowed on this resource.
28+
*
29+
* You almost never need to define this construct directly.
30+
*
31+
* All AWS resources that support resource policies have a method called
32+
* `addToResourcePolicy()`, which will automatically create a new resource
33+
* policy if one doesn't exist yet, otherwise it will add to the existing
34+
* policy.
35+
*
36+
* Prefer to use `addToResourcePolicy()` instead.
2637
*/
2738
export class ResourcePolicy extends Resource {
2839
/**

packages/@aws-cdk/aws-s3/lib/bucket-policy.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,18 @@ export interface BucketPolicyProps {
1919
}
2020

2121
/**
22-
* Applies an Amazon S3 bucket policy to an Amazon S3 bucket.
22+
* The bucket policy for an Amazon S3 bucket
23+
*
24+
* Policies define the operations that are allowed on this resource.
25+
*
26+
* You almost never need to define this construct directly.
27+
*
28+
* All AWS resources that support resource policies have a method called
29+
* `addToResourcePolicy()`, which will automatically create a new resource
30+
* policy if one doesn't exist yet, otherwise it will add to the existing
31+
* policy.
32+
*
33+
* Prefer to use `addToResourcePolicy()` instead.
2334
*/
2435
export class BucketPolicy extends Resource {
2536

packages/@aws-cdk/aws-secretsmanager/lib/policy.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,18 @@ export interface ResourcePolicyProps {
1515
}
1616

1717
/**
18-
* Secret Resource Policy
18+
* Resource Policy for SecretsManager Secrets
19+
*
20+
* Policies define the operations that are allowed on this resource.
21+
*
22+
* You almost never need to define this construct directly.
23+
*
24+
* All AWS resources that support resource policies have a method called
25+
* `addToResourcePolicy()`, which will automatically create a new resource
26+
* policy if one doesn't exist yet, otherwise it will add to the existing
27+
* policy.
28+
*
29+
* Prefer to use `addToResourcePolicy()` instead.
1930
*/
2031
export class ResourcePolicy extends Resource {
2132
/**

packages/@aws-cdk/aws-sns/lib/policy.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,18 @@ export interface TopicPolicyProps {
2121
}
2222

2323
/**
24-
* Applies a policy to SNS topics.
24+
* The policy for an SNS Topic
25+
*
26+
* Policies define the operations that are allowed on this resource.
27+
*
28+
* You almost never need to define this construct directly.
29+
*
30+
* All AWS resources that support resource policies have a method called
31+
* `addToResourcePolicy()`, which will automatically create a new resource
32+
* policy if one doesn't exist yet, otherwise it will add to the existing
33+
* policy.
34+
*
35+
* Prefer to use `addToResourcePolicy()` instead.
2536
*/
2637
export class TopicPolicy extends Resource {
2738
/**

packages/@aws-cdk/aws-sqs/lib/policy.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,18 @@ export interface QueuePolicyProps {
1515
}
1616

1717
/**
18-
* Applies a policy to SQS queues.
18+
* The policy for an SQS Queue
19+
*
20+
* Policies define the operations that are allowed on this resource.
21+
*
22+
* You almost never need to define this construct directly.
23+
*
24+
* All AWS resources that support resource policies have a method called
25+
* `addToResourcePolicy()`, which will automatically create a new resource
26+
* policy if one doesn't exist yet, otherwise it will add to the existing
27+
* policy.
28+
*
29+
* Prefer to use `addToResourcePolicy()` instead.
1930
*/
2031
export class QueuePolicy extends Resource {
2132
/**

0 commit comments

Comments
 (0)