1. Packages
  2. AWS
  3. API Docs
  4. iam
  5. getServerCertificate
AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi

aws.iam.getServerCertificate

Explore with Pulumi AI

aws logo
AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi

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

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const my-domain = aws.iam.getServerCertificate({
        namePrefix: "my-domain.org",
        latest: true,
    });
    const elb = new aws.elb.LoadBalancer("elb", {
        name: "my-domain-elb",
        listeners: [{
            instancePort: 8000,
            instanceProtocol: "https",
            lbPort: 443,
            lbProtocol: "https",
            sslCertificateId: my_domain.then(my_domain => my_domain.arn),
        }],
    });
    
    import pulumi
    import pulumi_aws as aws
    
    my_domain = aws.iam.get_server_certificate(name_prefix="my-domain.org",
        latest=True)
    elb = aws.elb.LoadBalancer("elb",
        name="my-domain-elb",
        listeners=[{
            "instance_port": 8000,
            "instance_protocol": "https",
            "lb_port": 443,
            "lb_protocol": "https",
            "ssl_certificate_id": my_domain.arn,
        }])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/elb"
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		my_domain, err := iam.LookupServerCertificate(ctx, &iam.LookupServerCertificateArgs{
    			NamePrefix: pulumi.StringRef("my-domain.org"),
    			Latest:     pulumi.BoolRef(true),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = elb.NewLoadBalancer(ctx, "elb", &elb.LoadBalancerArgs{
    			Name: pulumi.String("my-domain-elb"),
    			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
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var my_domain = Aws.Iam.GetServerCertificate.Invoke(new()
        {
            NamePrefix = "my-domain.org",
            Latest = true,
        });
    
        var elb = new Aws.Elb.LoadBalancer("elb", new()
        {
            Name = "my-domain-elb",
            Listeners = new[]
            {
                new Aws.Elb.Inputs.LoadBalancerListenerArgs
                {
                    InstancePort = 8000,
                    InstanceProtocol = "https",
                    LbPort = 443,
                    LbProtocol = "https",
                    SslCertificateId = my_domain.Apply(my_domain => my_domain.Apply(getServerCertificateResult => getServerCertificateResult.Arn)),
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.iam.IamFunctions;
    import com.pulumi.aws.iam.inputs.GetServerCertificateArgs;
    import com.pulumi.aws.elb.LoadBalancer;
    import com.pulumi.aws.elb.LoadBalancerArgs;
    import com.pulumi.aws.elb.inputs.LoadBalancerListenerArgs;
    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 my-domain = IamFunctions.getServerCertificate(GetServerCertificateArgs.builder()
                .namePrefix("my-domain.org")
                .latest(true)
                .build());
    
            var elb = new LoadBalancer("elb", LoadBalancerArgs.builder()
                .name("my-domain-elb")
                .listeners(LoadBalancerListenerArgs.builder()
                    .instancePort(8000)
                    .instanceProtocol("https")
                    .lbPort(443)
                    .lbProtocol("https")
                    .sslCertificateId(my_domain.arn())
                    .build())
                .build());
    
        }
    }
    
    resources:
      elb:
        type: aws:elb:LoadBalancer
        properties:
          name: my-domain-elb
          listeners:
            - instancePort: 8000
              instanceProtocol: https
              lbPort: 443
              lbProtocol: https
              sslCertificateId: ${["my-domain"].arn}
    variables:
      my-domain:
        fn::invoke:
          Function: aws:iam:getServerCertificate
          Arguments:
            namePrefix: my-domain.org
            latest: true
    

    Using getServerCertificate

    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 getServerCertificate(args: GetServerCertificateArgs, opts?: InvokeOptions): Promise<GetServerCertificateResult>
    function getServerCertificateOutput(args: GetServerCertificateOutputArgs, opts?: InvokeOptions): Output<GetServerCertificateResult>
    def get_server_certificate(latest: Optional[bool] = None,
                               name: Optional[str] = None,
                               name_prefix: Optional[str] = None,
                               path_prefix: Optional[str] = None,
                               opts: Optional[InvokeOptions] = None) -> GetServerCertificateResult
    def get_server_certificate_output(latest: Optional[pulumi.Input[bool]] = None,
                               name: Optional[pulumi.Input[str]] = None,
                               name_prefix: Optional[pulumi.Input[str]] = None,
                               path_prefix: Optional[pulumi.Input[str]] = None,
                               opts: Optional[InvokeOptions] = None) -> Output[GetServerCertificateResult]
    func LookupServerCertificate(ctx *Context, args *LookupServerCertificateArgs, opts ...InvokeOption) (*LookupServerCertificateResult, error)
    func LookupServerCertificateOutput(ctx *Context, args *LookupServerCertificateOutputArgs, opts ...InvokeOption) LookupServerCertificateResultOutput

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

    public static class GetServerCertificate 
    {
        public static Task<GetServerCertificateResult> InvokeAsync(GetServerCertificateArgs args, InvokeOptions? opts = null)
        public static Output<GetServerCertificateResult> Invoke(GetServerCertificateInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetServerCertificateResult> getServerCertificate(GetServerCertificateArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: aws:iam/getServerCertificate:getServerCertificate
      arguments:
        # arguments dictionary

    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 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
    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

    getServerCertificate Result

    The following output properties are available:

    Arn string
    is set to the ARN of the IAM Server Certificate
    CertificateBody string
    is the public key certificate (PEM-encoded). This is useful when configuring back-end instance authentication policy for load balancer
    CertificateChain string
    is the public key certificate chain (PEM-encoded) if exists, empty otherwise
    ExpirationDate string
    is set to the expiration date of the IAM Server Certificate
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    Path string
    is set to the path of the IAM Server Certificate
    UploadDate string
    is the date when the server certificate was uploaded
    Latest bool
    NamePrefix string
    PathPrefix string
    Arn string
    is set to the ARN of the IAM Server Certificate
    CertificateBody string
    is the public key certificate (PEM-encoded). This is useful when configuring back-end instance authentication policy for load balancer
    CertificateChain string
    is the public key certificate chain (PEM-encoded) if exists, empty otherwise
    ExpirationDate string
    is set to the expiration date of the IAM Server Certificate
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    Path string
    is set to the path of the IAM Server Certificate
    UploadDate string
    is the date when the server certificate was uploaded
    Latest bool
    NamePrefix string
    PathPrefix string
    arn String
    is set to the ARN of the IAM Server Certificate
    certificateBody String
    is the public key certificate (PEM-encoded). This is useful when configuring back-end instance authentication policy for load balancer
    certificateChain String
    is the public key certificate chain (PEM-encoded) if exists, empty otherwise
    expirationDate String
    is set to the expiration date of the IAM Server Certificate
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    path String
    is set to the path of the IAM Server Certificate
    uploadDate String
    is the date when the server certificate was uploaded
    latest Boolean
    namePrefix String
    pathPrefix String
    arn string
    is set to the ARN of the IAM Server Certificate
    certificateBody string
    is the public key certificate (PEM-encoded). This is useful when configuring back-end instance authentication policy for load balancer
    certificateChain string
    is the public key certificate chain (PEM-encoded) if exists, empty otherwise
    expirationDate string
    is set to the expiration date of the IAM Server Certificate
    id string
    The provider-assigned unique ID for this managed resource.
    name string
    path string
    is set to the path of the IAM Server Certificate
    uploadDate string
    is the date when the server certificate was uploaded
    latest boolean
    namePrefix string
    pathPrefix string
    arn str
    is set to the ARN of the IAM Server Certificate
    certificate_body str
    is the public key certificate (PEM-encoded). This is useful when configuring back-end instance authentication policy for load balancer
    certificate_chain str
    is the public key certificate chain (PEM-encoded) if exists, empty otherwise
    expiration_date str
    is set to the expiration date of the IAM Server Certificate
    id str
    The provider-assigned unique ID for this managed resource.
    name str
    path str
    is set to the path of the IAM Server Certificate
    upload_date str
    is the date when the server certificate was uploaded
    latest bool
    name_prefix str
    path_prefix str
    arn String
    is set to the ARN of the IAM Server Certificate
    certificateBody String
    is the public key certificate (PEM-encoded). This is useful when configuring back-end instance authentication policy for load balancer
    certificateChain String
    is the public key certificate chain (PEM-encoded) if exists, empty otherwise
    expirationDate String
    is set to the expiration date of the IAM Server Certificate
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    path String
    is set to the path of the IAM Server Certificate
    uploadDate String
    is the date when the server certificate was uploaded
    latest Boolean
    namePrefix String
    pathPrefix String

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo
    AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi