Example Usage#

{{< chooser language "typescript,python,go,csharp" >}} {{% choosable language typescript %}}

# Pulumi.yaml provider configuration file
name: configuration-example
runtime: nodejs
config:
    statsig:consoleApiKey:
        value: 'TODO: var.console_api_key'
 
import * as pulumi from "@pulumi/pulumi";
import * as statsig from "@statsig/pulumi-statsig";
 
// Create a Feature Gate
const gate = new Statsig.Gate("my-gate", {});

{{% /choosable %}} {{% choosable language python %}}

# Pulumi.yaml provider configuration file
name: configuration-example
runtime: python
config:
    statsig:consoleApiKey:
        value: 'TODO: var.console_api_key'
 
import pulumi
import pulumi_statsig as statsig
 
# Create a Feature Gate
gate = statsig.Gate("my-gate")

{{% /choosable %}} {{% choosable language csharp %}}

# Pulumi.yaml provider configuration file
name: configuration-example
runtime: dotnet
config:
    statsig:consoleApiKey:
        value: 'TODO: var.console_api_key'
 
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Statsig = Statsig.Pulumi;
 
return await Deployment.RunAsync(() =>
{
    // Create a Feature Gate
    var gate = new Statsig.Gate("my-gate");
 
});
 

{{% /choosable %}} {{% choosable language go %}}

# Pulumi.yaml provider configuration file
name: configuration-example
runtime: go
config:
    statsig:consoleApiKey:
        value: 'TODO: var.console_api_key'
 
package main
 
import (
  "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/statsig-io/pulumi-statsig/sdk/go/statsig"
)
 
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		// Create a Feature Gate
		_, err := statsig.NewGate(ctx, "my-gate", nil)
		if err != nil {
			return err
		}
		return nil
	})
}

{{% /choosable %}} {{< /chooser >}}

Updated

Was this page helpful?