1. Packages
  2. Outscale Provider
  3. API Docs
  4. ApiAccessRule
outscale 1.1.0 published on Thursday, Apr 3, 2025 by outscale

outscale.ApiAccessRule

Explore with Pulumi AI

Manages an API access rule.

For more information on this resource, see the User Guide.
For more information on this resource actions, see the API documentation.

Example Usage

Create an API access rule based on IPs

import * as pulumi from "@pulumi/pulumi";
import * as outscale from "@pulumi/outscale";

const apiAccessRule01 = new outscale.ApiAccessRule("apiAccessRule01", {
    description: "Basic API Access Rule from Terraform",
    ipRanges: [
        "192.0.2.0",
        "192.0.2.0/16",
    ],
});
Copy
import pulumi
import pulumi_outscale as outscale

api_access_rule01 = outscale.ApiAccessRule("apiAccessRule01",
    description="Basic API Access Rule from Terraform",
    ip_ranges=[
        "192.0.2.0",
        "192.0.2.0/16",
    ])
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/outscale/outscale"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := outscale.NewApiAccessRule(ctx, "apiAccessRule01", &outscale.ApiAccessRuleArgs{
			Description: pulumi.String("Basic API Access Rule from Terraform"),
			IpRanges: pulumi.StringArray{
				pulumi.String("192.0.2.0"),
				pulumi.String("192.0.2.0/16"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Outscale = Pulumi.Outscale;

return await Deployment.RunAsync(() => 
{
    var apiAccessRule01 = new Outscale.ApiAccessRule("apiAccessRule01", new()
    {
        Description = "Basic API Access Rule from Terraform",
        IpRanges = new[]
        {
            "192.0.2.0",
            "192.0.2.0/16",
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.outscale.ApiAccessRule;
import com.pulumi.outscale.ApiAccessRuleArgs;
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) {
        var apiAccessRule01 = new ApiAccessRule("apiAccessRule01", ApiAccessRuleArgs.builder()
            .description("Basic API Access Rule from Terraform")
            .ipRanges(            
                "192.0.2.0",
                "192.0.2.0/16")
            .build());

    }
}
Copy
resources:
  apiAccessRule01:
    type: outscale:ApiAccessRule
    properties:
      description: Basic API Access Rule from Terraform
      ipRanges:
        - 192.0.2.0
        - 192.0.2.0/16
Copy

Create an API access rule based on IPs and Certificate Authority (CA)

import * as pulumi from "@pulumi/pulumi";
import * as fs from "fs";
import * as outscale from "@pulumi/outscale";

const ca01 = new outscale.Ca("ca01", {
    caPem: fs.readFileSync("<PATH>", "utf8"),
    description: "Terraform CA",
});
const apiAccessRule02 = new outscale.ApiAccessRule("apiAccessRule02", {
    ipRanges: [
        "192.0.2.0",
        "192.0.2.0/16",
    ],
    caIds: [ca01.caId],
    description: "API Access Rule with CA from Terraform",
});
Copy
import pulumi
import pulumi_outscale as outscale

ca01 = outscale.Ca("ca01",
    ca_pem=(lambda path: open(path).read())("<PATH>"),
    description="Terraform CA")
api_access_rule02 = outscale.ApiAccessRule("apiAccessRule02",
    ip_ranges=[
        "192.0.2.0",
        "192.0.2.0/16",
    ],
    ca_ids=[ca01.ca_id],
    description="API Access Rule with CA from Terraform")
Copy
package main

import (
	"os"

	"github.com/pulumi/pulumi-terraform-provider/sdks/go/outscale/outscale"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func readFileOrPanic(path string) pulumi.StringPtrInput {
	data, err := os.ReadFile(path)
	if err != nil {
		panic(err.Error())
	}
	return pulumi.String(string(data))
}

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		ca01, err := outscale.NewCa(ctx, "ca01", &outscale.CaArgs{
			CaPem:       pulumi.String(readFileOrPanic("<PATH>")),
			Description: pulumi.String("Terraform CA"),
		})
		if err != nil {
			return err
		}
		_, err = outscale.NewApiAccessRule(ctx, "apiAccessRule02", &outscale.ApiAccessRuleArgs{
			IpRanges: pulumi.StringArray{
				pulumi.String("192.0.2.0"),
				pulumi.String("192.0.2.0/16"),
			},
			CaIds: pulumi.StringArray{
				ca01.CaId,
			},
			Description: pulumi.String("API Access Rule with CA from Terraform"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Pulumi;
using Outscale = Pulumi.Outscale;

return await Deployment.RunAsync(() => 
{
    var ca01 = new Outscale.Ca("ca01", new()
    {
        CaPem = File.ReadAllText("<PATH>"),
        Description = "Terraform CA",
    });

    var apiAccessRule02 = new Outscale.ApiAccessRule("apiAccessRule02", new()
    {
        IpRanges = new[]
        {
            "192.0.2.0",
            "192.0.2.0/16",
        },
        CaIds = new[]
        {
            ca01.CaId,
        },
        Description = "API Access Rule with CA from Terraform",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.outscale.Ca;
import com.pulumi.outscale.CaArgs;
import com.pulumi.outscale.ApiAccessRule;
import com.pulumi.outscale.ApiAccessRuleArgs;
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) {
        var ca01 = new Ca("ca01", CaArgs.builder()
            .caPem(Files.readString(Paths.get("<PATH>")))
            .description("Terraform CA")
            .build());

        var apiAccessRule02 = new ApiAccessRule("apiAccessRule02", ApiAccessRuleArgs.builder()
            .ipRanges(            
                "192.0.2.0",
                "192.0.2.0/16")
            .caIds(ca01.caId())
            .description("API Access Rule with CA from Terraform")
            .build());

    }
}
Copy
resources:
  ca01:
    type: outscale:Ca
    properties:
      caPem:
        fn::readFile: <PATH>
      description: Terraform CA
  apiAccessRule02:
    type: outscale:ApiAccessRule
    properties:
      ipRanges:
        - 192.0.2.0
        - 192.0.2.0/16
      caIds:
        - ${ca01.caId}
      description: API Access Rule with CA from Terraform
Copy

Create ApiAccessRule Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new ApiAccessRule(name: string, args?: ApiAccessRuleArgs, opts?: CustomResourceOptions);
@overload
def ApiAccessRule(resource_name: str,
                  args: Optional[ApiAccessRuleArgs] = None,
                  opts: Optional[ResourceOptions] = None)

@overload
def ApiAccessRule(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  ca_ids: Optional[Sequence[str]] = None,
                  cns: Optional[Sequence[str]] = None,
                  description: Optional[str] = None,
                  ip_ranges: Optional[Sequence[str]] = None,
                  outscale_api_access_rule_id: Optional[str] = None)
func NewApiAccessRule(ctx *Context, name string, args *ApiAccessRuleArgs, opts ...ResourceOption) (*ApiAccessRule, error)
public ApiAccessRule(string name, ApiAccessRuleArgs? args = null, CustomResourceOptions? opts = null)
public ApiAccessRule(String name, ApiAccessRuleArgs args)
public ApiAccessRule(String name, ApiAccessRuleArgs args, CustomResourceOptions options)
type: outscale:ApiAccessRule
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args ApiAccessRuleArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args ApiAccessRuleArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args ApiAccessRuleArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args ApiAccessRuleArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. ApiAccessRuleArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var apiAccessRuleResource = new Outscale.ApiAccessRule("apiAccessRuleResource", new()
{
    CaIds = new[]
    {
        "string",
    },
    Cns = new[]
    {
        "string",
    },
    Description = "string",
    IpRanges = new[]
    {
        "string",
    },
    OutscaleApiAccessRuleId = "string",
});
Copy
example, err := outscale.NewApiAccessRule(ctx, "apiAccessRuleResource", &outscale.ApiAccessRuleArgs{
CaIds: pulumi.StringArray{
pulumi.String("string"),
},
Cns: pulumi.StringArray{
pulumi.String("string"),
},
Description: pulumi.String("string"),
IpRanges: pulumi.StringArray{
pulumi.String("string"),
},
OutscaleApiAccessRuleId: pulumi.String("string"),
})
Copy
var apiAccessRuleResource = new ApiAccessRule("apiAccessRuleResource", ApiAccessRuleArgs.builder()
    .caIds("string")
    .cns("string")
    .description("string")
    .ipRanges("string")
    .outscaleApiAccessRuleId("string")
    .build());
Copy
api_access_rule_resource = outscale.ApiAccessRule("apiAccessRuleResource",
    ca_ids=["string"],
    cns=["string"],
    description="string",
    ip_ranges=["string"],
    outscale_api_access_rule_id="string")
Copy
const apiAccessRuleResource = new outscale.ApiAccessRule("apiAccessRuleResource", {
    caIds: ["string"],
    cns: ["string"],
    description: "string",
    ipRanges: ["string"],
    outscaleApiAccessRuleId: "string",
});
Copy
type: outscale:ApiAccessRule
properties:
    caIds:
        - string
    cns:
        - string
    description: string
    ipRanges:
        - string
    outscaleApiAccessRuleId: string
Copy

ApiAccessRule Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The ApiAccessRule resource accepts the following input properties:

CaIds List<string>
One or more IDs of Client Certificate Authorities (CAs).
Cns List<string>
One or more Client Certificate Common Names (CNs). If this parameter is specified, you must also specify the ca_ids parameter.
Description string
A description for the API access rule.
IpRanges List<string>
One or more IPs or CIDR blocks (for example, 192.0.2.0/16).
OutscaleApiAccessRuleId string
CaIds []string
One or more IDs of Client Certificate Authorities (CAs).
Cns []string
One or more Client Certificate Common Names (CNs). If this parameter is specified, you must also specify the ca_ids parameter.
Description string
A description for the API access rule.
IpRanges []string
One or more IPs or CIDR blocks (for example, 192.0.2.0/16).
OutscaleApiAccessRuleId string
caIds List<String>
One or more IDs of Client Certificate Authorities (CAs).
cns List<String>
One or more Client Certificate Common Names (CNs). If this parameter is specified, you must also specify the ca_ids parameter.
description String
A description for the API access rule.
ipRanges List<String>
One or more IPs or CIDR blocks (for example, 192.0.2.0/16).
outscaleApiAccessRuleId String
caIds string[]
One or more IDs of Client Certificate Authorities (CAs).
cns string[]
One or more Client Certificate Common Names (CNs). If this parameter is specified, you must also specify the ca_ids parameter.
description string
A description for the API access rule.
ipRanges string[]
One or more IPs or CIDR blocks (for example, 192.0.2.0/16).
outscaleApiAccessRuleId string
ca_ids Sequence[str]
One or more IDs of Client Certificate Authorities (CAs).
cns Sequence[str]
One or more Client Certificate Common Names (CNs). If this parameter is specified, you must also specify the ca_ids parameter.
description str
A description for the API access rule.
ip_ranges Sequence[str]
One or more IPs or CIDR blocks (for example, 192.0.2.0/16).
outscale_api_access_rule_id str
caIds List<String>
One or more IDs of Client Certificate Authorities (CAs).
cns List<String>
One or more Client Certificate Common Names (CNs). If this parameter is specified, you must also specify the ca_ids parameter.
description String
A description for the API access rule.
ipRanges List<String>
One or more IPs or CIDR blocks (for example, 192.0.2.0/16).
outscaleApiAccessRuleId String

Outputs

All input properties are implicitly available as output properties. Additionally, the ApiAccessRule resource produces the following output properties:

ApiAccessRuleId string
The ID of the API access rule.
Id string
The provider-assigned unique ID for this managed resource.
RequestId string
ApiAccessRuleId string
The ID of the API access rule.
Id string
The provider-assigned unique ID for this managed resource.
RequestId string
apiAccessRuleId String
The ID of the API access rule.
id String
The provider-assigned unique ID for this managed resource.
requestId String
apiAccessRuleId string
The ID of the API access rule.
id string
The provider-assigned unique ID for this managed resource.
requestId string
api_access_rule_id str
The ID of the API access rule.
id str
The provider-assigned unique ID for this managed resource.
request_id str
apiAccessRuleId String
The ID of the API access rule.
id String
The provider-assigned unique ID for this managed resource.
requestId String

Look up Existing ApiAccessRule Resource

Get an existing ApiAccessRule resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: ApiAccessRuleState, opts?: CustomResourceOptions): ApiAccessRule
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        api_access_rule_id: Optional[str] = None,
        ca_ids: Optional[Sequence[str]] = None,
        cns: Optional[Sequence[str]] = None,
        description: Optional[str] = None,
        ip_ranges: Optional[Sequence[str]] = None,
        outscale_api_access_rule_id: Optional[str] = None,
        request_id: Optional[str] = None) -> ApiAccessRule
func GetApiAccessRule(ctx *Context, name string, id IDInput, state *ApiAccessRuleState, opts ...ResourceOption) (*ApiAccessRule, error)
public static ApiAccessRule Get(string name, Input<string> id, ApiAccessRuleState? state, CustomResourceOptions? opts = null)
public static ApiAccessRule get(String name, Output<String> id, ApiAccessRuleState state, CustomResourceOptions options)
resources:  _:    type: outscale:ApiAccessRule    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
ApiAccessRuleId string
The ID of the API access rule.
CaIds List<string>
One or more IDs of Client Certificate Authorities (CAs).
Cns List<string>
One or more Client Certificate Common Names (CNs). If this parameter is specified, you must also specify the ca_ids parameter.
Description string
A description for the API access rule.
IpRanges List<string>
One or more IPs or CIDR blocks (for example, 192.0.2.0/16).
OutscaleApiAccessRuleId string
RequestId string
ApiAccessRuleId string
The ID of the API access rule.
CaIds []string
One or more IDs of Client Certificate Authorities (CAs).
Cns []string
One or more Client Certificate Common Names (CNs). If this parameter is specified, you must also specify the ca_ids parameter.
Description string
A description for the API access rule.
IpRanges []string
One or more IPs or CIDR blocks (for example, 192.0.2.0/16).
OutscaleApiAccessRuleId string
RequestId string
apiAccessRuleId String
The ID of the API access rule.
caIds List<String>
One or more IDs of Client Certificate Authorities (CAs).
cns List<String>
One or more Client Certificate Common Names (CNs). If this parameter is specified, you must also specify the ca_ids parameter.
description String
A description for the API access rule.
ipRanges List<String>
One or more IPs or CIDR blocks (for example, 192.0.2.0/16).
outscaleApiAccessRuleId String
requestId String
apiAccessRuleId string
The ID of the API access rule.
caIds string[]
One or more IDs of Client Certificate Authorities (CAs).
cns string[]
One or more Client Certificate Common Names (CNs). If this parameter is specified, you must also specify the ca_ids parameter.
description string
A description for the API access rule.
ipRanges string[]
One or more IPs or CIDR blocks (for example, 192.0.2.0/16).
outscaleApiAccessRuleId string
requestId string
api_access_rule_id str
The ID of the API access rule.
ca_ids Sequence[str]
One or more IDs of Client Certificate Authorities (CAs).
cns Sequence[str]
One or more Client Certificate Common Names (CNs). If this parameter is specified, you must also specify the ca_ids parameter.
description str
A description for the API access rule.
ip_ranges Sequence[str]
One or more IPs or CIDR blocks (for example, 192.0.2.0/16).
outscale_api_access_rule_id str
request_id str
apiAccessRuleId String
The ID of the API access rule.
caIds List<String>
One or more IDs of Client Certificate Authorities (CAs).
cns List<String>
One or more Client Certificate Common Names (CNs). If this parameter is specified, you must also specify the ca_ids parameter.
description String
A description for the API access rule.
ipRanges List<String>
One or more IPs or CIDR blocks (for example, 192.0.2.0/16).
outscaleApiAccessRuleId String
requestId String

Import

An API access rule can be imported using its ID. For example:

console

$ pulumi import outscale:index/apiAccessRule:ApiAccessRule ImportedAPIAccessRule "aar-12345678"
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
outscale outscale/terraform-provider-outscale
License
Notes
This Pulumi package is based on the outscale Terraform Provider.