1. Packages
  2. Ucloud Provider
  3. API Docs
  4. LbSslAttachment
ucloud 1.39.1 published on Monday, Apr 14, 2025 by ucloud

ucloud.LbSslAttachment

Explore with Pulumi AI

Provides a Load Balancer SSL attachment resource for attaching SSL certificate to Load Balancer Listener.

Example Usage

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

const fooLb = new ucloud.Lb("fooLb", {tag: "tf-example"});
const fooLbListener = new ucloud.LbListener("fooLbListener", {
    loadBalancerId: fooLb.lbId,
    protocol: "https",
});
const fooLbSsl = new ucloud.LbSsl("fooLbSsl", {
    privateKey: fs.readFileSync("private.key", "utf8"),
    userCert: fs.readFileSync("user.crt", "utf8"),
    caCert: fs.readFileSync("ca.crt", "utf8"),
});
const fooLbSslAttachment = new ucloud.LbSslAttachment("fooLbSslAttachment", {
    loadBalancerId: fooLb.lbId,
    listenerId: fooLbListener.lbListenerId,
    sslId: fooLbSsl.lbSslId,
});
Copy
import pulumi
import pulumi_ucloud as ucloud

foo_lb = ucloud.Lb("fooLb", tag="tf-example")
foo_lb_listener = ucloud.LbListener("fooLbListener",
    load_balancer_id=foo_lb.lb_id,
    protocol="https")
foo_lb_ssl = ucloud.LbSsl("fooLbSsl",
    private_key=(lambda path: open(path).read())("private.key"),
    user_cert=(lambda path: open(path).read())("user.crt"),
    ca_cert=(lambda path: open(path).read())("ca.crt"))
foo_lb_ssl_attachment = ucloud.LbSslAttachment("fooLbSslAttachment",
    load_balancer_id=foo_lb.lb_id,
    listener_id=foo_lb_listener.lb_listener_id,
    ssl_id=foo_lb_ssl.lb_ssl_id)
Copy
package main

import (
	"os"

	"github.com/pulumi/pulumi-terraform-provider/sdks/go/ucloud/ucloud"
	"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 {
		fooLb, err := ucloud.NewLb(ctx, "fooLb", &ucloud.LbArgs{
			Tag: pulumi.String("tf-example"),
		})
		if err != nil {
			return err
		}
		fooLbListener, err := ucloud.NewLbListener(ctx, "fooLbListener", &ucloud.LbListenerArgs{
			LoadBalancerId: fooLb.LbId,
			Protocol:       pulumi.String("https"),
		})
		if err != nil {
			return err
		}
		fooLbSsl, err := ucloud.NewLbSsl(ctx, "fooLbSsl", &ucloud.LbSslArgs{
			PrivateKey: pulumi.String(readFileOrPanic("private.key")),
			UserCert:   pulumi.String(readFileOrPanic("user.crt")),
			CaCert:     pulumi.String(readFileOrPanic("ca.crt")),
		})
		if err != nil {
			return err
		}
		_, err = ucloud.NewLbSslAttachment(ctx, "fooLbSslAttachment", &ucloud.LbSslAttachmentArgs{
			LoadBalancerId: fooLb.LbId,
			ListenerId:     fooLbListener.LbListenerId,
			SslId:          fooLbSsl.LbSslId,
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Pulumi;
using Ucloud = Pulumi.Ucloud;

return await Deployment.RunAsync(() => 
{
    var fooLb = new Ucloud.Lb("fooLb", new()
    {
        Tag = "tf-example",
    });

    var fooLbListener = new Ucloud.LbListener("fooLbListener", new()
    {
        LoadBalancerId = fooLb.LbId,
        Protocol = "https",
    });

    var fooLbSsl = new Ucloud.LbSsl("fooLbSsl", new()
    {
        PrivateKey = File.ReadAllText("private.key"),
        UserCert = File.ReadAllText("user.crt"),
        CaCert = File.ReadAllText("ca.crt"),
    });

    var fooLbSslAttachment = new Ucloud.LbSslAttachment("fooLbSslAttachment", new()
    {
        LoadBalancerId = fooLb.LbId,
        ListenerId = fooLbListener.LbListenerId,
        SslId = fooLbSsl.LbSslId,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.ucloud.Lb;
import com.pulumi.ucloud.LbArgs;
import com.pulumi.ucloud.LbListener;
import com.pulumi.ucloud.LbListenerArgs;
import com.pulumi.ucloud.LbSsl;
import com.pulumi.ucloud.LbSslArgs;
import com.pulumi.ucloud.LbSslAttachment;
import com.pulumi.ucloud.LbSslAttachmentArgs;
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 fooLb = new Lb("fooLb", LbArgs.builder()
            .tag("tf-example")
            .build());

        var fooLbListener = new LbListener("fooLbListener", LbListenerArgs.builder()
            .loadBalancerId(fooLb.lbId())
            .protocol("https")
            .build());

        var fooLbSsl = new LbSsl("fooLbSsl", LbSslArgs.builder()
            .privateKey(Files.readString(Paths.get("private.key")))
            .userCert(Files.readString(Paths.get("user.crt")))
            .caCert(Files.readString(Paths.get("ca.crt")))
            .build());

        var fooLbSslAttachment = new LbSslAttachment("fooLbSslAttachment", LbSslAttachmentArgs.builder()
            .loadBalancerId(fooLb.lbId())
            .listenerId(fooLbListener.lbListenerId())
            .sslId(fooLbSsl.lbSslId())
            .build());

    }
}
Copy
resources:
  fooLb:
    type: ucloud:Lb
    properties:
      tag: tf-example
  fooLbListener:
    type: ucloud:LbListener
    properties:
      loadBalancerId: ${fooLb.lbId}
      protocol: https
  fooLbSsl:
    type: ucloud:LbSsl
    properties:
      privateKey:
        fn::readFile: private.key
      userCert:
        fn::readFile: user.crt
      caCert:
        fn::readFile: ca.crt
  fooLbSslAttachment:
    type: ucloud:LbSslAttachment
    properties:
      loadBalancerId: ${fooLb.lbId}
      listenerId: ${fooLbListener.lbListenerId}
      sslId: ${fooLbSsl.lbSslId}
Copy

Create LbSslAttachment Resource

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

Constructor syntax

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

@overload
def LbSslAttachment(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    listener_id: Optional[str] = None,
                    load_balancer_id: Optional[str] = None,
                    ssl_id: Optional[str] = None,
                    lb_ssl_attachment_id: Optional[str] = None)
func NewLbSslAttachment(ctx *Context, name string, args LbSslAttachmentArgs, opts ...ResourceOption) (*LbSslAttachment, error)
public LbSslAttachment(string name, LbSslAttachmentArgs args, CustomResourceOptions? opts = null)
public LbSslAttachment(String name, LbSslAttachmentArgs args)
public LbSslAttachment(String name, LbSslAttachmentArgs args, CustomResourceOptions options)
type: ucloud:LbSslAttachment
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 This property is required. LbSslAttachmentArgs
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 This property is required. LbSslAttachmentArgs
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 This property is required. LbSslAttachmentArgs
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 This property is required. LbSslAttachmentArgs
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. LbSslAttachmentArgs
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 lbSslAttachmentResource = new Ucloud.LbSslAttachment("lbSslAttachmentResource", new()
{
    ListenerId = "string",
    LoadBalancerId = "string",
    SslId = "string",
    LbSslAttachmentId = "string",
});
Copy
example, err := ucloud.NewLbSslAttachment(ctx, "lbSslAttachmentResource", &ucloud.LbSslAttachmentArgs{
ListenerId: pulumi.String("string"),
LoadBalancerId: pulumi.String("string"),
SslId: pulumi.String("string"),
LbSslAttachmentId: pulumi.String("string"),
})
Copy
var lbSslAttachmentResource = new LbSslAttachment("lbSslAttachmentResource", LbSslAttachmentArgs.builder()
    .listenerId("string")
    .loadBalancerId("string")
    .sslId("string")
    .lbSslAttachmentId("string")
    .build());
Copy
lb_ssl_attachment_resource = ucloud.LbSslAttachment("lbSslAttachmentResource",
    listener_id="string",
    load_balancer_id="string",
    ssl_id="string",
    lb_ssl_attachment_id="string")
Copy
const lbSslAttachmentResource = new ucloud.LbSslAttachment("lbSslAttachmentResource", {
    listenerId: "string",
    loadBalancerId: "string",
    sslId: "string",
    lbSslAttachmentId: "string",
});
Copy
type: ucloud:LbSslAttachment
properties:
    lbSslAttachmentId: string
    listenerId: string
    loadBalancerId: string
    sslId: string
Copy

LbSslAttachment 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 LbSslAttachment resource accepts the following input properties:

ListenerId This property is required. string
The ID of listener servers.
LoadBalancerId This property is required. string
SslId This property is required. string
The ID of SSL certificate.
LbSslAttachmentId string
ListenerId This property is required. string
The ID of listener servers.
LoadBalancerId This property is required. string
SslId This property is required. string
The ID of SSL certificate.
LbSslAttachmentId string
listenerId This property is required. String
The ID of listener servers.
loadBalancerId This property is required. String
sslId This property is required. String
The ID of SSL certificate.
lbSslAttachmentId String
listenerId This property is required. string
The ID of listener servers.
loadBalancerId This property is required. string
sslId This property is required. string
The ID of SSL certificate.
lbSslAttachmentId string
listener_id This property is required. str
The ID of listener servers.
load_balancer_id This property is required. str
ssl_id This property is required. str
The ID of SSL certificate.
lb_ssl_attachment_id str
listenerId This property is required. String
The ID of listener servers.
loadBalancerId This property is required. String
sslId This property is required. String
The ID of SSL certificate.
lbSslAttachmentId String

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing LbSslAttachment Resource

Get an existing LbSslAttachment 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?: LbSslAttachmentState, opts?: CustomResourceOptions): LbSslAttachment
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        lb_ssl_attachment_id: Optional[str] = None,
        listener_id: Optional[str] = None,
        load_balancer_id: Optional[str] = None,
        ssl_id: Optional[str] = None) -> LbSslAttachment
func GetLbSslAttachment(ctx *Context, name string, id IDInput, state *LbSslAttachmentState, opts ...ResourceOption) (*LbSslAttachment, error)
public static LbSslAttachment Get(string name, Input<string> id, LbSslAttachmentState? state, CustomResourceOptions? opts = null)
public static LbSslAttachment get(String name, Output<String> id, LbSslAttachmentState state, CustomResourceOptions options)
resources:  _:    type: ucloud:LbSslAttachment    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:
LbSslAttachmentId string
ListenerId string
The ID of listener servers.
LoadBalancerId string
SslId string
The ID of SSL certificate.
LbSslAttachmentId string
ListenerId string
The ID of listener servers.
LoadBalancerId string
SslId string
The ID of SSL certificate.
lbSslAttachmentId String
listenerId String
The ID of listener servers.
loadBalancerId String
sslId String
The ID of SSL certificate.
lbSslAttachmentId string
listenerId string
The ID of listener servers.
loadBalancerId string
sslId string
The ID of SSL certificate.
lb_ssl_attachment_id str
listener_id str
The ID of listener servers.
load_balancer_id str
ssl_id str
The ID of SSL certificate.
lbSslAttachmentId String
listenerId String
The ID of listener servers.
loadBalancerId String
sslId String
The ID of SSL certificate.

Package Details

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