1. Packages
  2. Koyeb
Viewing docs for Koyeb v0.1.11
published on Monday, Dec 9, 2024 by Koyeb

Koyeb

koyeb logo
Viewing docs for Koyeb v0.1.11
published on Monday, Dec 9, 2024 by Koyeb
    Try Pulumi Cloud free. Your team will thank you.

    The Koyeb provider for Pulumi can be used to provision any of the cloud resources available in Koyeb.

    To be able to manage Koyeb resources using Pulumi, you first need a Koyeb API access token to allow Pulumi to authenticate to Koyeb. Koyeb API access token credentials can be obtained from the Koyeb Control Panel.

    Example

    import * as koyeb from "@koyeb/pulumi-koyeb";
    
    const koyebApp = new koyeb.App("sample-app", {
      name: "sample-app",
    });
    
    const koyebService = new koyeb.Service("sample-service", {
      appName: koyebApp.name,
      definition: {
        name: "sample-service",
        regions: ["fra"],
        git: {
          repository: "github.com/koyeb/example-golang",
          branch: "main",
        },
        instanceTypes: {
          type: "micro",
        },
        routes: [
          {
            path: "/",
            port: 8080,
          },
        ],
        ports: [
          {
            port: 8080,
            protocol: "http",
          },
        ],
        scalings: {
          min: 1,
          max: 1,
        },
      },
    });
    
    import (
    	"github.com/koyeb/pulumi-koyeb/sdk/go/koyeb"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		app, err := koyeb.App(ctx, "sample-app", &koyeb.AppArgs{
    			Name: pulumi.String("sample-app"),
    		})
    
    		if err != nil {
    			return err
    		}
    
    		_, err = koyeb.NewKoyebService(ctx, "sample-service", &koyeb.ServiceArgs{
    			AppName: app.Name,
    			Definition: &koyeb.ServiceDefinitionArgs{
    				Name: pulumi.String("sample-service"),
    				Regions: pulumi.StringArray{
    					pulumi.String("fra"),
    				},
    				Git: &koyeb.ServiceDefinitionGitArgs{
    					Repository: pulumi.String("github.com/koyeb/example-golang"),
    					Branch:     pulumi.String("main"),
    				},
    				InstanceTypes: &koyeb.ServiceDefinitionInstanceTypesArgs{
    					Type: pulumi.String("micro"),
    				},
    				Routes: koyeb.ServiceDefinitionRouteArray{
    					&koyeb.ServiceDefinitionRouteArgs{
    						Path: pulumi.String("/"),
    						Port: pulumi.Int(8080),
    					},
    				},
    				Ports: koyeb.ServiceDefinitionPortArray{
    					&koyeb.ServiceDefinitionPortArgs{
    						Port:     pulumi.Int(8080),
    						Protocol: pulumi.String("http"),
    					},
    				},
    				Scalings: &koyeb.ServiceDefinitionScalingsArgs{
    					Min: pulumi.Int(1),
    					Max: pulumi.Int(1),
    				},
    			},
    		})
    
    		if err != nil {
    			return err
    		}
    
    		return nil
    	})
    }
    
    import pulumi_koyeb as koyeb
    
    app = koyeb.App("sample-app", name="sample-app")
    
    koyeb.Service("sample-service", app_name=app.name,  definition=koyeb.ServiceDefinitionArgs(
        name="sample-service",
        regions=["fra"],
        git=koyeb.ServiceDefinitionGitArgs(
            repository="github.com/koyeb/example-golang",
            branch="main",
        ),
        instance_types=koyeb.ServiceDefinitionInstanceTypesArgs(
            type="micro",
        ),
        routes=[koyeb.ServiceDefinitionRouteArgs(
            path="/",
            port=8080,
        )],
        ports=[koyeb.ServiceDefinitionPortArgs(
            port=8080,
            protocol="http",
        )],
        scalings=koyeb.ServiceDefinitionScalingsArgs(
            min=1,
            max=1,
        ),
    ))
    
    koyeb logo
    Viewing docs for Koyeb v0.1.11
    published on Monday, Dec 9, 2024 by Koyeb
      Try Pulumi Cloud free. Your team will thank you.