Create a Resource Group

Azure Resource Group is a container for resources that are deployed together. Every Azure resource must be assigned to a resource group.

You don't need a storage account for now therefore let's remove the code for creating the storage account. And modify the index.ts looks like that:

import * as pulumi from "@pulumi/pulumi";
import * as resources from "@pulumi/azure-native/resources";

// Create an Azure Resource Group
const resourceGroup = new resources.ResourceGroup("resourceGroup", {
    resourceGroupName: "pulumi-aks-rg"
});

export const resourceGroupName = resourceGroup.name;

Declaring a resource is just calling a constructor of the corresponding type. You assigned the new resource to the variable pulumi-aks-rg to be able to use it for other resources.

circle-info

Note that each resource has two names: a logical one (first constructor argument) and a physical one (name property in the second argument). The logical name is visible in Pulumi console, while the physical name is the actual resource name in Azure. You could omit the name property: then a physical name would be automatically constructed as Logical Name + random suffix.

The location of the resource group is set in the configuration setting azure-native:location (check the Pulumi.dev.yaml file). This is an easy way to set a global location for your program so you don’t have to specify the location for each resource manually.

Apply changes

You changed the program—now it’s time to apply the change to the cloud infrastructure. Run pulumi up command.

Instead of executing the changes immediately, Pulumi shows you a preview of the changes to happen:

$ pulumi up
Previewing update (dev)

     Type                                     Name                     Plan
 +   pulumi:pulumi:Stack                      pulumi-ask-workshop-dev  create
 +   └─ azure-native:resources:ResourceGroup  resourceGroup            create

Outputs:
  + resourceGroupName: output<string>
  
Resources:
    + 2 to create

Do you want to perform this update?  [Use arrows to move, type to filter]
  yes
> no
  details

Select yes in the command prompt to execute the change:

Now make sure that your Resource Group was created successfully:

Last updated