Pulumi Converter Bicep banner
pulumi pulumi

Pulumi Converter Bicep

Development community

Description

A Pulumi converter plugin to convert Bicep code to Pulumi languages

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

pulumi-converter-bicep

A Pulumi converter plugin to convert Bicep code to Pulumi languages. Currently work in progress.

Installation

Install the plugin from Github releases using the following command

pulumi plugin install converter bicep

Usage

Run the following command in the directory where your Bicep files are located

pulumi convert --from bicep --language  --out pulumi -- --entry 

Will convert Bicep code into your language of choice: `typescript`, `csharp`, `python`, `go`, `java` or `yaml`

Note that if you don't specify the `--entry` flag, the converter will look for the first file in the current directory which has the `.bicep` extension.

Example

resource storage 'Microsoft.Storage/storageAccounts@2022-09-01' = {
  name: 'storageaccount'
  location: resourceGroup().location
  kind: 'StorageV2'
  sku: {
    name: 'Standard_LRS'
  }
}

Converts to `typescript`

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

const config = new pulumi.Config();
// The name of the resource group to operate on
const resourceGroupName = config.require("resourceGroupName");
const currentResourceGroup = azure_native.resources.getResourceGroupOutput({
    resourceGroupName: resourceGroupName,
});
const storage = new azure_native.storage.StorageAccount("storageaccount", {
    accountName: "storageaccount",
    kind: "StorageV2",
    location: currentResourceGroup.apply(currentResourceGroup => currentResourceGroup.location),
    resourceGroupName: currentResourceGroup.apply(currentResourceGroup => currentResourceGroup.name),
    sku: {
        name: "Standard_LRS",
    },
});

or to `csharp`

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;

return await Deployment.RunAsync(() => 
{
    var config = new Config();
    // The name of the resource group to operate on
    var resourceGroupNam