Skip to content
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

(aws-iot-actions-alpha): (IotRepublishMqttAction does not allow 'role' in props) #26351

Closed
dmeehan1968 opened this issue Jul 13, 2023 · 3 comments
Labels
@aws-cdk/aws-iot-actions bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@dmeehan1968
Copy link

Describe the bug

The implementation allows for the instance to carry a role, but the role attribute is not on the IotRepublishMqttActionProps.

Expected Behavior

Role should be permitted on the props

Current Behavior

Role cannot be specified, unless a type cast is used

Reproduction Steps

const myRole = new Role(this, 'role', { assumedBy: new ServicePrincipal('iot.amazonaws.com' })
new IotRepublishMqttAction('errors', { role: myRole })

Possible Solution

Update types

Additional Information/Context

No response

CDK CLI Version

2.87.0

Framework Version

2.87.0-alpha

Node.js Version

18.8.0

OS

macOS 13.4.1

Language

Typescript

Language Version

4.9.5

Other information

No response

@dmeehan1968 dmeehan1968 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jul 13, 2023
@jumic
Copy link
Contributor

jumic commented Jul 13, 2023

I can use the following lines without any error messages.

const myRole = new Role(this, 'role', { assumedBy: new ServicePrincipal('iot.amazonaws.com') })
new IotRepublishMqttAction('errors', { role: myRole })

Can you please show / compare your imports and package.json file?

I am using these imports:

import { Role, ServicePrincipal } from 'aws-cdk-lib/aws-iam';
import { IotRepublishMqttAction } from '@aws-cdk/aws-iot-actions-alpha';

My package.json:

"dependencies": {
  "@aws-cdk/aws-iot-actions-alpha": "^2.87.0-alpha.0",
  "aws-cdk-lib": "2.87.0",
  "constructs": "^10.2.69",
  "source-map-support": "^0.5.21"
}

Maybe you are using import @aws-cdk/aws-iot-actions from CDK v1. You need to use @aws-cdk/aws-iot-actions-alpha for CDK v2.

@dmeehan1968
Copy link
Author

Yes, that is working for me now. Either I was mistyping (seems odd for a 4 letter word) or my IDE was hinting that there was a problem when in fact it wasn't.

I looked at the source, but overlooked that IotRepublishMqttActionProps extends CommonActionProps which is what provides the access.

Apologies.

@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-iot-actions bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

2 participants