-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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-elasticsearch] Can't reference existing ES domain from imported values #10841
Comments
@sysopcorner Indeed there is currently a hidden assumption that imported domains are initialized using concrete values. We will look into if this is strictly necessary or can we support tokens here as well. In the meantime, may I ask why are you importing the domain and not passing a reference to the construct from the other stack? i.e: export class DomainStack extends Stack {
public readonly domain: elastic.Domain:
constructor(scope: Construct, id: string) {
this.domain = new elastic.Domain(...);
}
} In your other stack, you can accept the domain, CDK will take care of cross stack references. export class AnotherStack extends Stack {
constructor(scope: Construct, id: string, props: { domain: elastic.Domain }) {
// treat props.domain here as you would if it was created in this stack.
}
} So In your app: const domainStack = new DomainStack(...);
const anotherStack = new AnotherStack(..., { domain: domainStack.domain}); |
@iliapolo I am facing a similar issue when I am trying to import the domain endpoint of ES. |
@GaganBhatia-Amplify I'm not suggesting to use the domain as an input/ouput, simply pass the object reference between the two stacks: export class AnotherStack extends Stack {
constructor(scope: Construct, id: string, props: { domain: elastic.Domain }) {
// this is the reference, accepting it as a normal property.
const domain = props.domain;
// now just use the 'domain` constant exactly as you would if you created if by using `fromDomain...`
}
} |
The static |
My team has a use case to import the Domain so that a Lambda can be granted to it and the url passed via Lambda environment variables. These permissions are rendered on the Lambda's IAM Role. We have several of these lambda stacks and one stack defining the Domain. They are deployed independently. |
+1 |
|
I'm trying to import ES domain from Output values available in another CloudFormation Stack. I'm hitting
jsii.errors.JSIIError: Invalid URL: ${Token[TOKEN.172]}
. When I'm using extracted values directly importing ES works fine. Also note, that similar code works fine in different conditions - eg reference imported securityGroupReproduction Steps
What did you expect to happen?
Import ES domain object from Outputs of another stack.
What actually happened?
Environment
Other
stackTrace:
This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: