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

fix(elbv2): Use correct format for parsing imported target group ARNs #22153

Merged
merged 6 commits into from
Sep 23, 2022

Conversation

clareliguori
Copy link
Member

Currently, the following CDK snippet results in outputting the target group ID, not the target group name.

    const importedTgArn = cdk.Fn.importValue('ImportTargetGroupArn');
    const importedTg = elbv2.ApplicationTargetGroup.fromTargetGroupAttributes(stack, 'ImportedTg', {
      targetGroupArn: importedTgArn,
    });
    new cdk.CfnOutput(stack, 'TargetGroupOutput', {
      value: importedTg.targetGroupName,
    });

For example, for a sample target group ARN:

arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/MyTargetGroupName/6a58f7d61e2151d4

The stack above will output 6a58f7d61e2151d4 instead of the desired MyTargetGroupName.

This change fixes the ARN format used for parsing the imported ARN value. It does not impact any existing CDK code passing a raw ARN string (as confirmed by existing unit tests), only CDK code trying to pass tokens such as import values.


All Submissions:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

Sorry, something went wrong.

@gitpod-io
Copy link

gitpod-io bot commented Sep 20, 2022

@aws-cdk-automation aws-cdk-automation requested a review from a team September 20, 2022 19:53
@github-actions github-actions bot added the p2 label Sep 20, 2022
@TheRealAmazonKendra
Copy link
Contributor

FYI - Ignore the PR Linter right now.

@TheRealAmazonKendra
Copy link
Contributor

@Mergifyio update

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@mergify
Copy link
Contributor

mergify bot commented Sep 20, 2022

update

✅ Branch has been successfully updated

corymhall
corymhall previously approved these changes Sep 21, 2022
@corymhall
Copy link
Contributor

@Mergifyio update

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@mergify
Copy link
Contributor

mergify bot commented Sep 21, 2022

update

✅ Branch has been successfully updated

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@mergify mergify bot dismissed corymhall’s stale review September 21, 2022 15:36

Pull request has been modified.

@corymhall
Copy link
Contributor

@Mergifyio update

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@mergify
Copy link
Contributor

mergify bot commented Sep 23, 2022

update

✅ Branch has been successfully updated

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Pull Request Linter fails with the following errors:

❌ Fixes must contain a change to an integration test file and the resulting snapshot.
❌ The title of this pull request does not follow the Conventional Commits format, see https://www.conventionalcommits.org/.

PRs must pass status checks before we can provide a meaningful review.

@corymhall corymhall changed the title fix (elbv2): Use correct format for parsing imported target group ARNs fix(elbv2): Use correct format for parsing imported target group ARNs Sep 23, 2022
@corymhall corymhall added the pr-linter/exempt-integ-test The PR linter will not require integ test changes label Sep 23, 2022
@github-actions github-actions bot dismissed their stale review September 23, 2022 13:21

Pull Request updated. Dissmissing previous PRLinter Review.

@mergify
Copy link
Contributor

mergify bot commented Sep 23, 2022

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: d1442ff
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify mergify bot merged commit 4704d4c into aws:main Sep 23, 2022
@mergify
Copy link
Contributor

mergify bot commented Sep 23, 2022

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@clareliguori clareliguori deleted the fix-imported-tg-arn-format branch September 24, 2022 14:58
homakk pushed a commit to homakk/aws-cdk that referenced this pull request Dec 1, 2022
…aws#22153)

Currently, the following CDK snippet results in outputting the target group ID, not the target group name.

```typescript
    const importedTgArn = cdk.Fn.importValue('ImportTargetGroupArn');
    const importedTg = elbv2.ApplicationTargetGroup.fromTargetGroupAttributes(stack, 'ImportedTg', {
      targetGroupArn: importedTgArn,
    });
    new cdk.CfnOutput(stack, 'TargetGroupOutput', {
      value: importedTg.targetGroupName,
    });
```

For example, for a sample target group ARN:
```
arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/MyTargetGroupName/6a58f7d61e2151d4
```
The stack above will output `6a58f7d61e2151d4` instead of the desired `MyTargetGroupName`.

This change fixes the ARN format used for parsing the imported ARN value.  It does not impact any existing CDK code passing a raw ARN string (as confirmed by existing unit tests), only CDK code trying to pass tokens such as import values.

----

### All Submissions:

* [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

*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
p2 pr-linter/exempt-integ-test The PR linter will not require integ test changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants