Search code examples
azurepulumi

Pulumi is creating an azure resource group with a different name


Why Pulumi is not creating a resource group with the name I gave?

Here is my small script

const azure = require("@pulumi/azure")

const resourceGroupName = new azure.core.ResourceGroup("test-pulumi", {
    location: "francecentral",
});

The name of the resource group is: test-pulumi83d54581


Solution

  • The name parameter that you give is your component's name, not the full name of the resource to be created. By default, Pulumi appends a suffix to all names to avoid name collision e.g. across multiple stacks.

    To specify the name explicitly, pass it as options parameter:

    const resourceGroupName = new azure.core.ResourceGroup("test-pulumi", {
        name: "test-pulumi",
        location: "francecentral",
    });
    

    That's a bit verbose, and we might get an option to disable name suffixes - see this issue for progress.