mysterious-piano-88140
09/14/2021, 7:34 PMexport const databaseResourceGroup = new ResourceGroup(
'resource-group-dev',
{
resourceGroupName: 'resource-group-dev',
location: 'germanywestcentral',
tags: {
project: 'test',
env: 'dev',
type: 'resourcegroup'
}
}
)
My problem is that in the second project the ResourceGroup is not linked no matter how (getResourceGroup, Import, StackReference) but is always recreated, which leads to a fail because it just already exists.
// const resourceGroup = await getResourceGroup({
// resourceGroupName: databaseResourceGroupName
// })
const resourceGroup = new ResourceGroup(
'resource-group-dev',
{
resourceGroupName: 'resource-group-dev',
location: 'germanywestcentral',
tags: {
project: 'test',
env: 'dev',
type: 'resourcegroup'
}
},
{
import: `/subscriptions/<subscription-id>/resourceGroups/<resourcegroupname>`
}
)
Do any of you here have an idea how I can link between resources without recreating them.
I would now expect a similar pattern as in the AWS CDK where I can access ARN with from methods.witty-candle-66007
09/14/2021, 8:00 PMnew ResourceGroup
in the second project. You just want to use the resource group that was created in the first stack.
So, the second project only needs a declaration for the MariaDB resource that references the name of the resource group created in the first project/stack.
You can use Stack References to allow the second stack to get the resource group name from the first stack (instead of hard-coding the name across both stacks): https://www.pulumi.com/docs/intro/concepts/stack/#stackreferences