-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(custom_resources): incorrect IAM prefix generated for CloudWatch actions #32968
Comments
Reproducible using CDK version Resources:
CustomResource8CDCD7A7:
Type: Custom::AWS
Properties:
ServiceToken:
Fn::GetAtt:
- AWS679f53fac002430cb0da5b7982bd22872D164C4C
- Arn
Create: '{"service":"CloudWatch","action":"tagResource","parameters":{"ResourceARN":"dummy","Tags":[{"Key":"Name","Value":"prod"}]},"physicalResourceId":{"id":"add_tag"}}'
InstallLatestAwsSdk: false
DependsOn:
- CustomResourceCustomResourcePolicy887CD354
UpdateReplacePolicy: Delete
DeletionPolicy: Delete
Metadata:
aws:cdk:path: CdktestStackNew/CustomResource/Resource/Default
CustomResourceCustomResourcePolicy887CD354:
Type: AWS::IAM::Policy
Properties:
PolicyDocument:
Statement:
- Action: monitoring:TagResource
Effect: Allow
Resource: "*"
Version: "2012-10-17"
PolicyName: CustomResourceCustomResourcePolicy887CD354
Roles:
- Ref: AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2
Metadata:
aws:cdk:path: CdktestStackNew/CustomResource/CustomResourcePolicy/Resource
AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Statement:
- Action: sts:AssumeRole
Effect: Allow
Principal:
Service: lambda.amazonaws.com
Version: "2012-10-17"
ManagedPolicyArns:
- Fn::Join:
- ""
- - "arn:"
- Ref: AWS::Partition
- :iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
Metadata:
aws:cdk:path: CdktestStackNew/AWS679f53fac002430cb0da5b7982bd2287/ServiceRole/Resource
AWS679f53fac002430cb0da5b7982bd22872D164C4C:
Type: AWS::Lambda::Function
Properties:
Code:
S3Bucket: cdk-hnb659fds-assets-<<ACCOUNT-ID>>-us-east-2
S3Key: ce2f3595a340d6c519a65888ef97e3b9b64f053f83608e32cc28162e22d7d99a.zip
Handler: index.handler
Role:
Fn::GetAtt:
- AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2
- Arn
Runtime: nodejs20.x
Timeout: 120
DependsOn:
- AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2
Metadata:
aws:cdk:path: CdktestStackNew/AWS679f53fac002430cb0da5b7982bd2287/Resource
aws:asset:path: asset.ce2f3595a340d6c519a65888ef97e3b9b64f053f83608e32cc28162e22d7d99a
aws:asset:is-bundled: false
aws:asset:property: Code
CDKMetadata:
Type: AWS::CDK::Metadata
Properties:
Analytics: v2:deflate64:H4sIAAAAAAAA/12Oyw6CMBBFv8V9GRWNukUS1wY+gIxlJAOlTZhWYgj/buqDhat75tzcZFLYHg+wWeEoia67xPANptKj7pQO4l1fDSQuDJoEslHytyu+SuEo1WSwv9UIU8m2MeSdvQSrPTurFsjvi5wVYw/T1RnWz1h8qXCG4hlzVrKrUIS8QBZDyQ7OQXfkzyg0q7834uzHC7yHpceGbTMr62qCVtaP7QnSDexXrTAnQ7Cee4Liky/B7auRDQEAAA==
Metadata:
aws:cdk:path: CdktestStackNew/CDKMetadata/Default
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] Findings:
Refer PR #31874 (this is still pending ownership by CDK squad since integration snapshots update need to be done differently) on how to use PR which introduced sdk-v3-metadata.json #27313. It mentions below:
|
Describe the bug
AwsCustomResource in custom_resources generates an incorrect IAM action prefix
monitoring:<action>
for CloudWatch actions. The correct prefix should becloudwatch:<action>
.Regression Issue
Last Known Working CDK Version
No response
Expected Behavior
The generated IAM action prefix should be
cloudwatch:<action>
.https://docs.aws.amazon.com/service-authorization/latest/reference/list_amazoncloudwatch.html
Current Behavior
The generated IAM action prefix is
monitoring:<action>
.Reproduction Steps
Possible Solution
The issue seems to originate in the sdk-v3-metadata.json file, which maps CloudWatch actions to the incorrect prefix monitoring.
https://github.com/aws/aws-cdk/blob/v2.176.0/packages/aws-cdk-lib/custom-resources/lib/helpers-internal/sdk-v3-metadata.json#L198
Additional Information/Context
No response
CDK CLI Version
2.176.0
Framework Version
No response
Node.js Version
v22.8.0
OS
macOS Monterey
Language
TypeScript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: