Get information about Scaleway Load Balancer certificates.
This data source can prove useful when a module accepts a Load Balancer certificate as an input variable and needs to, for example, determine the security of a certificate for the frontend associated with your domain.
For more information, see the main documentation or API documentation.
Examples
Let’s Encrypt
import * as pulumi from "@pulumi/pulumi";
import * as scaleway from "@pulumiverse/scaleway";
import * as std from "@pulumi/std";
const main = new scaleway.loadbalancers.Ip("main", {});
const mainLoadBalancer = new scaleway.loadbalancers.LoadBalancer("main", {
ipId: main.id,
name: "data-test-lb-cert",
type: "LB-S",
});
const mainCertificate = new scaleway.loadbalancers.Certificate("main", {
lbId: mainLoadBalancer.id,
name: "data-test-lb-cert",
letsencrypt: {
commonName: pulumi.all([mainLoadBalancer.ipAddress, mainLoadBalancer.region]).apply(([ipAddress, region]) => `${std.index.replace({
text: ipAddress,
search: ".",
replace: "-",
}).result}.lb.${region}.scw.cloud`),
},
});
const byID = scaleway.loadbalancers.getCertificateOutput({
certificateId: mainCertificate.id,
});
const byName = scaleway.loadbalancers.getCertificateOutput({
name: mainCertificate.name,
lbId: mainLoadBalancer.id,
});
import pulumi
import pulumi_scaleway as scaleway
import pulumi_std as std
import pulumiverse_scaleway as scaleway
main = scaleway.loadbalancers.Ip("main")
main_load_balancer = scaleway.loadbalancers.LoadBalancer("main",
ip_id=main.id,
name="data-test-lb-cert",
type="LB-S")
main_certificate = scaleway.loadbalancers.Certificate("main",
lb_id=main_load_balancer.id,
name="data-test-lb-cert",
letsencrypt={
"common_name": pulumi.Output.all(
ip_address=main_load_balancer.ip_address,
region=main_load_balancer.region
).apply(lambda resolved_outputs: f"{std.index.replace(text=resolved_outputs['ip_address'],
search='.',
replace='-')['result']}.lb.{resolved_outputs['region']}.scw.cloud")
,
})
by_id = scaleway.loadbalancers.get_certificate_output(certificate_id=main_certificate.id)
by_name = scaleway.loadbalancers.get_certificate_output(name=main_certificate.name,
lb_id=main_load_balancer.id)
package main
import (
"fmt"
"github.com/pulumi/pulumi-std/sdk/go/std"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumiverse/pulumi-scaleway/sdk/go/scaleway/loadbalancers"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
main, err := loadbalancers.NewIp(ctx, "main", nil)
if err != nil {
return err
}
mainLoadBalancer, err := loadbalancers.NewLoadBalancer(ctx, "main", &loadbalancers.LoadBalancerArgs{
IpId: main.ID(),
Name: pulumi.String("data-test-lb-cert"),
Type: pulumi.String("LB-S"),
})
if err != nil {
return err
}
invokeReplace, err := std.Replace(ctx, map[string]interface{}{
"text": ipAddress,
"search": ".",
"replace": "-",
}, nil)
if err != nil {
return err
}
mainCertificate, err := loadbalancers.NewCertificate(ctx, "main", &loadbalancers.CertificateArgs{
LbId: mainLoadBalancer.ID(),
Name: pulumi.String("data-test-lb-cert"),
Letsencrypt: &loadbalancers.CertificateLetsencryptArgs{
CommonName: pulumi.All(mainLoadBalancer.IpAddress,mainLoadBalancer.Region).ApplyT(func(_args []interface{}) (string, error) {
ipAddress := _args[0].(string)
region := _args[1].(string)
%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference),
},
})
if err != nil {
return err
}
_ = loadbalancers.LookupCertificateOutput(ctx, loadbalancers.GetCertificateOutputArgs{
CertificateId: mainCertificate.ID(),
}, nil);
_ = loadbalancers.LookupCertificateOutput(ctx, loadbalancers.GetCertificateOutputArgs{
Name: mainCertificate.Name,
LbId: mainLoadBalancer.ID(),
}, nil);
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Scaleway = Pulumi.Scaleway;
using Scaleway = Pulumiverse.Scaleway;
using Std = Pulumi.Std;
return await Deployment.RunAsync(() =>
{
var main = new Scaleway.Loadbalancers.Ip("main");
var mainLoadBalancer = new Scaleway.Loadbalancers.LoadBalancer("main", new()
{
IpId = main.Id,
Name = "data-test-lb-cert",
Type = "LB-S",
});
var mainCertificate = new Scaleway.Loadbalancers.Certificate("main", new()
{
LbId = mainLoadBalancer.Id,
Name = "data-test-lb-cert",
Letsencrypt = new Scaleway.Loadbalancers.Inputs.CertificateLetsencryptArgs
{
CommonName = Output.Tuple(mainLoadBalancer.IpAddress, mainLoadBalancer.Region).Apply(values =>
{
var ipAddress = values.Item1;
var region = values.Item2;
return $"{Std.Index.Replace.Invoke(new()
{
Text = ipAddress,
Search = ".",
Replace = "-",
}).Result}.lb.{region}.scw.cloud";
}),
},
});
var byID = Scaleway.Loadbalancers.GetCertificate.Invoke(new()
{
CertificateId = mainCertificate.Id,
});
var byName = Scaleway.Loadbalancers.GetCertificate.Invoke(new()
{
Name = mainCertificate.Name,
LbId = mainLoadBalancer.Id,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.scaleway.loadbalancers.Ip;
import com.pulumi.scaleway.loadbalancers.LoadBalancer;
import com.pulumi.scaleway.loadbalancers.LoadBalancerArgs;
import com.pulumi.scaleway.loadbalancers.Certificate;
import com.pulumi.scaleway.loadbalancers.CertificateArgs;
import com.pulumi.scaleway.loadbalancers.inputs.CertificateLetsencryptArgs;
import com.pulumi.std.StdFunctions;
import com.pulumi.scaleway.loadbalancers.LoadbalancersFunctions;
import com.pulumi.scaleway.loadbalancers.inputs.GetCertificateArgs;
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 main = new Ip("main");
var mainLoadBalancer = new LoadBalancer("mainLoadBalancer", LoadBalancerArgs.builder()
.ipId(main.id())
.name("data-test-lb-cert")
.type("LB-S")
.build());
var mainCertificate = new Certificate("mainCertificate", CertificateArgs.builder()
.lbId(mainLoadBalancer.id())
.name("data-test-lb-cert")
.letsencrypt(CertificateLetsencryptArgs.builder()
.commonName(Output.tuple(mainLoadBalancer.ipAddress(), mainLoadBalancer.region()).applyValue(values -> {
var ipAddress = values.t1;
var region = values.t2;
return String.format("%s.lb.%s.scw.cloud", StdFunctions.replace(Map.ofEntries(
Map.entry("text", ipAddress),
Map.entry("search", "."),
Map.entry("replace", "-")
)).result(),region);
}))
.build())
.build());
final var byID = LoadbalancersFunctions.getCertificate(GetCertificateArgs.builder()
.certificateId(mainCertificate.id())
.build());
final var byName = LoadbalancersFunctions.getCertificate(GetCertificateArgs.builder()
.name(mainCertificate.name())
.lbId(mainLoadBalancer.id())
.build());
}
}
resources:
main:
type: scaleway:loadbalancers:Ip
mainLoadBalancer:
type: scaleway:loadbalancers:LoadBalancer
name: main
properties:
ipId: ${main.id}
name: data-test-lb-cert
type: LB-S
mainCertificate:
type: scaleway:loadbalancers:Certificate
name: main
properties:
lbId: ${mainLoadBalancer.id}
name: data-test-lb-cert
letsencrypt:
commonName:
fn::join:
- ""
- - fn::invoke:
function: std:replace
arguments:
text: ${mainLoadBalancer.ipAddress}
search: .
replace: '-'
return: result
- .lb.
- ${mainLoadBalancer.region}
- .scw.cloud
variables:
byID:
fn::invoke:
function: scaleway:loadbalancers:getCertificate
arguments:
certificateId: ${mainCertificate.id}
byName:
fn::invoke:
function: scaleway:loadbalancers:getCertificate
arguments:
name: ${mainCertificate.name}
lbId: ${mainLoadBalancer.id}
Using getLoadbalancerCertificate
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getLoadbalancerCertificate(args: GetLoadbalancerCertificateArgs, opts?: InvokeOptions): Promise<GetLoadbalancerCertificateResult>
function getLoadbalancerCertificateOutput(args: GetLoadbalancerCertificateOutputArgs, opts?: InvokeOptions): Output<GetLoadbalancerCertificateResult>def get_loadbalancer_certificate(certificate_id: Optional[str] = None,
lb_id: Optional[str] = None,
name: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetLoadbalancerCertificateResult
def get_loadbalancer_certificate_output(certificate_id: Optional[pulumi.Input[str]] = None,
lb_id: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetLoadbalancerCertificateResult]func LookupLoadbalancerCertificate(ctx *Context, args *LookupLoadbalancerCertificateArgs, opts ...InvokeOption) (*LookupLoadbalancerCertificateResult, error)
func LookupLoadbalancerCertificateOutput(ctx *Context, args *LookupLoadbalancerCertificateOutputArgs, opts ...InvokeOption) LookupLoadbalancerCertificateResultOutput> Note: This function is named LookupLoadbalancerCertificate in the Go SDK.
public static class GetLoadbalancerCertificate
{
public static Task<GetLoadbalancerCertificateResult> InvokeAsync(GetLoadbalancerCertificateArgs args, InvokeOptions? opts = null)
public static Output<GetLoadbalancerCertificateResult> Invoke(GetLoadbalancerCertificateInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetLoadbalancerCertificateResult> getLoadbalancerCertificate(GetLoadbalancerCertificateArgs args, InvokeOptions options)
public static Output<GetLoadbalancerCertificateResult> getLoadbalancerCertificate(GetLoadbalancerCertificateArgs args, InvokeOptions options)
fn::invoke:
function: scaleway:index/getLoadbalancerCertificate:getLoadbalancerCertificate
arguments:
# arguments dictionaryThe following arguments are supported:
- Certificate
Id string - The certificate ID.
- Only one of
nameandcertificate_idshould be specified.
- Only one of
- Lb
Id string - The Load Balancer ID this certificate is attached to.
- Name string
- The name of the Load Balancer certificate.
- When using a certificate
nameyou should specify thelb-id
- When using a certificate
- Certificate
Id string - The certificate ID.
- Only one of
nameandcertificate_idshould be specified.
- Only one of
- Lb
Id string - The Load Balancer ID this certificate is attached to.
- Name string
- The name of the Load Balancer certificate.
- When using a certificate
nameyou should specify thelb-id
- When using a certificate
- certificate
Id String - The certificate ID.
- Only one of
nameandcertificate_idshould be specified.
- Only one of
- lb
Id String - The Load Balancer ID this certificate is attached to.
- name String
- The name of the Load Balancer certificate.
- When using a certificate
nameyou should specify thelb-id
- When using a certificate
- certificate
Id string - The certificate ID.
- Only one of
nameandcertificate_idshould be specified.
- Only one of
- lb
Id string - The Load Balancer ID this certificate is attached to.
- name string
- The name of the Load Balancer certificate.
- When using a certificate
nameyou should specify thelb-id
- When using a certificate
- certificate_
id str - The certificate ID.
- Only one of
nameandcertificate_idshould be specified.
- Only one of
- lb_
id str - The Load Balancer ID this certificate is attached to.
- name str
- The name of the Load Balancer certificate.
- When using a certificate
nameyou should specify thelb-id
- When using a certificate
- certificate
Id String - The certificate ID.
- Only one of
nameandcertificate_idshould be specified.
- Only one of
- lb
Id String - The Load Balancer ID this certificate is attached to.
- name String
- The name of the Load Balancer certificate.
- When using a certificate
nameyou should specify thelb-id
- When using a certificate
getLoadbalancerCertificate Result
The following output properties are available:
- Common
Name string - Custom
Certificates List<Pulumiverse.Scaleway. Outputs. Get Loadbalancer Certificate Custom Certificate> - Fingerprint string
- Id string
- The provider-assigned unique ID for this managed resource.
- Letsencrypts
List<Pulumiverse.
Scaleway. Outputs. Get Loadbalancer Certificate Letsencrypt> - Not
Valid stringAfter - Not
Valid stringBefore - Status string
- Subject
Alternative List<string>Names - Certificate
Id string - Lb
Id string - Name string
- Common
Name string - Custom
Certificates []GetLoadbalancer Certificate Custom Certificate - Fingerprint string
- Id string
- The provider-assigned unique ID for this managed resource.
- Letsencrypts
[]Get
Loadbalancer Certificate Letsencrypt - Not
Valid stringAfter - Not
Valid stringBefore - Status string
- Subject
Alternative []stringNames - Certificate
Id string - Lb
Id string - Name string
- common
Name String - custom
Certificates List<GetLoadbalancer Certificate Custom Certificate> - fingerprint String
- id String
- The provider-assigned unique ID for this managed resource.
- letsencrypts
List<Get
Loadbalancer Certificate Letsencrypt> - not
Valid StringAfter - not
Valid StringBefore - status String
- subject
Alternative List<String>Names - certificate
Id String - lb
Id String - name String
- common
Name string - custom
Certificates GetLoadbalancer Certificate Custom Certificate[] - fingerprint string
- id string
- The provider-assigned unique ID for this managed resource.
- letsencrypts
Get
Loadbalancer Certificate Letsencrypt[] - not
Valid stringAfter - not
Valid stringBefore - status string
- subject
Alternative string[]Names - certificate
Id string - lb
Id string - name string
- common_
name str - custom_
certificates Sequence[GetLoadbalancer Certificate Custom Certificate] - fingerprint str
- id str
- The provider-assigned unique ID for this managed resource.
- letsencrypts
Sequence[Get
Loadbalancer Certificate Letsencrypt] - not_
valid_ strafter - not_
valid_ strbefore - status str
- subject_
alternative_ Sequence[str]names - certificate_
id str - lb_
id str - name str
- common
Name String - custom
Certificates List<Property Map> - fingerprint String
- id String
- The provider-assigned unique ID for this managed resource.
- letsencrypts List<Property Map>
- not
Valid StringAfter - not
Valid StringBefore - status String
- subject
Alternative List<String>Names - certificate
Id String - lb
Id String - name String
Supporting Types
GetLoadbalancerCertificateCustomCertificate
- Certificate
Chain string - The full PEM-formatted certificate chain
- Certificate
Chain string - The full PEM-formatted certificate chain
- certificate
Chain String - The full PEM-formatted certificate chain
- certificate
Chain string - The full PEM-formatted certificate chain
- certificate_
chain str - The full PEM-formatted certificate chain
- certificate
Chain String - The full PEM-formatted certificate chain
GetLoadbalancerCertificateLetsencrypt
- Common
Name string - The main domain name of the certificate
- Subject
Alternative List<string>Names - The alternative domain names of the certificate
- Common
Name string - The main domain name of the certificate
- Subject
Alternative []stringNames - The alternative domain names of the certificate
- common
Name String - The main domain name of the certificate
- subject
Alternative List<String>Names - The alternative domain names of the certificate
- common
Name string - The main domain name of the certificate
- subject
Alternative string[]Names - The alternative domain names of the certificate
- common_
name str - The main domain name of the certificate
- subject_
alternative_ Sequence[str]names - The alternative domain names of the certificate
- common
Name String - The main domain name of the certificate
- subject
Alternative List<String>Names - The alternative domain names of the certificate
Package Details
- Repository
- scaleway pulumiverse/pulumi-scaleway
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
scalewayTerraform Provider.
