Pulumi: Deploying an AWS Service Catalog product

AWS pulumi Service Catalog product

2 min read | by Jordi Prats

Pulumi can also be used to deploy AWS Service Catalog products. It won't be shocking to see that the code is going to be very similar to what's required to deploy an AWS Service Catalog product using terraform, since at the end of the day pulumi is going to use the terraform-aws provider.

In this example we are going to use golang to deploy a product in AWS Service Catalog using Pulumi:

package main

import (
  "github.com/pulumi/pulumi-aws/sdk/v5/go/aws/servicecatalog"
  "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
  pulumi.Run(func(ctx *pulumi.Context) error {
    _, err := servicecatalog.NewProvisionedProduct(ctx, "pulumis3", &servicecatalog.ProvisionedProductArgs{
      ProductName:              pulumi.String("S3Bucket"),
      ProvisioningArtifactName: pulumi.String("1.2.3"),
      ProvisioningParameters: servicecatalog.ProvisionedProductProvisioningParameterArray{
        &servicecatalog.ProvisionedProductProvisioningParameterArgs{
          Key:   pulumi.String("BucketName"),
          Value: pulumi.String("demos3bucket"),
        },
      },
      Tags: pulumi.StringMap{
        "an": pulumi.String("example"),
      },
    })

    if err != nil {
      return err
    }

    return nil
  })
}

Just as with the terraform example, we are creating a new instance of the product named S3Bucket with the version 1.2.3. The product requires a parameter named BucketName with the value demos3bucket. We are also adding a tag to the product with the key an and the value example. All of this is done using the servicecatalog.ProvisionedProduct resource.


Posted on 10/09/2024

Categories