Google Cloud (GCP) Classic

v6.43.0 published on Tuesday, Nov 15, 2022 by Pulumi

getCertificate

Get info about a Google Compute SSL Certificate from its name.

Example Usage

using System.Collections.Generic;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var myCert = Gcp.Compute.GetCertificate.Invoke(new()
    {
        Name = "my-cert",
    });

    return new Dictionary<string, object?>
    {
        ["certificate"] = myCert.Apply(getCertificateResult => getCertificateResult.Certificate),
        ["certificateId"] = myCert.Apply(getCertificateResult => getCertificateResult.CertificateId),
        ["selfLink"] = myCert.Apply(getCertificateResult => getCertificateResult.SelfLink),
    };
});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/compute"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		myCert, err := compute.GetCertificate(ctx, &compute.GetCertificateArgs{
			Name: "my-cert",
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("certificate", myCert.Certificate)
		ctx.Export("certificateId", myCert.CertificateId)
		ctx.Export("selfLink", myCert.SelfLink)
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.ComputeFunctions;
import com.pulumi.gcp.compute.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 myCert = ComputeFunctions.getCertificate(GetCertificateArgs.builder()
            .name("my-cert")
            .build());

        ctx.export("certificate", myCert.applyValue(getCertificateResult -> getCertificateResult.certificate()));
        ctx.export("certificateId", myCert.applyValue(getCertificateResult -> getCertificateResult.certificateId()));
        ctx.export("selfLink", myCert.applyValue(getCertificateResult -> getCertificateResult.selfLink()));
    }
}
import pulumi
import pulumi_gcp as gcp

my_cert = gcp.compute.get_certificate(name="my-cert")
pulumi.export("certificate", my_cert.certificate)
pulumi.export("certificateId", my_cert.certificate_id)
pulumi.export("selfLink", my_cert.self_link)
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const myCert = gcp.compute.getCertificate({
    name: "my-cert",
});
export const certificate = myCert.then(myCert => myCert.certificate);
export const certificateId = myCert.then(myCert => myCert.certificateId);
export const selfLink = myCert.then(myCert => myCert.selfLink);
variables:
  myCert:
    fn::invoke:
      Function: gcp:compute:getCertificate
      Arguments:
        name: my-cert
outputs:
  certificate: ${myCert.certificate}
  certificateId: ${myCert.certificateId}
  selfLink: ${myCert.selfLink}

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(name: Optional[str] = None,
                    project: Optional[str] = None,
                    opts: Optional[InvokeOptions] = None) -> GetCertificateResult
def get_certificate_output(name: Optional[pulumi.Input[str]] = None,
                    project: Optional[pulumi.Input[str]] = None,
                    opts: Optional[InvokeOptions] = None) -> Output[GetCertificateResult]
func GetCertificate(ctx *Context, args *GetCertificateArgs, opts ...InvokeOption) (*GetCertificateResult, error)
func GetCertificateOutput(ctx *Context, args *GetCertificateOutputArgs, opts ...InvokeOption) GetCertificateResultOutput

> Note: This function is named GetCertificate 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)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: gcp:compute/getCertificate:getCertificate
  arguments:
    # arguments dictionary

The following arguments are supported:

Name string

The name of the certificate.

Project string

The project in which the resource belongs. If it is not provided, the provider project is used.

Name string

The name of the certificate.

Project string

The project in which the resource belongs. If it is not provided, the provider project is used.

name String

The name of the certificate.

project String

The project in which the resource belongs. If it is not provided, the provider project is used.

name string

The name of the certificate.

project string

The project in which the resource belongs. If it is not provided, the provider project is used.

name str

The name of the certificate.

project str

The project in which the resource belongs. If it is not provided, the provider project is used.

name String

The name of the certificate.

project String

The project in which the resource belongs. If it is not provided, the provider project is used.

getCertificate Result

The following output properties are available:

Certificate string
CertificateId int
CreationTimestamp string
Description string
Id string

The provider-assigned unique ID for this managed resource.

Name string
NamePrefix string
PrivateKey string
SelfLink string
Project string
Certificate string
CertificateId int
CreationTimestamp string
Description string
Id string

The provider-assigned unique ID for this managed resource.

Name string
NamePrefix string
PrivateKey string
SelfLink string
Project string
certificate String
certificateId Integer
creationTimestamp String
description String
id String

The provider-assigned unique ID for this managed resource.

name String
namePrefix String
privateKey String
selfLink String
project String
certificate string
certificateId number
creationTimestamp string
description string
id string

The provider-assigned unique ID for this managed resource.

name string
namePrefix string
privateKey string
selfLink string
project string
certificate str
certificate_id int
creation_timestamp str
description str
id str

The provider-assigned unique ID for this managed resource.

name str
name_prefix str
private_key str
self_link str
project str
certificate String
certificateId Number
creationTimestamp String
description String
id String

The provider-assigned unique ID for this managed resource.

name String
namePrefix String
privateKey String
selfLink String
project String

Package Details

Repository
https://github.com/pulumi/pulumi-gcp
License
Apache-2.0
Notes

This Pulumi package is based on the google-beta Terraform Provider.