getAccountKey

Get service account public key. For more information, see the official documentation and API.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const myaccount = new gcp.serviceaccount.Account("myaccount", {accountId: "dev-foo-account"});
const mykeyKey = new gcp.serviceaccount.Key("mykey", {serviceAccountId: myaccount.name});
const mykey = gcp.serviceaccount.getAccountKeyOutput({
name: mykeyKey.name,
publicKeyType: "TYPE_X509_PEM_FILE",
});
import pulumi
import pulumi_gcp as gcp
myaccount = gcp.serviceaccount.Account("myaccount", account_id="dev-foo-account")
mykey_key = gcp.serviceaccount.Key("mykey", service_account_id=myaccount.name)
mykey = gcp.serviceaccount.get_account_key_output(name=mykey_key.name,
public_key_type="TYPE_X509_PEM_FILE")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var myaccount = new Gcp.ServiceAccount.Account("myaccount", new()
{
AccountId = "dev-foo-account",
});
var mykeyKey = new Gcp.ServiceAccount.Key("mykey", new()
{
ServiceAccountId = myaccount.Name,
});
var mykey = Gcp.ServiceAccount.GetAccountKey.Invoke(new()
{
Name = mykeyKey.Name,
PublicKeyType = "TYPE_X509_PEM_FILE",
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/serviceaccount"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
myaccount, err := serviceaccount.NewAccount(ctx, "myaccount", &serviceaccount.AccountArgs{
AccountId: pulumi.String("dev-foo-account"),
})
if err != nil {
return err
}
mykeyKey, err := serviceaccount.NewKey(ctx, "mykey", &serviceaccount.KeyArgs{
ServiceAccountId: myaccount.Name,
})
if err != nil {
return err
}
_ = serviceaccount.GetAccountKeyOutput(ctx, serviceaccount.GetAccountKeyOutputArgs{
Name: mykeyKey.Name,
PublicKeyType: pulumi.String("TYPE_X509_PEM_FILE"),
}, nil)
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.serviceaccount.Account;
import com.pulumi.gcp.serviceaccount.AccountArgs;
import com.pulumi.gcp.serviceaccount.Key;
import com.pulumi.gcp.serviceaccount.KeyArgs;
import com.pulumi.gcp.serviceaccount.ServiceaccountFunctions;
import com.pulumi.gcp.serviceaccount.inputs.GetAccountKeyArgs;
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 myaccount = new Account("myaccount", AccountArgs.builder()
.accountId("dev-foo-account")
.build());
var mykeyKey = new Key("mykeyKey", KeyArgs.builder()
.serviceAccountId(myaccount.name())
.build());
final var mykey = ServiceaccountFunctions.getAccountKey(GetAccountKeyArgs.builder()
.name(mykeyKey.name())
.publicKeyType("TYPE_X509_PEM_FILE")
.build());
}
}
resources:
myaccount:
type: gcp:serviceaccount:Account
properties:
accountId: dev-foo-account
mykeyKey:
type: gcp:serviceaccount:Key
name: mykey
properties:
serviceAccountId: ${myaccount.name}
variables:
mykey:
fn::invoke:
Function: gcp:serviceaccount:getAccountKey
Arguments:
name: ${mykeyKey.name}
publicKeyType: TYPE_X509_PEM_FILE

Return

A collection of values returned by getAccountKey.

Parameters

argument

A collection of arguments for invoking getAccountKey.


suspend fun getAccountKey(name: String, project: String? = null, publicKeyType: String? = null): GetAccountKeyResult

Return

A collection of values returned by getAccountKey.

Parameters

name

The name of the service account key. This must have format projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}/keys/{KEYID}, where {ACCOUNT} is the email address or unique id of the service account.

project

The ID of the project that the service account will be created in. Defaults to the provider project configuration.

publicKeyType

The output format of the public key requested. TYPE_X509_PEM_FILE is the default output format.

See also


Return

A collection of values returned by getAccountKey.

Parameters

argument

Builder for com.pulumi.gcp.serviceaccount.kotlin.inputs.GetAccountKeyPlainArgs.

See also