A Pulumi converter plugin to convert Bicep code to Pulumi languages. Currently work in progress.
Install the plugin from Github releases using the following command
pulumi plugin install converter bicep
Run the following command in the directory where your Bicep files are located
pulumi convert --from bicep --language <language> --out pulumi -- --entry <entry-file>
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.
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 resourceGroupName = config.Require("resourceGroupName");
var currentResourceGroup = AzureNative.Resources.GetResourceGroup.Invoke(new()
{
ResourceGroupName = resourceGroupName,
});
var storage = new AzureNative.Storage.StorageAccount("storageaccount", new()
{
AccountName = "storageaccount",
Kind = "StorageV2",
Location = currentResourceGroup.Apply(getResourceGroupResult => getResourceGroupResult.Location),
ResourceGroupName = currentResourceGroup.Apply(getResourceGroupResult => getResourceGroupResult.Name),
Sku = new AzureNative.Storage.Inputs.SkuArgs
{
Name = "Standard_LRS",
},
});
});
The following commands are available which you can run inside the root directory of the repo.
dotnet run build
dotnet run tests
dotnet run integration-tests