Skip to content

(core): stack.exportValue() does not work with ref parameters #13002

@juanqui

Description

@juanqui

The new stack.exportValue() feature introduced in #12778 does not seem to work with resource parameters that would be referenced by Ref rather than GetAtt.

Reproduction Steps

const someSampleRole = new iam.Role(this, 'SomeSampleRole', {});
this.exportValue(someSampleRole.roleName);

Results in: Error: exportValue: either supply 'name' or make sure to export a resource attribute (like 'bucket.bucketName')

What did you expect to happen?

Trying to break a deadly embrace where I used the roleName and roleArn in another stack. The roleArn is a GetAtt and the roleName is actually a Ref. The roleArn worked great, but roleName will not synthesize without me specifying the full export name which looks something like STACK_NAME:ExportsOutputRefSomeSampleRole1D3A83A01C1B4250.

What actually happened?

Error: Error: exportValue: either supply 'name' or make sure to export a resource attribute (like 'bucket.bucketName')

Environment

  • CDK CLI Version : 1.88.0
  • Framework Version: 1.88.0
  • Node.js Version: v10.23.2
  • OS : Amazon Linux 2
  • Language (Version): TypeScript (3.8.3)

Other

N/A


This is 🐛 Bug Report

Metadata

Metadata

Assignees

Labels

@aws-cdk/coreRelated to core CDK functionalitybugThis issue is a bug.needs-triageThis issue or PR still needs to be triaged.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions