Ibm Provider
Generate Provider
The Ibm provider must be installed as a Local Package by following the instructions for Any Terraform Provider:
pulumi package add terraform-provider ibm-cloud/ibm
Overview
The IBM Cloud provider is used to manage IBM Cloud resources. The provider must be configured with the proper credentials before it can be used.
Use the navigation menu on the left to read about the available functions and resources.
Example usage of provider
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: nodejs
config:
ibm:region:
value: us-south
import * as pulumi from "@pulumi/pulumi";
import * as ibm from "@pulumi/ibm";
// Create a VPC
const testaccVpc = new ibm.IsVpc("testacc_vpc", {name: "test-vpc"});
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: python
config:
ibm:region:
value: us-south
import pulumi
import pulumi_ibm as ibm
# Create a VPC
testacc_vpc = ibm.IsVpc("testacc_vpc", name="test-vpc")
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: dotnet
config:
ibm:region:
value: us-south
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Ibm = Pulumi.Ibm;
return await Deployment.RunAsync(() =>
{
// Create a VPC
var testaccVpc = new Ibm.IsVpc("testacc_vpc", new()
{
Name = "test-vpc",
});
});
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: go
config:
ibm:region:
value: us-south
package main
import (
"github.com/pulumi/pulumi-pulumi-provider/sdks/go/ibm/ibm"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
// Create a VPC
_, err := ibm.NewIsVpc(ctx, "testacc_vpc", &ibm.IsVpcArgs{
Name: pulumi.String("test-vpc"),
})
if err != nil {
return err
}
return nil
})
}
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: yaml
config:
ibm:region:
value: us-south
resources:
# Create a VPC
testaccVpc:
type: ibm:IsVpc
name: testacc_vpc
properties:
name: test-vpc
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: java
config:
ibm:region:
value: us-south
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.ibm.IsVpc;
import com.pulumi.ibm.IsVpcArgs;
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) {
// Create a VPC
var testaccVpc = new IsVpc("testaccVpc", IsVpcArgs.builder()
.name("test-vpc")
.build());
}
}
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: nodejs
config:
ibm:region:
value: us-south
import * as pulumi from "@pulumi/pulumi";
import * as ibm from "@pulumi/ibm";
// Create a VPC
const testaccVpc = new ibm.IsVpc("testacc_vpc", {name: "test-vpc"});
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: python
config:
ibm:region:
value: us-south
import pulumi
import pulumi_ibm as ibm
# Create a VPC
testacc_vpc = ibm.IsVpc("testacc_vpc", name="test-vpc")
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: dotnet
config:
ibm:region:
value: us-south
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Ibm = Pulumi.Ibm;
return await Deployment.RunAsync(() =>
{
// Create a VPC
var testaccVpc = new Ibm.IsVpc("testacc_vpc", new()
{
Name = "test-vpc",
});
});
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: go
config:
ibm:region:
value: us-south
package main
import (
"github.com/pulumi/pulumi-pulumi-provider/sdks/go/ibm/ibm"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
// Create a VPC
_, err := ibm.NewIsVpc(ctx, "testacc_vpc", &ibm.IsVpcArgs{
Name: pulumi.String("test-vpc"),
})
if err != nil {
return err
}
return nil
})
}
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: yaml
config:
ibm:region:
value: us-south
resources:
# Create a VPC
testaccVpc:
type: ibm:IsVpc
name: testacc_vpc
properties:
name: test-vpc
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: java
config:
ibm:region:
value: us-south
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.ibm.IsVpc;
import com.pulumi.ibm.IsVpcArgs;
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) {
// Create a VPC
var testaccVpc = new IsVpc("testaccVpc", IsVpcArgs.builder()
.name("test-vpc")
.build());
}
}
Visiblity support:
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: nodejs
config:
ibm:visibility:
value: private
import * as pulumi from "@pulumi/pulumi";
import * as ibm from "@pulumi/ibm";
// Create a VPC
const testaccVpc = new ibm.IsVpc("testacc_vpc", {name: "test-vpc"});
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: python
config:
ibm:visibility:
value: private
import pulumi
import pulumi_ibm as ibm
# Create a VPC
testacc_vpc = ibm.IsVpc("testacc_vpc", name="test-vpc")
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: dotnet
config:
ibm:visibility:
value: private
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Ibm = Pulumi.Ibm;
return await Deployment.RunAsync(() =>
{
// Create a VPC
var testaccVpc = new Ibm.IsVpc("testacc_vpc", new()
{
Name = "test-vpc",
});
});
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: go
config:
ibm:visibility:
value: private
package main
import (
"github.com/pulumi/pulumi-pulumi-provider/sdks/go/ibm/ibm"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
// Create a VPC
_, err := ibm.NewIsVpc(ctx, "testacc_vpc", &ibm.IsVpcArgs{
Name: pulumi.String("test-vpc"),
})
if err != nil {
return err
}
return nil
})
}
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: yaml
config:
ibm:visibility:
value: private
resources:
# Create a VPC
testaccVpc:
type: ibm:IsVpc
name: testacc_vpc
properties:
name: test-vpc
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: java
config:
ibm:visibility:
value: private
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.ibm.IsVpc;
import com.pulumi.ibm.IsVpcArgs;
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) {
// Create a VPC
var testaccVpc = new IsVpc("testaccVpc", IsVpcArgs.builder()
.name("test-vpc")
.build());
}
}
VPE endpoints support:
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: nodejs
config:
ibm:privateEndpointType:
value: vpe
ibm:visibility:
value: private
import * as pulumi from "@pulumi/pulumi";
import * as ibm from "@pulumi/ibm";
// List Cloud Logs alerts
const alerts = ibm.getLogsAlerts({
instanceId: "logs_instance_guid",
region: "logs_instance_region",
});
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: python
config:
ibm:privateEndpointType:
value: vpe
ibm:visibility:
value: private
import pulumi
import pulumi_ibm as ibm
# List Cloud Logs alerts
alerts = ibm.get_logs_alerts(instance_id="logs_instance_guid",
region="logs_instance_region")
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: dotnet
config:
ibm:privateEndpointType:
value: vpe
ibm:visibility:
value: private
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Ibm = Pulumi.Ibm;
return await Deployment.RunAsync(() =>
{
// List Cloud Logs alerts
var alerts = Ibm.GetLogsAlerts.Invoke(new()
{
InstanceId = "logs_instance_guid",
Region = "logs_instance_region",
});
});
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: go
config:
ibm:privateEndpointType:
value: vpe
ibm:visibility:
value: private
package main
import (
"github.com/pulumi/pulumi-pulumi-provider/sdks/go/ibm/ibm"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
// List Cloud Logs alerts
_, err := ibm.GetLogsAlerts(ctx, &ibm.GetLogsAlertsArgs{
InstanceId: "logs_instance_guid",
Region: pulumi.StringRef("logs_instance_region"),
}, nil)
if err != nil {
return err
}
return nil
})
}
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: yaml
config:
ibm:privateEndpointType:
value: vpe
ibm:visibility:
value: private
variables:
# List Cloud Logs alerts
alerts:
fn::invoke:
function: ibm:getLogsAlerts
arguments:
instanceId: logs_instance_guid
region: logs_instance_region
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: java
config:
ibm:privateEndpointType:
value: vpe
ibm:visibility:
value: private
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.ibm.IbmFunctions;
import com.pulumi.ibm.inputs.GetLogsAlertsArgs;
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) {
// List Cloud Logs alerts
final var alerts = IbmFunctions.getLogsAlerts(GetLogsAlertsArgs.builder()
.instanceId("logs_instance_guid")
.region("logs_instance_region")
.build());
}
}
Example usage of resources:
Example currently unavailable in this language
Example currently unavailable in this language
Example currently unavailable in this language
Example currently unavailable in this language
Example currently unavailable in this language
Example currently unavailable in this language
Authentication
The IBM Cloud provider offers a flexible means of providing credentials for authentication. The following methods are supported, in this order, and explained below:
- Static credentials
- Environment variables
Static credentials
You can provide your static credentials by adding the ibmcloudApiKey
, iaasClassicUsername
, and iaasClassicApiKey
arguments in the IBM Cloud provider configuration.
Usage:
# Pulumi.yaml provider configuration file
name: configuration-example
runtime:
config:
ibm:iaasClassicApiKey:
value: ""
ibm:iaasClassicUsername:
value: ""
ibm:ibmcloudApiKey:
value: ""
Environment variables
You can provide your credentials by exporting the IC_API_KEY
, IAAS_CLASSIC_USERNAME
, and IAAS_CLASSIC_API_KEY
environment variables, representing your IBM Cloud platform API key, IBM Cloud Classic Infrastructure (SoftLayer) user name, and IBM Cloud infrastructure API key, respectively.
# Pulumi.yaml provider configuration file
name: configuration-example
runtime:
Usage:
export IC_API_KEY="ibmcloud_api_key"
export IAAS_CLASSIC_USERNAME="iaas_classic_username"
export IAAS_CLASSIC_API_KEY="iaas_classic_api_key"
pulumi preview
Note:
- Create or find your
ibmcloudApiKey
andiaasClassicApiKey
here.
- Select
My IBM Cloud API Keys
option from view dropdown foribmcloudApiKey
- Select
Classic Infrastructure API Keys
option from view dropdown foriaasClassicApiKey
- For
iaasClassicUsername
- Go to Users
- Click on user.
- Find user name in the
VPN password
section underUser Details
tab
Argument reference
The following configuration inputs are supported in the provider configuration:
ibmcloudApiKey
- (optional) The IBM Cloud platform API key. You must either add it as a credential in the provider configuration or source it from theIC_API_KEY
(higher precedence) orIBMCLOUD_API_KEY
environment variable. The key is required to provision Cloud Foundry or IBM Cloud Container Service resources, such as any resource that begins withibm
oribmContainer
.ibmcloudApiKey
will have higher precedence thanbluemixApiKey
.bluemixApiKey
- (deprecated, optional) The IBM Cloud platform API key. You must either add it as a credential in the provider configuration or source it from theBM_API_KEY
(higher precedence) orBLUEMIX_API_KEY
environment variable. The key is required to provision Cloud Foundry or IBM Cloud Container Service resources, such as any resource that begins withibm
oribmContainer
.ibmcloudTimeout
- (optional) The timeout, expressed in seconds, for interacting with IBM Cloud APIs. You can also source the timeout from theIC_TIMEOUT
(higher precedence) orIBMCLOUD_TIMEOUT
environment variable. The default value is60
.ibmcloudTimeout
will have higher precedence thanbluemixTimeout
.bluemixTimeout
- (deprecated, optional) The timeout, expressed in seconds, for interacting with IBM Cloud APIs. You can also source the timeout from theBM_TIMEOUT
(higher precedence) orBLUEMIX_TIMEOUT
environment variable. The default value is60
.softlayerUsername
- (deprecated, optional) The IBM Cloud Classic Infrastructure (SoftLayer) user name. You must either add it as a credential in the provider configuration or source it from theSL_USERNAME
(higher precedence) orSOFTLAYER_USERNAME
environment variable.iaasClassicUsername
will have higher precedence thansoftlayerUsername
.iaasClassicUsername
- (optional) The IBM Cloud Classic Infrastructure (SoftLayer) user name. You must either add it as a credential in the provider configuration or source it from theIAAS_CLASSIC_USERNAME
environment variable.softlayerApiKey
- (deprecated, optional) The IBM Cloud Classic Infrastructure API key. You must either add it as a credential in the provider configuration or source it from theSL_API_KEY
(higher precedence) orSOFTLAYER_API_KEY
environment variable. The key is required to provision infrastructure resources, such as any resource that begins withibmCompute
.iaasClassicApiKey
will have higher precedence thansoftlayerApiKey
.iaasClassicApiKey
- (optional) The IBM Cloud Classic Infrastructure API key. You must either add it as a credential in the provider configuration or source it from theIAAS_CLASSIC_API_KEY
environment variable.softlayerEndpointUrl
- (deprecated, optional) The IBM Cloud Classic Infrastructure endpoint url. You can also source it from theSL_ENDPOINT_URL
(higher precedence) orSOFTLAYER_ENDPOINT_URL
environment variable.iaasClassicEndpointUrl
will have higher precedence thansoftlayerEndpointUrl
.iaasClassicEndpointUrl
- (optional) The IBM Cloud Classic Infrastructure endpoint url. You can also source it from theIAAS_CLASSIC_ENDPOINT_URL
environment variable. The default value ishttps://api.softlayer.com/rest/v3
.softlayerTimeout
- (optional) The timeout, expressed in seconds, for the IBM Cloud Classic Infrastructure APIs. You can also source the timeout from theSL_TIMEOUT
(higher precedence) orSOFTLAYER_TIMEOUT
environment variable.iaasClassicTimeout
will have higher precedence thansoftlayerTimeout
.iaasClassicTimeout
- (optional) The timeout, expressed in seconds, for the IBM Cloud Clasic Infrastructure APIs. You can also source the timeout from theIAAS_CLASSIC_TIMEOUT
environment variable. The default value is60
.region
- (optional) The IBM Cloud region. You can also source it from theIC_REGION
(higher precedence) orIBMCLOUD_REGION
BM_REGION
BLUEMIX_REGION
environment variable. The default value isus-south
.resourceGroup
- (optional) The Resource Group ID. You can also source it from theIC_RESOURCE_GROUP
(higher precedence) orIBMCLOUD_RESOURCE_GROUP
BM_RESOURCE_GROUP
BLUEMIX_RESOURCE_GROUP
environment variable.maxRetries
- (Optional) This is the maximum number of times an IBM Cloud infrastructure API call is retried, in the case where requests are getting network related timeout and rate limit exceeded error code. You can also source it from theMAX_RETRIES
environment variable. The default value is10
.functionNamespace
- (Optional) Your Cloud Functions namespace is composed from your IBM Cloud org and space like <org>_<space>. This attribute is required only when creating a Cloud Functions resource. It must be provided when you are creating such resources in IBM Cloud. You can also source it from the FUNCTION_NAMESPACE environment variable.riaasEndpoint
- (deprected, Optional) The next generation infrastructure service API endpoint . It can also be sourced from theRIAAS_ENDPOINT
. Default value:us-south.iaas.cloud.ibm.com
.generation
- (deprected, Optional) The generation is deprecated by default the provider targets to the IBM Cloud VPC infrastructure.zone
- (optional) The IBM Cloud zone for a region. You can also source it from theIC_ZONE
(higher precedence) orIBMCLOUD_ZONE
environment variable. This value is required for power resources if the region supports multi-zone. For regioneu-de
it supports two zoneseu-de-1
andeu-de-2
. Set the region and zone for the Power Virtual Server.visibility
- (Optional) The visibility to IBM Cloud endpoint -public
,private
,public-and-private
. Default value:public
. Allowable values arepublic
,private
,public-and-private
.- If visibility is set to
public
, use the regional public endpoint or global public endpoint. The regional public endpoints has higher precedence. - If visibility is set to
private
, use the regional private endpoint or global private endpoint. The regional private endpoint is given higher precedence. In order to use the private endpoint from an IBM Cloud resource (such as, a classic VM instance), one must have VRF-enabled account. If the Cloud service does not support private endpoint, the pulumi resource or function will log an error. - If visibility is set to
public-and-private
, use regional private endpoints or global private endpoint. If service doesn’t support regional or global private endpoints it will use the regional or global public endpoint. - This can also be sourced from the
IC_VISIBILITY
(higher precedence) orIBMCLOUD_VISIBILITY
environment variable.
- If visibility is set to
privateEndpointType
- (Optional) Private Endpoint type used by the service endpoints. Allowable values arevpe
. By default provider targets to cse endpoints when thevisibility
is set toprivate
. If you want to target to vpe private endpoints, setprivateEndpointType
tovpe
.- This can also be sourced from the
IC_PRIVATE_ENDPOINT_TYPE
(higher precedence) orIBMCLOUD_PRIVATE_ENDPOINT_TYPE
environment variable.
- This can also be sourced from the
Note
The CloudFoundry endpoint has been updated in this release of IBM Cloud Pulumi provider v0.17.4. If you are using an earlier version of IBM Cloud Pulumi provider, export the IBMCLOUD_UAA_ENDPOINT
to the new authentication endpoint, as illustrated below
export IBMCLOUD_UAA_ENDPOINT="https://iam.cloud.ibm.com/cloudfoundry/login/<region>/"
References
- IBM Cloud Pulumi Docs