-
Notifications
You must be signed in to change notification settings - Fork 456
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
Cross Stack References #651
Comments
Does anyone know of a temporary alternative method of passing references between stacks? |
I think the nicest solution currently would be using DataSources to get a reference to an object into another stack. For this you need to have the name and type of the element you want to transfer. The name can be a global constant so that it can be used by the resource and data source. const clusterName = "my-cluster"
class InfrastructureLayer extends TerraformStack {
constructor(scope: Construct, name: string) {
super(scope, name);
new GKECluster(this, "doesNotMatter", {
name: clusterName,
// ...
})
}
}
class ApplicationLayer extends TerraformStack {
constructor(scope: Construct, name: string) {
super(scope, name);
// This will fail if the cluster does not exist already
new DataGKECluster(this, "doesNotMatter", {
name: clusterName,
// ...
})
}
}
const app = new App();
new InfrastructureLayer(app, "infrastructure");
new ApplicationLayer(app, "development"); |
Another option is to write the value you want to refer to into an output and read that value from a remote state in the other stack. |
Is this work-around supported within Python? I'm getting the following error when attempting to use a "Data Source" for a Python Lambda Layer Version.
|
You want |
Here is a POC around this topic I did, for those interested: #1179 |
From discussion, this can be broken down into two separate issues:
We plan to tackle this part first, then we'll circle around to the CLI workflows once the core functionality is in place. |
I'm going to lock this issue because it has been closed for 30 days. This helps our maintainers find and focus on the active issues. If you've found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Community Note
Description
With #636 we've introduced multiple stacks. We should enable referencing resources across stacks.
References
The text was updated successfully, but these errors were encountered: