Hi. I wanted to ignore other tag key-value pairs (...
# typescript
j
Hi. I wanted to ignore other tag key-value pairs (not set by pulumi) on an azure resourcegroup. The only way i found was to query the existing Tags on the resourcegroup (if exists) and create a combined tag-set.
Copy code
let tags: { [key: string]: string } = {
    foo: "abc",
    bar: "def"
}
const existingRG = azure.resources.getResourceGroup({ resourceGroupName: args.rgName }, options)
const combinedTags = existingRG.then(t => {
    const existingTags = t.tags || {}
    Object.keys(tags).forEach(k => {
        existingTags[k] = tags[k]
    })
    return existingTags
}).catch(e => {
    console.warn(`Failed to retrieve resource group: ${e.message}.`);
    return tags
})
I tried setting ignoreChanges to "tags", but that would disable "drift-detection" on the important tags configured by pulumi. Is there a simpler way to achieve this? I also have the problem that removing tags is not that easy and needs additional logic. Unfortunatly I did not found a way to access the state(stack-state) that was applied to azure during the last "pulumi up".