1. Packages
  2. Ionoscloud
  3. API Docs
  4. cert
  5. getCertificate
IonosCloud v0.2.2 published on Monday, May 12, 2025 by ionos-cloud

ionoscloud.cert.getCertificate

Explore with Pulumi AI

ionoscloud logo
IonosCloud v0.2.2 published on Monday, May 12, 2025 by ionos-cloud

    The Certificate data source can be used to search for and return an existing certificate. You can provide a string for either id or name parameters which will be compared with provisioned certificates. If a single match is found, it will be returned. If your search results in multiple matches, an error will be returned. When this happens, please refine your search string so that it is specific enough to return only one result.

    Example Usage

    By ID

    import * as pulumi from "@pulumi/pulumi";
    import * as ionoscloud from "@pulumi/ionoscloud";
    
    const example = ionoscloud.cert.getCertificate({
        id: "certificate_id",
    });
    
    import pulumi
    import pulumi_ionoscloud as ionoscloud
    
    example = ionoscloud.cert.get_certificate(id="certificate_id")
    
    package main
    
    import (
    	"github.com/ionos-cloud/pulumi-ionoscloud/sdk/go/ionoscloud/cert"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := cert.LookupCertificate(ctx, &cert.LookupCertificateArgs{
    			Id: pulumi.StringRef("certificate_id"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ionoscloud = Pulumi.Ionoscloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Ionoscloud.Cert.GetCertificate.Invoke(new()
        {
            Id = "certificate_id",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ionoscloud.cert.CertFunctions;
    import com.pulumi.ionoscloud.cert.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) {
            final var example = CertFunctions.getCertificate(GetCertificateArgs.builder()
                .id("certificate_id")
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: ionoscloud:cert:getCertificate
          arguments:
            id: certificate_id
    

    By Name

    import * as pulumi from "@pulumi/pulumi";
    import * as ionoscloud from "@pulumi/ionoscloud";
    
    const example = ionoscloud.cert.getCertificate({
        name: "Certificate Name Example",
    });
    
    import pulumi
    import pulumi_ionoscloud as ionoscloud
    
    example = ionoscloud.cert.get_certificate(name="Certificate Name Example")
    
    package main
    
    import (
    	"github.com/ionos-cloud/pulumi-ionoscloud/sdk/go/ionoscloud/cert"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := cert.LookupCertificate(ctx, &cert.LookupCertificateArgs{
    			Name: pulumi.StringRef("Certificate Name Example"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ionoscloud = Pulumi.Ionoscloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Ionoscloud.Cert.GetCertificate.Invoke(new()
        {
            Name = "Certificate Name Example",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ionoscloud.cert.CertFunctions;
    import com.pulumi.ionoscloud.cert.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) {
            final var example = CertFunctions.getCertificate(GetCertificateArgs.builder()
                .name("Certificate Name Example")
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: ionoscloud:cert:getCertificate
          arguments:
            name: Certificate Name Example
    

    Using getCertificate

    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 getCertificate(args: GetCertificateArgs, opts?: InvokeOptions): Promise<GetCertificateResult>
    function getCertificateOutput(args: GetCertificateOutputArgs, opts?: InvokeOptions): Output<GetCertificateResult>
    def get_certificate(certificate: Optional[str] = None,
                        certificate_chain: Optional[str] = None,
                        id: Optional[str] = None,
                        name: Optional[str] = None,
                        opts: Optional[InvokeOptions] = None) -> GetCertificateResult
    def get_certificate_output(certificate: Optional[pulumi.Input[str]] = None,
                        certificate_chain: Optional[pulumi.Input[str]] = None,
                        id: Optional[pulumi.Input[str]] = None,
                        name: Optional[pulumi.Input[str]] = None,
                        opts: Optional[InvokeOptions] = None) -> Output[GetCertificateResult]
    func LookupCertificate(ctx *Context, args *LookupCertificateArgs, opts ...InvokeOption) (*LookupCertificateResult, error)
    func LookupCertificateOutput(ctx *Context, args *LookupCertificateOutputArgs, opts ...InvokeOption) LookupCertificateResultOutput

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

    public static class GetCertificate 
    {
        public static Task<GetCertificateResult> InvokeAsync(GetCertificateArgs args, InvokeOptions? opts = null)
        public static Output<GetCertificateResult> Invoke(GetCertificateInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetCertificateResult> getCertificate(GetCertificateArgs args, InvokeOptions options)
    public static Output<GetCertificateResult> getCertificate(GetCertificateArgs args, InvokeOptions options)
    
    fn::invoke:
      function: ionoscloud:cert/getCertificate:getCertificate
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Certificate string
    Certificate body.
    CertificateChain string
    Certificate chain.
    Id string

    ID of the certificate you want to search for.

    Either name or id must be provided, or both. If none are provided, the datasource will return an error.

    Name string
    Name of an existing certificate that you want to search for.
    Certificate string
    Certificate body.
    CertificateChain string
    Certificate chain.
    Id string

    ID of the certificate you want to search for.

    Either name or id must be provided, or both. If none are provided, the datasource will return an error.

    Name string
    Name of an existing certificate that you want to search for.
    certificate String
    Certificate body.
    certificateChain String
    Certificate chain.
    id String

    ID of the certificate you want to search for.

    Either name or id must be provided, or both. If none are provided, the datasource will return an error.

    name String
    Name of an existing certificate that you want to search for.
    certificate string
    Certificate body.
    certificateChain string
    Certificate chain.
    id string

    ID of the certificate you want to search for.

    Either name or id must be provided, or both. If none are provided, the datasource will return an error.

    name string
    Name of an existing certificate that you want to search for.
    certificate str
    Certificate body.
    certificate_chain str
    Certificate chain.
    id str

    ID of the certificate you want to search for.

    Either name or id must be provided, or both. If none are provided, the datasource will return an error.

    name str
    Name of an existing certificate that you want to search for.
    certificate String
    Certificate body.
    certificateChain String
    Certificate chain.
    id String

    ID of the certificate you want to search for.

    Either name or id must be provided, or both. If none are provided, the datasource will return an error.

    name String
    Name of an existing certificate that you want to search for.

    getCertificate Result

    The following output properties are available:

    Certificate string
    Certificate body.
    CertificateChain string
    Certificate chain.
    Id string
    The id of the certificate.
    Name string
    The name of the certificate.
    Certificate string
    Certificate body.
    CertificateChain string
    Certificate chain.
    Id string
    The id of the certificate.
    Name string
    The name of the certificate.
    certificate String
    Certificate body.
    certificateChain String
    Certificate chain.
    id String
    The id of the certificate.
    name String
    The name of the certificate.
    certificate string
    Certificate body.
    certificateChain string
    Certificate chain.
    id string
    The id of the certificate.
    name string
    The name of the certificate.
    certificate str
    Certificate body.
    certificate_chain str
    Certificate chain.
    id str
    The id of the certificate.
    name str
    The name of the certificate.
    certificate String
    Certificate body.
    certificateChain String
    Certificate chain.
    id String
    The id of the certificate.
    name String
    The name of the certificate.

    Package Details

    Repository
    ionoscloud ionos-cloud/pulumi-ionoscloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the ionoscloud Terraform Provider.
    ionoscloud logo
    IonosCloud v0.2.2 published on Monday, May 12, 2025 by ionos-cloud