Hello all, I am using Pulumi for the first time fo...
# getting-started
m
Hello all, I am using Pulumi for the first time for a project hosted in Azure cloud. I am using Typescript for programming the resources. I currently have the following scenario: A project with a stack named ‘dev’ that creates a ResourceGroup in Azure. The code is as follows: Another project with a stack named ‘dev’ that should create a MariaDB database and map it to the ResourceGroup just created in the other projet. My current code is this:
Copy code
export 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.
Copy code
// 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.
w
See thread in #azure
1