alicloud.alb.ListenerAdditionalCertificateAttachment
Explore with Pulumi AI
Provides a Application Load Balancer (ALB) Listener Additional Certificate Attachment resource.
For information about Application Load Balancer (ALB) Listener Additional Certificate Attachment and how to use it, see What is Listener Additional Certificate Attachment.
NOTE: Available since v1.161.0.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
import * as random from "@pulumi/random";
import * as std from "@pulumi/std";
const config = new pulumi.Config();
const name = config.get("name") || "tf_example";
const _default = alicloud.alb.getZones({});
const defaultGetResourceGroups = alicloud.resourcemanager.getResourceGroups({});
const defaultNetwork = new alicloud.vpc.Network("default", {
vpcName: name,
cidrBlock: "10.4.0.0/16",
});
const defaultSwitch: alicloud.vpc.Switch[] = [];
for (const range = {value: 0}; range.value < 2; range.value++) {
defaultSwitch.push(new alicloud.vpc.Switch(`default-${range.value}`, {
vpcId: defaultNetwork.id,
cidrBlock: std.format({
input: "10.4.%d.0/24",
args: [range.value + 1],
}).then(invoke => invoke.result),
zoneId: _default.then(_default => _default.zones[range.value].id),
vswitchName: std.format({
input: `${name}_%d`,
args: [range.value + 1],
}).then(invoke => invoke.result),
}));
}
const defaultLoadBalancer = new alicloud.alb.LoadBalancer("default", {
vpcId: defaultNetwork.id,
addressType: "Internet",
addressAllocatedMode: "Fixed",
loadBalancerName: name,
loadBalancerEdition: "Standard",
resourceGroupId: defaultGetResourceGroups.then(defaultGetResourceGroups => defaultGetResourceGroups.groups?.[0]?.id),
loadBalancerBillingConfig: {
payType: "PayAsYouGo",
},
tags: {
Created: "TF",
},
zoneMappings: [
{
vswitchId: defaultSwitch[0].id,
zoneId: _default.then(_default => _default.zones?.[0]?.id),
},
{
vswitchId: defaultSwitch[1].id,
zoneId: _default.then(_default => _default.zones?.[1]?.id),
},
],
});
const defaultServerGroup = new alicloud.alb.ServerGroup("default", {
protocol: "HTTP",
vpcId: defaultNetwork.id,
serverGroupName: name,
resourceGroupId: defaultGetResourceGroups.then(defaultGetResourceGroups => defaultGetResourceGroups.groups?.[0]?.id),
healthCheckConfig: {
healthCheckEnabled: false,
},
stickySessionConfig: {
stickySessionEnabled: false,
},
tags: {
Created: "TF",
},
});
const defaultInteger = new random.index.Integer("default", {
min: 10000,
max: 99999,
});
const defaultServiceCertificate: alicloud.cas.ServiceCertificate[] = [];
for (const range = {value: 0}; range.value < 2; range.value++) {
defaultServiceCertificate.push(new alicloud.cas.ServiceCertificate(`default-${range.value}`, {
certificateName: std.join({
separator: "-",
input: [
name,
defaultInteger.result,
range.value,
],
}).then(invoke => invoke.result),
cert: `-----BEGIN CERTIFICATE-----
MIIDeDCCAmCgAwIBAgIEN3ZT6zANBgkqhkiG9w0BAQsFADBVMQswCQYDVQQGEwJD
TjEVMBMGA1UEAwwMKi50ZnRlc3QudG9wMRAwDgYDVQQIDAdCZWlKaW5nMRAwDgYD
VQQHDAdCZWlKaW5nMQswCQYDVQQKDAJBQTAeFw0yMzA4MjgwNjQ5NDNaFw0yNTA4
MjcwNjQ5NDNaMFUxCzAJBgNVBAYTAkNOMRUwEwYDVQQDDAwqLnRmdGVzdC50b3Ax
EDAOBgNVBAgMB0JlaUppbmcxEDAOBgNVBAcMB0JlaUppbmcxCzAJBgNVBAoMAkFB
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzkk9NJUH7PLSQK4RRrGQ
Y5dVsftkhnKh9HhI6yrnlowWIDPS1PZHOU/5gQ7xPUPGdKQV5S7x8wROnAaXEimx
N4GdQw25pGhRJvlwme9fzJJiSe6lG49NCxmuBiEdJAzPKaTPpK1cG1f1TqdgCfHR
HAL6Jxb3ylHG2LlTNFLXikubUi5RT6/9C8psr713Zm4HveCI/cx0WdgZ+fmsc9ft
rkIB1DdyV1kQ51m8r2rLi3J7aC5ggGOiex/VlGSd4e6SOQLpdQEdDbodtOJ4LgVk
+arFNCMinUWIOPGFzXhdm6lssPbh4MOBrz8c/M9TcF4hoMn5/o/9johZIZ/DOvXt
ZQIDAQABo1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T4OIwzPobzPqG
LILJ+e7bLw8RrM0HfgFnl8c=
-----END PRIVATE KEY-----
`,
}));
}
const defaultListener = new alicloud.alb.Listener("default", {
loadBalancerId: defaultLoadBalancer.id,
listenerProtocol: "HTTPS",
listenerPort: 8081,
listenerDescription: name,
defaultActions: [{
type: "ForwardGroup",
forwardGroupConfig: {
serverGroupTuples: [{
serverGroupId: defaultServerGroup.id,
}],
},
}],
certificates: {
certificateId: std.joinOutput({
separator: "",
input: [
defaultServiceCertificate[0].id,
"-cn-hangzhou",
],
}).apply(invoke => invoke.result),
},
});
const defaultListenerAdditionalCertificateAttachment = new alicloud.alb.ListenerAdditionalCertificateAttachment("default", {
certificateId: std.joinOutput({
separator: "",
input: [
defaultServiceCertificate[1].id,
"-cn-hangzhou",
],
}).apply(invoke => invoke.result),
listenerId: defaultListener.id,
});
import pulumi
import pulumi_alicloud as alicloud
import pulumi_random as random
import pulumi_std as std
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "tf_example"
default = alicloud.alb.get_zones()
default_get_resource_groups = alicloud.resourcemanager.get_resource_groups()
default_network = alicloud.vpc.Network("default",
vpc_name=name,
cidr_block="10.4.0.0/16")
default_switch = []
for range in [{"value": i} for i in range(0, 2)]:
default_switch.append(alicloud.vpc.Switch(f"default-{range['value']}",
vpc_id=default_network.id,
cidr_block=std.format(input="10.4.%d.0/24",
args=[range["value"] + 1]).result,
zone_id=default.zones[range["value"]].id,
vswitch_name=std.format(input=f"{name}_%d",
args=[range["value"] + 1]).result))
default_load_balancer = alicloud.alb.LoadBalancer("default",
vpc_id=default_network.id,
address_type="Internet",
address_allocated_mode="Fixed",
load_balancer_name=name,
load_balancer_edition="Standard",
resource_group_id=default_get_resource_groups.groups[0].id,
load_balancer_billing_config={
"pay_type": "PayAsYouGo",
},
tags={
"Created": "TF",
},
zone_mappings=[
{
"vswitch_id": default_switch[0].id,
"zone_id": default.zones[0].id,
},
{
"vswitch_id": default_switch[1].id,
"zone_id": default.zones[1].id,
},
])
default_server_group = alicloud.alb.ServerGroup("default",
protocol="HTTP",
vpc_id=default_network.id,
server_group_name=name,
resource_group_id=default_get_resource_groups.groups[0].id,
health_check_config={
"health_check_enabled": False,
},
sticky_session_config={
"sticky_session_enabled": False,
},
tags={
"Created": "TF",
})
default_integer = random.index.Integer("default",
min=10000,
max=99999)
default_service_certificate = []
for range in [{"value": i} for i in range(0, 2)]:
default_service_certificate.append(alicloud.cas.ServiceCertificate(f"default-{range['value']}",
certificate_name=std.join(separator="-",
input=[
name,
default_integer["result"],
range["value"],
]).result,
cert="""-----BEGIN CERTIFICATE-----
MIIDeDCCAmCgAwIBAgIEN3ZT6zANBgkqhkiG9w0BAQsFADBVMQswCQYDVQQGEwJD
TjEVMBMGA1UEAwwMKi50ZnRlc3QudG9wMRAwDgYDVQQIDAdCZWlKaW5nMRAwDgYD
VQQHDAdCZWlKaW5nMQswCQYDVQQKDAJBQTAeFw0yMzA4MjgwNjQ5NDNaFw0yNTA4
MjcwNjQ5NDNaMFUxCzAJBgNVBAYTAkNOMRUwEwYDVQQDDAwqLnRmdGVzdC50b3Ax
EDAOBgNVBAgMB0JlaUppbmcxEDAOBgNVBAcMB0JlaUppbmcxCzAJBgNVBAoMAkFB
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzkk9NJUH7PLSQK4RRrGQ
Y5dVsftkhnKh9HhI6yrnlowWIDPS1PZHOU/5gQ7xPUPGdKQV5S7x8wROnAaXEimx
N4GdQw25pGhRJvlwme9fzJJiSe6lG49NCxmuBiEdJAzPKaTPpK1cG1f1TqdgCfHR
HAL6Jxb3ylHG2LlTNFLXikubUi5RT6/9C8psr713Zm4HveCI/cx0WdgZ+fmsc9ft
rkIB1DdyV1kQ51m8r2rLi3J7aC5ggGOiex/VlGSd4e6SOQLpdQEdDbodtOJ4LgVk
+arFNCMinUWIOPGFzXhdm6lssPbh4MOBrz8c/M9TcF4hoMn5/o/9johZIZ/DOvXt
ZQIDAQABo1AwTjAdBgN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PqG
LILJ+e7bLw8RrM0HfgFnl8c=
-----END PRIVATE KEY-----
"""))
default_listener = alicloud.alb.Listener("default",
load_balancer_id=default_load_balancer.id,
listener_protocol="HTTPS",
listener_port=8081,
listener_description=name,
default_actions=[{
"type": "ForwardGroup",
"forward_group_config": {
"server_group_tuples": [{
"server_group_id": default_server_group.id,
}],
},
}],
certificates={
"certificate_id": std.join_output(separator="",
input=[
default_service_certificate[0].id,
"-cn-hangzhou",
]).apply(lambda invoke: invoke.result),
})
default_listener_additional_certificate_attachment = alicloud.alb.ListenerAdditionalCertificateAttachment("default",
certificate_id=std.join_output(separator="",
input=[
default_service_certificate[1].id,
"-cn-hangzhou",
]).apply(lambda invoke: invoke.result),
listener_id=default_listener.id)
package main
import (
"fmt"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/alb"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/cas"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/resourcemanager"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
"github.com/pulumi/pulumi-random/sdk/v4/go/random"
"github.com/pulumi/pulumi-std/sdk/go/std"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
cfg := config.New(ctx, "")
name := "tf_example"
if param := cfg.Get("name"); param != "" {
name = param
}
_default, err := alb.GetZones(ctx, &alb.GetZonesArgs{}, nil)
if err != nil {
return err
}
defaultGetResourceGroups, err := resourcemanager.GetResourceGroups(ctx, &resourcemanager.GetResourceGroupsArgs{}, nil)
if err != nil {
return err
}
defaultNetwork, err := vpc.NewNetwork(ctx, "default", &vpc.NetworkArgs{
VpcName: pulumi.String(name),
CidrBlock: pulumi.String("10.4.0.0/16"),
})
if err != nil {
return err
}
invokeFormat, err := std.Format(ctx, &std.FormatArgs{
Input: "10.4.%d.0/24",
Args: []float64{
val0 + 1,
},
}, nil)
if err != nil {
return err
}
invokeFormat1, err := std.Format(ctx, &std.FormatArgs{
Input: fmt.Sprintf("%v%v", name, "_%d"),
Args: []float64{
val0 + 1,
},
}, nil)
if err != nil {
return err
}
var defaultSwitch []*vpc.Switch
for index := 0; index < 2; index++ {
key0 := index
val0 := index
__res, err := vpc.NewSwitch(ctx, fmt.Sprintf("default-%v", key0), &vpc.SwitchArgs{
VpcId: defaultNetwork.ID(),
CidrBlock: pulumi.String(invokeFormat.Result),
ZoneId: _default.Zones[val0].Id,
VswitchName: pulumi.String(invokeFormat1.Result),
})
if err != nil {
return err
}
defaultSwitch = append(defaultSwitch, __res)
}
defaultLoadBalancer, err := alb.NewLoadBalancer(ctx, "default", &alb.LoadBalancerArgs{
VpcId: defaultNetwork.ID(),
AddressType: pulumi.String("Internet"),
AddressAllocatedMode: pulumi.String("Fixed"),
LoadBalancerName: pulumi.String(name),
LoadBalancerEdition: pulumi.String("Standard"),
ResourceGroupId: pulumi.String(defaultGetResourceGroups.Groups[0].Id),
LoadBalancerBillingConfig: &alb.LoadBalancerLoadBalancerBillingConfigArgs{
PayType: pulumi.String("PayAsYouGo"),
},
Tags: pulumi.StringMap{
"Created": pulumi.String("TF"),
},
ZoneMappings: alb.LoadBalancerZoneMappingArray{
&alb.LoadBalancerZoneMappingArgs{
VswitchId: defaultSwitch[0].ID(),
ZoneId: pulumi.String(_default.Zones[0].Id),
},
&alb.LoadBalancerZoneMappingArgs{
VswitchId: defaultSwitch[1].ID(),
ZoneId: pulumi.String(_default.Zones[1].Id),
},
},
})
if err != nil {
return err
}
defaultServerGroup, err := alb.NewServerGroup(ctx, "default", &alb.ServerGroupArgs{
Protocol: pulumi.String("HTTP"),
VpcId: defaultNetwork.ID(),
ServerGroupName: pulumi.String(name),
ResourceGroupId: pulumi.String(defaultGetResourceGroups.Groups[0].Id),
HealthCheckConfig: &alb.ServerGroupHealthCheckConfigArgs{
HealthCheckEnabled: pulumi.Bool(false),
},
StickySessionConfig: &alb.ServerGroupStickySessionConfigArgs{
StickySessionEnabled: pulumi.Bool(false),
},
Tags: pulumi.StringMap{
"Created": pulumi.String("TF"),
},
})
if err != nil {
return err
}
defaultInteger, err := random.NewInteger(ctx, "default", &random.IntegerArgs{
Min: 10000,
Max: 99999,
})
if err != nil {
return err
}
invokeJoin2, err := std.Join(ctx, &std.JoinArgs{
Separator: "-",
Input: []interface{}{
name,
defaultInteger.Result,
val0,
},
}, nil)
if err != nil {
return err
}
var defaultServiceCertificate []*cas.ServiceCertificate
for index := 0; index < 2; index++ {
key0 := index
_ := index
__res, err := cas.NewServiceCertificate(ctx, fmt.Sprintf("default-%v", key0), &cas.ServiceCertificateArgs{
CertificateName: pulumi.String(invokeJoin2.Result),
Cert: pulumi.String(`-----BEGIN CERTIFICATE-----
MIIDeDCCAmCgAwIBAgIEN3ZT6zANBgkqhkiG9w0BAQsFADBVMQswCQYDVQQGEwJD
TjEVMBMGA1UEAwwMKi50ZnRlc3QudG9wMRAwDgYDVQQIDAdCZWlKaW5nMRAwDgYD
VQQHDAdCZWlKaW5nMQswCQYDVQQKDAJBQTAeFw0yMzA4MjgwNjQ5NDNaFw0yNTA4
MjcwNjQ5NDNaMFUxCzAJBgNVBAYTAkNOMRUwEwYDVQQDDAwqLnRmdGVzdC50b3Ax
EDAOBgNVBAgMB0JlaUppbmcxEDAOBgNVBAcMB0JlaUppbmcxCzAJBgNVBAoMAkFB
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzkk9NJUH7PLSQK4RRrGQ
Y5dVsftkhnKh9HhI6yrnlowWIDPS1PZHOU/5gQ7xPUPGdKQV5S7x8wROnAaXEimx
N4GdQw25pGhRJvlwme9fzJJiSe6lG49NCxmuBiEdJAzPKaTPpK1cG1f1TqdgCfHR
HAL6Jxb3ylHG2LlTNFLXikubUi5RT6/9C8psr713Zm4HveCI/cx0WdgZ+fmsc9ft
rkIB1DdyV1kQ51m8r2rLi3J7aC5ggGOiex/VlGSd4e6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AWNBduiia0WypgPhLe/4wT1rYQkBtKMVKrgFo7Cvi4YKlrtlDnXyeU
CIFqfEL5NriQelqrFsvgHsmD+MpvDoSWm5C8IrTubtlNyWUzXSVT4OIwzPobzPqG
LILJ+e7bLw8RrM0HfgFnl8c=
-----END PRIVATE KEY-----
`),
})
if err != nil {
return err
}
defaultServiceCertificate = append(defaultServiceCertificate, __res)
}
defaultListener, err := alb.NewListener(ctx, "default", &alb.ListenerArgs{
LoadBalancerId: defaultLoadBalancer.ID(),
ListenerProtocol: pulumi.String("HTTPS"),
ListenerPort: pulumi.Int(8081),
ListenerDescription: pulumi.String(name),
DefaultActions: alb.ListenerDefaultActionArray{
&alb.ListenerDefaultActionArgs{
Type: pulumi.String("ForwardGroup"),
ForwardGroupConfig: &alb.ListenerDefaultActionForwardGroupConfigArgs{
ServerGroupTuples: alb.ListenerDefaultActionForwardGroupConfigServerGroupTupleArray{
&alb.ListenerDefaultActionForwardGroupConfigServerGroupTupleArgs{
ServerGroupId: defaultServerGroup.ID(),
},
},
},
},
},
Certificates: &alb.ListenerCertificatesArgs{
CertificateId: std.JoinOutput(ctx, std.JoinOutputArgs{
Separator: pulumi.String(""),
Input: pulumi.StringArray{
defaultServiceCertificate[0].ID(),
pulumi.String("-cn-hangzhou"),
},
}, nil).ApplyT(func(invoke std.JoinResult) (*string, error) {
return invoke.Result, nil
}).(pulumi.StringPtrOutput),
},
})
if err != nil {
return err
}
_, err = alb.NewListenerAdditionalCertificateAttachment(ctx, "default", &alb.ListenerAdditionalCertificateAttachmentArgs{
CertificateId: pulumi.String(std.JoinOutput(ctx, std.JoinOutputArgs{
Separator: pulumi.String(""),
Input: pulumi.StringArray{
defaultServiceCertificate[1].ID(),
pulumi.String("-cn-hangzhou"),
},
}, nil).ApplyT(func(invoke std.JoinResult) (*string, error) {
return invoke.Result, nil
}).(pulumi.StringPtrOutput)),
ListenerId: defaultListener.ID(),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
using Random = Pulumi.Random;
using Std = Pulumi.Std;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var name = config.Get("name") ?? "tf_example";
var @default = AliCloud.Alb.GetZones.Invoke();
var defaultGetResourceGroups = AliCloud.ResourceManager.GetResourceGroups.Invoke();
var defaultNetwork = new AliCloud.Vpc.Network("default", new()
{
VpcName = name,
CidrBlock = "10.4.0.0/16",
});
var defaultSwitch = new List<AliCloud.Vpc.Switch>();
for (var rangeIndex = 0; rangeIndex < 2; rangeIndex++)
{
var range = new { Value = rangeIndex };
defaultSwitch.Add(new AliCloud.Vpc.Switch($"default-{range.Value}", new()
{
VpcId = defaultNetwork.Id,
CidrBlock = Std.Format.Invoke(new()
{
Input = "10.4.%d.0/24",
Args = new[]
{
range.Value + 1,
},
}).Apply(invoke => invoke.Result),
ZoneId = @default.Apply(@default => @default.Apply(getZonesResult => getZonesResult.Zones)[range.Value].Id),
VswitchName = Std.Format.Invoke(new()
{
Input = $"{name}_%d",
Args = new[]
{
range.Value + 1,
},
}).Apply(invoke => invoke.Result),
}));
}
var defaultLoadBalancer = new AliCloud.Alb.LoadBalancer("default", new()
{
VpcId = defaultNetwork.Id,
AddressType = "Internet",
AddressAllocatedMode = "Fixed",
LoadBalancerName = name,
LoadBalancerEdition = "Standard",
ResourceGroupId = defaultGetResourceGroups.Apply(getResourceGroupsResult => getResourceGroupsResult.Groups[0]?.Id),
LoadBalancerBillingConfig = new AliCloud.Alb.Inputs.LoadBalancerLoadBalancerBillingConfigArgs
{
PayType = "PayAsYouGo",
},
Tags =
{
{ "Created", "TF" },
},
ZoneMappings = new[]
{
new AliCloud.Alb.Inputs.LoadBalancerZoneMappingArgs
{
VswitchId = defaultSwitch[0].Id,
ZoneId = @default.Apply(@default => @default.Apply(getZonesResult => getZonesResult.Zones[0]?.Id)),
},
new AliCloud.Alb.Inputs.LoadBalancerZoneMappingArgs
{
VswitchId = defaultSwitch[1].Id,
ZoneId = @default.Apply(@default => @default.Apply(getZonesResult => getZonesResult.Zones[1]?.Id)),
},
},
});
var defaultServerGroup = new AliCloud.Alb.ServerGroup("default", new()
{
Protocol = "HTTP",
VpcId = defaultNetwork.Id,
ServerGroupName = name,
ResourceGroupId = defaultGetResourceGroups.Apply(getResourceGroupsResult => getResourceGroupsResult.Groups[0]?.Id),
HealthCheckConfig = new AliCloud.Alb.Inputs.ServerGroupHealthCheckConfigArgs
{
HealthCheckEnabled = false,
},
StickySessionConfig = new AliCloud.Alb.Inputs.ServerGroupStickySessionConfigArgs
{
StickySessionEnabled = false,
},
Tags =
{
{ "Created", "TF" },
},
});
var defaultInteger = new Random.Index.Integer("default", new()
{
Min = 10000,
Max = 99999,
});
var defaultServiceCertificate = new List<AliCloud.Cas.ServiceCertificate>();
for (var rangeIndex = 0; rangeIndex < 2; rangeIndex++)
{
var range = new { Value = rangeIndex };
defaultServiceCertificate.Add(new AliCloud.Cas.ServiceCertificate($"default-{range.Value}", new()
{
CertificateName = Std.Join.Invoke(new()
{
Separator = "-",
Input = new[]
{
name,
defaultInteger.Result,
range.Value,
},
}).Apply(invoke => invoke.Result),
Cert = @"-----BEGIN CERTIFICATE-----
MIIDeDCCAmCgAwIBAgIEN3ZT6zANBgkqhkiG9w0BAQsFADBVMQswCQYDVQQGEwJD
TjEVMBMGA1UEAwwMKi50ZnRlc3QudG9wMRAwDgYDVQQIDAdCZWlKaW5nMRAwDgYD
VQQHDAdCZWlKaW5nMQswCQYDVQQKDAJBQTAeFw0yMzA4MjgwNjQ5NDNaFw0yNTA4
MjcwNjQ5NDNaMFUxCzAJBgNVBAYTAkNOMRUwEwYDVQQDDAwqLnRmdGVzdC50b3Ax
EDAOBgNVBAgMB0JlaUppbmcxEDAOBgNVBAcMB0JlaUppbmcxCzAJBgNVBAoMAkFB
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzkk9NJUH7PLSQK4RRrGQ
Y5dVsftkhnKh9HhI6yrnlowWIDPS1P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frN2Kdkt7Z6dLTEVPlsMfGQ6pyNmxdM9rkzzNC0JcGymfDIb7RE35T3+hTy6La
AMiCXv3xn6qAzY2NFh87tpPlyymWMOLTnf3Kkcfszlfp45idOBGCu46V9NDVbppT
2UmrSIR/H5dbTXsNcAlt/hhlpeInjhkU1VqmH10CgYEA7Kk+QhWq705SczpWjm5J
9kHqfFzJLwAWNBduiia0WypgPhLe/4wT1rYQkBtKMVKrgFo7Cvi4YKlrtlDnXyeU
CIFqfEL5NriQelqrFsvgHsmD+MpvDoSWm5C8IrTubtlNyWUzXSVT4OIwzPobzPqG
LILJ+e7bLw8RrM0HfgFnl8c=
-----END PRIVATE KEY-----
",
}));
}
var defaultListener = new AliCloud.Alb.Listener("default", new()
{
LoadBalancerId = defaultLoadBalancer.Id,
ListenerProtocol = "HTTPS",
ListenerPort = 8081,
ListenerDescription = name,
DefaultActions = new[]
{
new AliCloud.Alb.Inputs.ListenerDefaultActionArgs
{
Type = "ForwardGroup",
ForwardGroupConfig = new AliCloud.Alb.Inputs.ListenerDefaultActionForwardGroupConfigArgs
{
ServerGroupTuples = new[]
{
new AliCloud.Alb.Inputs.ListenerDefaultActionForwardGroupConfigServerGroupTupleArgs
{
ServerGroupId = defaultServerGroup.Id,
},
},
},
},
},
Certificates = new AliCloud.Alb.Inputs.ListenerCertificatesArgs
{
CertificateId = Std.Join.Invoke(new()
{
Separator = "",
Input = new[]
{
defaultServiceCertificate[0].Id,
"-cn-hangzhou",
},
}).Apply(invoke => invoke.Result),
},
});
var defaultListenerAdditionalCertificateAttachment = new AliCloud.Alb.ListenerAdditionalCertificateAttachment("default", new()
{
CertificateId = Std.Join.Invoke(new()
{
Separator = "",
Input = new[]
{
defaultServiceCertificate[1].Id,
"-cn-hangzhou",
},
}).Apply(invoke => invoke.Result),
ListenerId = defaultListener.Id,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.alb.AlbFunctions;
import com.pulumi.alicloud.alb.inputs.GetZonesArgs;
import com.pulumi.alicloud.resourcemanager.ResourcemanagerFunctions;
import com.pulumi.alicloud.resourcemanager.inputs.GetResourceGroupsArgs;
import com.pulumi.alicloud.vpc.Network;
import com.pulumi.alicloud.vpc.NetworkArgs;
import com.pulumi.alicloud.vpc.Switch;
import com.pulumi.alicloud.vpc.SwitchArgs;
import com.pulumi.std.StdFunctions;
import com.pulumi.std.inputs.FormatArgs;
import com.pulumi.alicloud.alb.LoadBalancer;
import com.pulumi.alicloud.alb.LoadBalancerArgs;
import com.pulumi.alicloud.alb.inputs.LoadBalancerLoadBalancerBillingConfigArgs;
import com.pulumi.alicloud.alb.inputs.LoadBalancerZoneMappingArgs;
import com.pulumi.alicloud.alb.ServerGroup;
import com.pulumi.alicloud.alb.ServerGroupArgs;
import com.pulumi.alicloud.alb.inputs.ServerGroupHealthCheckConfigArgs;
import com.pulumi.alicloud.alb.inputs.ServerGroupStickySessionConfigArgs;
import com.pulumi.random.Integer;
import com.pulumi.random.IntegerArgs;
import com.pulumi.alicloud.cas.ServiceCertificate;
import com.pulumi.alicloud.cas.ServiceCertificateArgs;
import com.pulumi.std.inputs.JoinArgs;
import com.pulumi.alicloud.alb.Listener;
import com.pulumi.alicloud.alb.ListenerArgs;
import com.pulumi.alicloud.alb.inputs.ListenerDefaultActionArgs;
import com.pulumi.alicloud.alb.inputs.ListenerDefaultActionForwardGroupConfigArgs;
import com.pulumi.alicloud.alb.inputs.ListenerCertificatesArgs;
import com.pulumi.alicloud.alb.ListenerAdditionalCertificateAttachment;
import com.pulumi.alicloud.alb.ListenerAdditionalCertificateAttachmentArgs;
import com.pulumi.codegen.internal.KeyedValue;
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) {
final var config = ctx.config();
final var name = config.get("name").orElse("tf_example");
final var default = AlbFunctions.getZones(GetZonesArgs.builder()
.build());
final var defaultGetResourceGroups = ResourcemanagerFunctions.getResourceGroups(GetResourceGroupsArgs.builder()
.build());
var defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()
.vpcName(name)
.cidrBlock("10.4.0.0/16")
.build());
for (var i = 0; i < 2; i++) {
new Switch("defaultSwitch-" + i, SwitchArgs.builder()
.vpcId(defaultNetwork.id())
.cidrBlock(StdFunctions.format(FormatArgs.builder()
.input("10.4.%d.0/24")
.args(range.value() + 1)
.build()).result())
.zoneId(default_.zones()[range.value()].id())
.vswitchName(StdFunctions.format(FormatArgs.builder()
.input(String.format("%s_%d", name))
.args(range.value() + 1)
.build()).result())
.build());
}
var defaultLoadBalancer = new LoadBalancer("defaultLoadBalancer", LoadBalancerArgs.builder()
.vpcId(defaultNetwork.id())
.addressType("Internet")
.addressAllocatedMode("Fixed")
.loadBalancerName(name)
.loadBalancerEdition("Standard")
.resourceGroupId(defaultGetResourceGroups.groups()[0].id())
.loadBalancerBillingConfig(LoadBalancerLoadBalancerBillingConfigArgs.builder()
.payType("PayAsYouGo")
.build())
.tags(Map.of("Created", "TF"))
.zoneMappings(
LoadBalancerZoneMappingArgs.builder()
.vswitchId(defaultSwitch[0].id())
.zoneId(default_.zones()[0].id())
.build(),
LoadBalancerZoneMappingArgs.builder()
.vswitchId(defaultSwitch[1].id())
.zoneId(default_.zones()[1].id())
.build())
.build());
var defaultServerGroup = new ServerGroup("defaultServerGroup", ServerGroupArgs.builder()
.protocol("HTTP")
.vpcId(defaultNetwork.id())
.serverGroupName(name)
.resourceGroupId(defaultGetResourceGroups.groups()[0].id())
.healthCheckConfig(ServerGroupHealthCheckConfigArgs.builder()
.healthCheckEnabled(false)
.build())
.stickySessionConfig(ServerGroupStickySessionConfigArgs.builder()
.stickySessionEnabled(false)
.build())
.tags(Map.of("Created", "TF"))
.build());
var defaultInteger = new Integer("defaultInteger", IntegerArgs.builder()
.min(10000)
.max(99999)
.build());
for (var i = 0; i < 2; i++) {
new ServiceCertificate("defaultServiceCertificate-" + i, ServiceCertificateArgs.builder()
.certificateName(StdFunctions.join(JoinArgs.builder()
.separator("-")
.input(
name,
defaultInteger.result(),
range.value())
.build()).result())
.cert("""
-----BEGIN CERTIFICATE-----
MIIDeDCCAmCgAwIBAgIEN3ZT6zANBgkqhkiG9w0BAQsFADBVMQswCQYDVQQGEwJD
TjEVMBMGA1UEAwwMKi50ZnRlc3QudG9wMRAwDgYDVQQIDAdCZWlKaW5nMRAwDgYD
VQQHDAdCZWlKaW5nMQswCQYDVQQKDAJBQTAeFw0yMzA4MjgwNjQ5NDNaFw0yNTA4
MjcwNjQ5NDNaMFUxCzAJBgNVBAYTAkNOMRUwEwYDVQQDDAwqLnRmdGVzdC50b3Ax
EDAOBgNVBAgMB0JlaUppbmcxEDAOBgNVBAcMB0JlaUppbmcxCzAJBgNVBAoMAkFB
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzkk9NJUH7PLSQK4RRrGQ
Y5dVsftkhnKh9HhI6yrnlowWIDPS1PZHOU/5gQ7xPUPGdKQV5S7x8wROnAaXEimx
N4GdQw25pGhRJvlwme9fzJJiSe6lG49NCxmuBiEdJAzPKaTPpK1cG1f1TqdgCfHR
HAL6Jxb3ylHG2LlTNFLXikubUi5RT6/9C8psr713Zm4HveCI/cx0WdgZ+fmsc9ft
rkIB1DdyV1kQ51m8r2rLi3J7aC5ggGOiex/VlGSd4e6SOQLpdQEdDbodtOJ4LgVk
+arFNCMinUWIOPGFzXhdm6lssPbh4MOBrz8c/M9TcF4hoMn5/o/9johZIZ/DOvXt
ZQIDAQABo1AwTjAdBgNVHQ4EFgQUOnWiddgeZj17IeysatqhE361o5YwHwYDVR0j
BBgwFoAUOnWiddgeZj17IeysatqhE361o5YwDAYDVR0TBAUwAwEB/zANBgkqhkiG
9w0BAQsFAAOCAQEAfh3cnOszHM/5wXjY7BIkmgDOReksS+87ibhBz7T2ddZj+yCF
9GdIBzXCiHpQFXpW8a3kc3I7l3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2rh3I8o2CQKBgQD/5Xe7cenaOBefzPlx
GOEsB+qv49UmzEPOXDNZe9hmAawuuuxPUM+xlE++P+mEgQm1LPT4WWgtFLPVuwmx
ncxt4CJNZh+ZGFyAZ4dm4M4ZhIBXNonyIP+yGyAJUUVF9Iy3TYcJNiGzv2Rx9JRQ
XWJMQnTDILmZbmU+ltTea7/zqwKBgQDOXqCqb17MuLt7OcKWSgthm79OlaOdzZvl
i9qU6VzZKG7Axc5gA9yq6tHp3vWPI4bNdvwqIIa/nzVILjGA5fcYFbRN+7gHwo8s
rNAgi5PAoKWqQRovyJRY9Eq/sn6l1jbJZAOUAMZMWDm8z89OqK7PNQSIAtfFSneo
2QxJkGeTLwKBgGJkafBB8af9b1/7YWISLepPNPbihH/BhMThAMGEdAVs2TaymtA4
g1OFck/1pSVUtFXcbmjbf8ntruQcYbLQuNz6lFXsUXP9QPwCUrbE85ouL2bZSps2
AvsJoPzUKe2nBUAp6CUrkjPaAJYsc6ae8X/fAaRRfeu33ef9+OV4yrq3AoGAYFZo
ZmfrN2Kdkt7Z6dLTEVPlsMfGQ6pyNmxdM9rkzzNC0JcGymfDIb7RE35T3+hTy6La
AMiCXv3xn6qAzY2NFh87tpPlyymWMOLTnf3Kkcfszlfp45idOBGCu46V9NDVbppT
2UmrSIR/H5dbTXsNcAlt/hhlpeInjhkU1VqmH10CgYEA7Kk+QhWq705SczpWjm5J
9kHqfFzJLwAWNBduiia0WypgPhLe/4wT1rYQkBtKMVKrgFo7Cvi4YKlrtlDnXyeU
CIFqfEL5NriQelqrFsvgHsmD+MpvDoSWm5C8IrTubtlNyWUzXSVT4OIwzPobzPqG
LILJ+e7bLw8RrM0HfgFnl8c=
-----END PRIVATE KEY-----
""")
.build());
}
var defaultListener = new Listener("defaultListener", ListenerArgs.builder()
.loadBalancerId(defaultLoadBalancer.id())
.listenerProtocol("HTTPS")
.listenerPort(8081)
.listenerDescription(name)
.defaultActions(ListenerDefaultActionArgs.builder()
.type("ForwardGroup")
.forwardGroupConfig(ListenerDefaultActionForwardGroupConfigArgs.builder()
.serverGroupTuples(ListenerDefaultActionForwardGroupConfigServerGroupTupleArgs.builder()
.serverGroupId(defaultServerGroup.id())
.build())
.build())
.build())
.certificates(ListenerCertificatesArgs.builder()
.certificateId(StdFunctions.join(JoinArgs.builder()
.separator("")
.input(
defaultServiceCertificate[0].id(),
"-cn-hangzhou")
.build()).applyValue(_invoke -> _invoke.result()))
.build())
.build());
var defaultListenerAdditionalCertificateAttachment = new ListenerAdditionalCertificateAttachment("defaultListenerAdditionalCertificateAttachment", ListenerAdditionalCertificateAttachmentArgs.builder()
.certificateId(StdFunctions.join(JoinArgs.builder()
.separator("")
.input(
defaultServiceCertificate[1].id(),
"-cn-hangzhou")
.build()).applyValue(_invoke -> _invoke.result()))
.listenerId(defaultListener.id())
.build());
}
}
Example coming soon!
Create ListenerAdditionalCertificateAttachment Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ListenerAdditionalCertificateAttachment(name: string, args: ListenerAdditionalCertificateAttachmentArgs, opts?: CustomResourceOptions);
@overload
def ListenerAdditionalCertificateAttachment(resource_name: str,
args: ListenerAdditionalCertificateAttachmentArgs,
opts: Optional[ResourceOptions] = None)
@overload
def ListenerAdditionalCertificateAttachment(resource_name: str,
opts: Optional[ResourceOptions] = None,
certificate_id: Optional[str] = None,
listener_id: Optional[str] = None)
func NewListenerAdditionalCertificateAttachment(ctx *Context, name string, args ListenerAdditionalCertificateAttachmentArgs, opts ...ResourceOption) (*ListenerAdditionalCertificateAttachment, error)
public ListenerAdditionalCertificateAttachment(string name, ListenerAdditionalCertificateAttachmentArgs args, CustomResourceOptions? opts = null)
public ListenerAdditionalCertificateAttachment(String name, ListenerAdditionalCertificateAttachmentArgs args)
public ListenerAdditionalCertificateAttachment(String name, ListenerAdditionalCertificateAttachmentArgs args, CustomResourceOptions options)
type: alicloud:alb:ListenerAdditionalCertificateAttachment
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args ListenerAdditionalCertificateAttachmentArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args ListenerAdditionalCertificateAttachmentArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args ListenerAdditionalCertificateAttachmentArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ListenerAdditionalCertificateAttachmentArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ListenerAdditionalCertificateAttachmentArgs
- 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 listenerAdditionalCertificateAttachmentResource = new AliCloud.Alb.ListenerAdditionalCertificateAttachment("listenerAdditionalCertificateAttachmentResource", new()
{
CertificateId = "string",
ListenerId = "string",
});
example, err := alb.NewListenerAdditionalCertificateAttachment(ctx, "listenerAdditionalCertificateAttachmentResource", &alb.ListenerAdditionalCertificateAttachmentArgs{
CertificateId: pulumi.String("string"),
ListenerId: pulumi.String("string"),
})
var listenerAdditionalCertificateAttachmentResource = new com.pulumi.alicloud.alb.ListenerAdditionalCertificateAttachment("listenerAdditionalCertificateAttachmentResource", com.pulumi.alicloud.alb.ListenerAdditionalCertificateAttachmentArgs.builder()
.certificateId("string")
.listenerId("string")
.build());
listener_additional_certificate_attachment_resource = alicloud.alb.ListenerAdditionalCertificateAttachment("listenerAdditionalCertificateAttachmentResource",
certificate_id="string",
listener_id="string")
const listenerAdditionalCertificateAttachmentResource = new alicloud.alb.ListenerAdditionalCertificateAttachment("listenerAdditionalCertificateAttachmentResource", {
certificateId: "string",
listenerId: "string",
});
type: alicloud:alb:ListenerAdditionalCertificateAttachment
properties:
certificateId: string
listenerId: string
ListenerAdditionalCertificateAttachment 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 ListenerAdditionalCertificateAttachment resource accepts the following input properties:
- Certificate
Id string - The Certificate ID.
- Listener
Id string - The ID of the ALB listener.
- Certificate
Id string - The Certificate ID.
- Listener
Id string - The ID of the ALB listener.
- certificate
Id String - The Certificate ID.
- listener
Id String - The ID of the ALB listener.
- certificate
Id string - The Certificate ID.
- listener
Id string - The ID of the ALB listener.
- certificate_
id str - The Certificate ID.
- listener_
id str - The ID of the ALB listener.
- certificate
Id String - The Certificate ID.
- listener
Id String - The ID of the ALB listener.
Outputs
All input properties are implicitly available as output properties. Additionally, the ListenerAdditionalCertificateAttachment resource produces the following output properties:
- Certificate
Type string - The type of the certificate.
- Id string
- The provider-assigned unique ID for this managed resource.
- Status string
- The status of the certificate.
- Certificate
Type string - The type of the certificate.
- Id string
- The provider-assigned unique ID for this managed resource.
- Status string
- The status of the certificate.
- certificate
Type String - The type of the certificate.
- id String
- The provider-assigned unique ID for this managed resource.
- status String
- The status of the certificate.
- certificate
Type string - The type of the certificate.
- id string
- The provider-assigned unique ID for this managed resource.
- status string
- The status of the certificate.
- certificate_
type str - The type of the certificate.
- id str
- The provider-assigned unique ID for this managed resource.
- status str
- The status of the certificate.
- certificate
Type String - The type of the certificate.
- id String
- The provider-assigned unique ID for this managed resource.
- status String
- The status of the certificate.
Look up Existing ListenerAdditionalCertificateAttachment Resource
Get an existing ListenerAdditionalCertificateAttachment 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?: ListenerAdditionalCertificateAttachmentState, opts?: CustomResourceOptions): ListenerAdditionalCertificateAttachment
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
certificate_id: Optional[str] = None,
certificate_type: Optional[str] = None,
listener_id: Optional[str] = None,
status: Optional[str] = None) -> ListenerAdditionalCertificateAttachment
func GetListenerAdditionalCertificateAttachment(ctx *Context, name string, id IDInput, state *ListenerAdditionalCertificateAttachmentState, opts ...ResourceOption) (*ListenerAdditionalCertificateAttachment, error)
public static ListenerAdditionalCertificateAttachment Get(string name, Input<string> id, ListenerAdditionalCertificateAttachmentState? state, CustomResourceOptions? opts = null)
public static ListenerAdditionalCertificateAttachment get(String name, Output<String> id, ListenerAdditionalCertificateAttachmentState state, CustomResourceOptions options)
resources: _: type: alicloud:alb:ListenerAdditionalCertificateAttachment get: id: ${id}
- name
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- 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.
- Certificate
Id string - The Certificate ID.
- Certificate
Type string - The type of the certificate.
- Listener
Id string - The ID of the ALB listener.
- Status string
- The status of the certificate.
- Certificate
Id string - The Certificate ID.
- Certificate
Type string - The type of the certificate.
- Listener
Id string - The ID of the ALB listener.
- Status string
- The status of the certificate.
- certificate
Id String - The Certificate ID.
- certificate
Type String - The type of the certificate.
- listener
Id String - The ID of the ALB listener.
- status String
- The status of the certificate.
- certificate
Id string - The Certificate ID.
- certificate
Type string - The type of the certificate.
- listener
Id string - The ID of the ALB listener.
- status string
- The status of the certificate.
- certificate_
id str - The Certificate ID.
- certificate_
type str - The type of the certificate.
- listener_
id str - The ID of the ALB listener.
- status str
- The status of the certificate.
- certificate
Id String - The Certificate ID.
- certificate
Type String - The type of the certificate.
- listener
Id String - The ID of the ALB listener.
- status String
- The status of the certificate.
Import
Application Load Balancer (ALB) Listener Additional Certificate Attachment can be imported using the id, e.g.
$ pulumi import alicloud:alb/listenerAdditionalCertificateAttachment:ListenerAdditionalCertificateAttachment example <listener_id>:<certificate_id>
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloud
Terraform Provider.