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

events_targets: AttributeError: module 'aws_cdk.aws_events_targets' has no attribute 'Tag' #27338

Closed
pascalgulikers opened this issue Sep 28, 2023 · 3 comments
Labels
@aws-cdk/aws-events-targets bug This issue is a bug. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@pascalgulikers
Copy link

pascalgulikers commented Sep 28, 2023

Describe the bug

When trying to use Tag (https://docs.aws.amazon.com/cdk/api/v2/python/aws_cdk.aws_events_targets/Tag.html#aws_cdk.aws_events_targets.Tag), it is not recognized and an error is thrown: AttributeError: module 'aws_cdk.aws_events_targets' has no attribute 'Tag'

Expected Behavior

No error, but the processing of tags

Current Behavior

Exception with error

Reproduction Steps

from aws_cdk import (
    aws_events as events,
    aws_events_targets as events_targets
)

rule = events.Rule(self, "Rule",
    schedule=events.Schedule.expression(job_schedule)
)

rule.add_target(events_targets.EcsTask(
    cluster=cluster,
    enable_execute_command=True,
    task_definition=task_definition,
    task_count=1,
    container_overrides=[events_targets.ContainerOverride(
        container_name="appContainer",
        command=command
    )],
    tags=events_targets.Tag(
        key="type",
        value="job"
    )
))

Result:

tags=events_targets.Tag(
         ^^^^^^^^^^^^^^^^^^
AttributeError: module 'aws_cdk.aws_events_targets' has no attribute 'Tag'

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.99.0

Framework Version

No response

Node.js Version

18

OS

Ubuntu Linux

Language

Python

Language Version

3.11.5

Other information

No response

@pascalgulikers pascalgulikers added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Sep 28, 2023
@pascalgulikers pascalgulikers changed the title event_targets: AttributeError: module 'aws_cdk.aws_events_targets' has no attribute 'Tag' events_targets: AttributeError: module 'aws_cdk.aws_events_targets' has no attribute 'Tag' Sep 28, 2023
@khushail khushail added investigating This issue is being investigated and/or work is in progress to resolve the issue. and removed needs-triage This issue or PR still needs to be triaged. labels Sep 28, 2023
@khushail
Copy link
Contributor

khushail commented Sep 28, 2023

@pascalgulikers , could you try adding tags like this instead of the above mentioned -

        tags = [event_targets.Tag(
            key="my-tag",
            value="my-tag-value"
        )]

Let me know if it works.

@khushail khushail added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. labels Sep 28, 2023
@peterwoodworth
Copy link
Contributor

@pascalgulikers you'll need to supply it as an array like described above, but that's not what would result in the error you've seen. It seems to me like your packages might not be installed correctly on the version you described, try making sure your installed packages are up to date and the property should exist, it works for me on recent versions, including the latest

@peterwoodworth peterwoodworth added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. labels Sep 28, 2023
@github-actions
Copy link

github-actions bot commented Oct 1, 2023

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Oct 1, 2023
@github-actions github-actions bot added closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Oct 6, 2023
@github-actions github-actions bot closed this as completed Oct 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-events-targets bug This issue is a bug. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

3 participants