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

Invalid type for parameter computeResources.tags.props #7350

Closed
cfriedline opened this issue Apr 14, 2020 · 5 comments · Fixed by #10209
Closed

Invalid type for parameter computeResources.tags.props #7350

cfriedline opened this issue Apr 14, 2020 · 5 comments · Fixed by #10209
Assignees
Labels
@aws-cdk/aws-batch Related to AWS Batch bug This issue is a bug. effort/small Small work item – less than a day of effort in-progress This issue is being actively worked on. p1

Comments

@cfriedline
Copy link

When adding a tag to Batch Compute Resources, the synth succeeds, but does not deploy. The messages written indicate the that parameter validation may be incorrect:

Reference: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-computeenvironment-computeresources.html

Reproduction Steps

Tag without properties

cr = batch.ComputeResources(
            vpc=vpc,
            ec2_key_pair=key_pair,
            compute_resources_tags=Tag("Name", tags[self.lims.env]["Name"]),
            ...
        )

Results in:

Invalid type for parameter computeResources.tags.props, value: {}, type: <type 'dict'>, valid types: <type 'basestring'>

Synth:

Tags:
          key: Name
          props: {}
          defaultPriority: 100
          value: debug-lims-assay-processor

Tag with properties

cr = batch.ComputeResources(
            vpc=vpc,
            ec2_key_pair=key_pair[self.lims.env],
            compute_resources_tags=Tag(
                "Name", tags[self.lims.env]["Name"], apply_to_launched_instances=True
            ),
...

Results in:

Invalid type for parameter computeResources.tags.props, value: {u'applyToLaunchedInstances': u'true'}, type: <type 'dict'>, valid types: <type 'basestring'>

Synth:

Tags:
          key: Name
          props:
            applyToLaunchedInstances: true
          defaultPriority: 100
          value: debug-lims-assay-processor

Error Log

See above...

Environment

  • CLI Version : 1.32.2
  • Framework Version: 1.32.2
  • OS : MacOS
  • Language : Python

This is 🐛 Bug Report

@cfriedline cfriedline added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Apr 14, 2020
@SomayaB SomayaB added the @aws-cdk/aws-batch Related to AWS Batch label Apr 14, 2020
@iliapolo iliapolo added the p1 label May 8, 2020
@SomayaB SomayaB removed the needs-triage This issue or PR still needs to be triaged. label May 19, 2020
@cfriedline
Copy link
Author

Hi there. Thanks for kicking this ticket around in priority. Wondering also if multiple tags could be enabled, as well. The type hint indicates that only a single tag would be permitted.

compute_resources_tags: Optional[Tag] = None,

when

compute_resources_tags: Optional[List[Tag]] = None,

might be more what most people would need.

@iliapolo
Copy link
Contributor

Hi @cfriedline. Yes, baring any unforeseen circumstances, it will be possible to provide multiple tags.

@iliapolo iliapolo added the effort/small Small work item – less than a day of effort label Aug 20, 2020
@rsmogura
Copy link
Contributor

rsmogura commented Sep 3, 2020

Hi,

I'm affected by this issue in TypeScript, too. Workaround for me is tags as unknown as cdk.Tag.

I can try to open patch for this, fix should be easy. However I there are few ways to implement this:

  1. Change the type of computeResourcesTags to plain key-value (string, string) map.
  2. Use Tag
  3. Use Tags (which would require changing this class to add option of constructing it without CDK construct as backend)

@iliapolo
Copy link
Contributor

iliapolo commented Sep 3, 2020

@rsmogura If you could provide a fix that would be great.

Let go with approach number 1?

@rsmogura
Copy link
Contributor

rsmogura commented Sep 3, 2020

Sounds good

rsmogura pushed a commit to rsmogura/aws-cdk that referenced this issue Sep 7, 2020
**Fixes aws#7350**

Use key-value map of tags for `ComputeResources.computeResourcesTags`.

Previously used type `Tag` disallowed adding multiple tags.
rsmogura pushed a commit to rsmogura/aws-cdk that referenced this issue Sep 7, 2020
Use key-value map of tags for `ComputeResources.computeResourcesTags`.

Previously used type `Tag` disallowed adding multiple tags.

**Fixes aws#7350**

BREAKING CHANGE: Changed type of `ComputeResources.computeResourcesTags`
from `Tag` to map (details in fixed issue).
@SomayaB SomayaB added the in-progress This issue is being actively worked on. label Sep 8, 2020
@mergify mergify bot closed this as completed in #10209 Sep 8, 2020
mergify bot pushed a commit that referenced this issue Sep 8, 2020
…10209)

Use key-value map of tags for `ComputeResources.computeResourcesTags`.

Previously used type `Tag` disallowed adding multiple tags.

Fixes #7350

BREAKING CHANGE: Changed type of `ComputeResources.computeResourcesTags` from `Tag` to map


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-batch Related to AWS Batch bug This issue is a bug. effort/small Small work item – less than a day of effort in-progress This issue is being actively worked on. p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants