GetServerCertificate

Use this data source to lookup information about IAM Server Certificates.

Import

The import function will read in certificate body, certificate chain (if it exists), id, name, path, and arn. It will not retrieve the private key which is not available through the AWS API.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var my_domain = Output.Create(Aws.Iam.GetServerCertificate.InvokeAsync(new Aws.Iam.GetServerCertificateArgs
        {
            Latest = true,
            NamePrefix = "my-domain.org",
        }));
        var elb = new Aws.Elb.LoadBalancer("elb", new Aws.Elb.LoadBalancerArgs
        {
            Listeners = 
            {
                new Aws.Elb.Inputs.LoadBalancerListenerArgs
                {
                    InstancePort = 8000,
                    InstanceProtocol = "https",
                    LbPort = 443,
                    LbProtocol = "https",
                    SslCertificateId = my_domain.Apply(my_domain => my_domain.Arn),
                },
            },
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-aws/sdk/v2/go/aws/elb"
    "github.com/pulumi/pulumi-aws/sdk/v2/go/aws/iam"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        opt0 := true
        opt1 := "my-domain.org"
        my_domain, err := iam.LookupServerCertificate(ctx, &iam.LookupServerCertificateArgs{
            Latest:     &opt0,
            NamePrefix: &opt1,
        }, nil)
        if err != nil {
            return err
        }
        _, err = elb.NewLoadBalancer(ctx, "elb", &elb.LoadBalancerArgs{
            Listeners: elb.LoadBalancerListenerArray{
                &elb.LoadBalancerListenerArgs{
                    InstancePort:     pulumi.Int(8000),
                    InstanceProtocol: pulumi.String("https"),
                    LbPort:           pulumi.Int(443),
                    LbProtocol:       pulumi.String("https"),
                    SslCertificateId: pulumi.String(my_domain.Arn),
                },
            },
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_aws as aws

my_domain = aws.iam.get_server_certificate(latest=True,
    name_prefix="my-domain.org")
elb = aws.elb.LoadBalancer("elb", listeners=[{
    "instance_port": 8000,
    "instanceProtocol": "https",
    "lb_port": 443,
    "lbProtocol": "https",
    "sslCertificateId": my_domain.arn,
}])
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const my_domain = pulumi.output(aws.iam.getServerCertificate({
    latest: true,
    namePrefix: "my-domain.org",
}, { async: true }));
const elb = new aws.elb.LoadBalancer("elb", {
    listeners: [{
        instancePort: 8000,
        instanceProtocol: "https",
        lbPort: 443,
        lbProtocol: "https",
        sslCertificateId: my_domain.arn,
    }],
});

Using GetServerCertificate

function getServerCertificate(args: GetServerCertificateArgs, opts?: InvokeOptions): Promise<GetServerCertificateResult>
function  get_server_certificate(latest=None, name=None, name_prefix=None, path_prefix=None, opts=None)
func LookupServerCertificate(ctx *Context, args *LookupServerCertificateArgs, opts ...InvokeOption) (*LookupServerCertificateResult, error)

Note: This function is named LookupServerCertificate in the Go SDK.

public static class GetServerCertificate {
    public static Task<GetServerCertificateResult> InvokeAsync(GetServerCertificateArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

Latest bool

sort results by expiration date. returns the certificate with expiration date in furthest in the future.

Name string

exact name of the cert to lookup

NamePrefix string

prefix of cert to filter by

PathPrefix string

prefix of path to filter by

Latest bool

sort results by expiration date. returns the certificate with expiration date in furthest in the future.

Name string

exact name of the cert to lookup

NamePrefix string

prefix of cert to filter by

PathPrefix string

prefix of path to filter by

latest boolean

sort results by expiration date. returns the certificate with expiration date in furthest in the future.

name string

exact name of the cert to lookup

namePrefix string

prefix of cert to filter by

pathPrefix string

prefix of path to filter by

latest bool

sort results by expiration date. returns the certificate with expiration date in furthest in the future.

name str

exact name of the cert to lookup

name_prefix str

prefix of cert to filter by

path_prefix str

prefix of path to filter by

GetServerCertificate Result

The following output properties are available:

Arn string
CertificateBody string
CertificateChain string
ExpirationDate string
Id string

The provider-assigned unique ID for this managed resource.

Name string
Path string
UploadDate string
Latest bool
NamePrefix string
PathPrefix string
Arn string
CertificateBody string
CertificateChain string
ExpirationDate string
Id string

The provider-assigned unique ID for this managed resource.

Name string
Path string
UploadDate string
Latest bool
NamePrefix string
PathPrefix string
arn string
certificateBody string
certificateChain string
expirationDate string
id string

The provider-assigned unique ID for this managed resource.

name string
path string
uploadDate string
latest boolean
namePrefix string
pathPrefix string
arn str
certificate_body str
certificate_chain str
expiration_date str
id str

The provider-assigned unique ID for this managed resource.

name str
path str
upload_date str
latest bool
name_prefix str
path_prefix str

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.