Google Cloud Classic v8.4.1 published on Tuesday, Oct 1, 2024 by Pulumi
gcp.serviceaccount.getAccountKey
Explore with Pulumi AI
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")
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v8/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
})
}
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 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
Using getAccountKey
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 getAccountKey(args: GetAccountKeyArgs, opts?: InvokeOptions): Promise<GetAccountKeyResult>
function getAccountKeyOutput(args: GetAccountKeyOutputArgs, opts?: InvokeOptions): Output<GetAccountKeyResult>
def get_account_key(name: Optional[str] = None,
project: Optional[str] = None,
public_key_type: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetAccountKeyResult
def get_account_key_output(name: Optional[pulumi.Input[str]] = None,
project: Optional[pulumi.Input[str]] = None,
public_key_type: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetAccountKeyResult]
func GetAccountKey(ctx *Context, args *GetAccountKeyArgs, opts ...InvokeOption) (*GetAccountKeyResult, error)
func GetAccountKeyOutput(ctx *Context, args *GetAccountKeyOutputArgs, opts ...InvokeOption) GetAccountKeyResultOutput
> Note: This function is named GetAccountKey
in the Go SDK.
public static class GetAccountKey
{
public static Task<GetAccountKeyResult> InvokeAsync(GetAccountKeyArgs args, InvokeOptions? opts = null)
public static Output<GetAccountKeyResult> Invoke(GetAccountKeyInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetAccountKeyResult> getAccountKey(GetAccountKeyArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: gcp:serviceaccount/getAccountKey:getAccountKey
arguments:
# arguments dictionary
The following arguments are supported:
- Name string
- 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 string
- The ID of the project that the service account will be created in. Defaults to the provider project configuration.
- Public
Key stringType - The output format of the public key requested. TYPE_X509_PEM_FILE is the default output format.
- Name string
- 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 string
- The ID of the project that the service account will be created in. Defaults to the provider project configuration.
- Public
Key stringType - The output format of the public key requested. TYPE_X509_PEM_FILE is the default output format.
- name String
- 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 String
- The ID of the project that the service account will be created in. Defaults to the provider project configuration.
- public
Key StringType - The output format of the public key requested. TYPE_X509_PEM_FILE is the default output format.
- name string
- 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 string
- The ID of the project that the service account will be created in. Defaults to the provider project configuration.
- public
Key stringType - The output format of the public key requested. TYPE_X509_PEM_FILE is the default output format.
- name str
- 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 str
- The ID of the project that the service account will be created in. Defaults to the provider project configuration.
- public_
key_ strtype - The output format of the public key requested. TYPE_X509_PEM_FILE is the default output format.
- name String
- 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 String
- The ID of the project that the service account will be created in. Defaults to the provider project configuration.
- public
Key StringType - The output format of the public key requested. TYPE_X509_PEM_FILE is the default output format.
getAccountKey Result
The following output properties are available:
- Id string
- The provider-assigned unique ID for this managed resource.
- Key
Algorithm string - Name string
- Public
Key string - The public key, base64 encoded
- Project string
- Public
Key stringType
- Id string
- The provider-assigned unique ID for this managed resource.
- Key
Algorithm string - Name string
- Public
Key string - The public key, base64 encoded
- Project string
- Public
Key stringType
- id String
- The provider-assigned unique ID for this managed resource.
- key
Algorithm String - name String
- public
Key String - The public key, base64 encoded
- project String
- public
Key StringType
- id string
- The provider-assigned unique ID for this managed resource.
- key
Algorithm string - name string
- public
Key string - The public key, base64 encoded
- project string
- public
Key stringType
- id str
- The provider-assigned unique ID for this managed resource.
- key_
algorithm str - name str
- public_
key str - The public key, base64 encoded
- project str
- public_
key_ strtype
- id String
- The provider-assigned unique ID for this managed resource.
- key
Algorithm String - name String
- public
Key String - The public key, base64 encoded
- project String
- public
Key StringType
Package Details
- Repository
- Google Cloud (GCP) Classic pulumi/pulumi-gcp
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
google-beta
Terraform Provider.