Control Plane Provider
Installation
The Control Plane provider is available as a package in all Pulumi languages:
- JavaScript/TypeScript:
@pulumiserve/cpln - Python:
pulumiverse-cpln - Go:
github.com/pulumiverse/pulumi-cpln/sdk/go/cpln - .NET:
Pulumiverse.cpln
Overview
The Control Plane Pulumi Provider Plugin enables the scaffolding of any Control Plane object as code using HCL. It enables infrastructure as code with all the added benefit of the global virtual cloud (GVC). You can build your VPCs, subnets, databases, queues, caches, etc. and overlay them with a multi-cloud/multi-region universal compute workloads that span regions and clouds. Nearly everything you can do using the Control Plane CLI, UI or API is available using Pulumi.
Each header below (i.e., cpln.Agent) corresponds to a resource within the Control Plane Pulumi provider.
Authentication
Authenticate using one of the following methods:
1. CLI
- Install the CLI and execute the command
cpln login. After a successful login, the Pulumi provider will use thedefaultprofile to authenticate. To use a different profile, set theprofilevariable when initializing the provider or set theCPLN_PROFILEenvironment variable.
2. Token
- The
tokenvariable can be set when initializing the provider or by setting theCPLN_TOKENenvironment variable. - The value of
tokencan be either:- The output of running the command
cpln profile token PROFILE_NAME, or - In the case of a Service Account, the value of one of it’s keys
- The output of running the command
3. Refresh Token
- The
refreshTokenvariable is used when the provider is required to create an org or update theauthConfigproperty using thecpln.Orgresource. TherefreshTokenvariable can be set when initializing the provider or by setting theCPLN_REFRESH_TOKENenvironment variable. - When creating an org, the
refreshTokenmust belong to a user that has theorgCreatorrole for the associated account. - When updating the org
authConfigproperty, therefreshTokenmust belong to a user that was authenticated using SAML. - The
refreshTokencan be obtained by following these steps:- Using the CLI, authenticate with a user account by executing
cpln login. - Browser to the path
~/.config/cpln/profiles. This path will contain JSON files corresponding to the name of the profile (i.e.,default.json). - The contents of the JSON file will contain a key named
refreshToken. Use the value of this key for therefreshTokenvariable.
- Using the CLI, authenticate with a user account by executing
Note To perform automated tasks using Pulumi, the preferred method is to use a
Service Accountand one of it’skeysas thetokenvalue.
Provider Declaration
Required
org (String) The Control Plane org that this provider will perform actions against. Can be specified with the
CPLN_ORGenvironment variable.endpoint (String) The Control Plane Data Service API endpoint. Default is:
https://api.cpln.io. Can be specified with theCPLN_ENDPOINTenvironment variable.profile (String) The user/service account profile that this provider will use to authenticate to the data service. Can be specified with the
CPLN_PROFILEenvironment variable.token (String) A generated token that can be used to authenticate to the data service API. Can be specified with the
CPLN_TOKENenvironment variable.refresh_token (String) A generated token that can be used to authenticate to the data service API. Can be specified with the
CPLN_REFRESH_TOKENenvironment variable. Used when the provider is required to create an org or update theauthConfigproperty. Refer to the section above on how to obtain the refresh token.
Note If the
tokenorrefreshTokenvalue is empty, the Control Plane CLI (cpln) must be installed and thecpln logincommand must be used to authenticate.
Example Usage
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: nodejs
config:
cpln:endpoint:
value: "TODO: var.endpoint"
cpln:org:
value: "TODO: var.org"
cpln:profile:
value: "TODO: var.profile"
cpln:refreshToken:
value: "TODO: var.refresh_token"
cpln:token:
value: "TODO: var.token"
import * as pulumi from "@pulumi/pulumi";
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: python
config:
cpln:endpoint:
value: "TODO: var.endpoint"
cpln:org:
value: "TODO: var.org"
cpln:profile:
value: "TODO: var.profile"
cpln:refreshToken:
value: "TODO: var.refresh_token"
cpln:token:
value: "TODO: var.token"
import pulumi
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: dotnet
config:
cpln:endpoint:
value: "TODO: var.endpoint"
cpln:org:
value: "TODO: var.org"
cpln:profile:
value: "TODO: var.profile"
cpln:refreshToken:
value: "TODO: var.refresh_token"
cpln:token:
value: "TODO: var.token"
using System.Collections.Generic;
using System.Linq;
using Pulumi;
return await Deployment.RunAsync(() =>
{
});
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: go
config:
cpln:endpoint:
value: "TODO: var.endpoint"
cpln:org:
value: "TODO: var.org"
cpln:profile:
value: "TODO: var.profile"
cpln:refreshToken:
value: "TODO: var.refresh_token"
cpln:token:
value: "TODO: var.token"
package main
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
return nil
})
}
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: yaml
config:
cpln:endpoint:
value: "TODO: var.endpoint"
cpln:org:
value: "TODO: var.org"
cpln:profile:
value: "TODO: var.profile"
cpln:refreshToken:
value: "TODO: var.refresh_token"
cpln:token:
value: "TODO: var.token"
{}
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: java
config:
cpln:endpoint:
value: "TODO: var.endpoint"
cpln:org:
value: "TODO: var.org"
cpln:profile:
value: "TODO: var.profile"
cpln:refreshToken:
value: "TODO: var.refresh_token"
cpln:token:
value: "TODO: var.token"
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
}
}
