Show / Hide Table of Contents

Class Key

Creates and manages service account key-pairs, which allow the user to establish identity of a service account outside of GCP. For more information, see the official documentation and API.

Example Usage, creating a new Key Pair

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var myaccount = new Gcp.ServiceAccount.Account("myaccount", new Gcp.ServiceAccount.AccountArgs
    {
        AccountId = "myaccount",
        DisplayName = "My Service Account",
    });
    var mykey = new Gcp.ServiceAccount.Key("mykey", new Gcp.ServiceAccount.KeyArgs
    {
        ServiceAccountId = myaccount.Name,
        PublicKeyType = "TYPE_X509_PEM_FILE",
    });
}

}
Inheritance
System.Object
Resource
CustomResource
Key
Inherited Members
CustomResource.Id
Resource.GetResourceType()
Resource.GetResourceName()
Resource.Urn
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.Gcp.ServiceAccount
Assembly: Pulumi.Gcp.dll
Syntax
public class Key : CustomResource

Constructors

View Source

Key(String, KeyArgs, CustomResourceOptions)

Create a Key resource with the given unique name, arguments, and options.

Declaration
public Key(string name, KeyArgs args, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resource

KeyArgs args

The arguments used to populate this resource's properties

CustomResourceOptions options

A bag of options that control this resource's behavior

Properties

View Source

KeyAlgorithm

The algorithm used to generate the key. KEY_ALG_RSA_2048 is the default algorithm. Valid values are listed at ServiceAccountPrivateKeyType (only used on create)

Declaration
public Output<string> KeyAlgorithm { get; }
Property Value
Type Description
Output<System.String>
View Source

Name

The name used for this key pair

Declaration
public Output<string> Name { get; }
Property Value
Type Description
Output<System.String>
View Source

PrivateKey

The private key in JSON format, base64 encoded. This is what you normally get as a file when creating service account keys through the CLI or web console. This is only populated when creating a new key.

Declaration
public Output<string> PrivateKey { get; }
Property Value
Type Description
Output<System.String>
View Source

PrivateKeyType

The output format of the private key. TYPE_GOOGLE_CREDENTIALS_FILE is the default output format.

Declaration
public Output<string> PrivateKeyType { get; }
Property Value
Type Description
Output<System.String>
View Source

PublicKey

The public key, base64 encoded

Declaration
public Output<string> PublicKey { get; }
Property Value
Type Description
Output<System.String>
View Source

PublicKeyType

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

Declaration
public Output<string> PublicKeyType { get; }
Property Value
Type Description
Output<System.String>
View Source

ServiceAccountId

The Service account id of the Key Pair. This can be a string in the format {ACCOUNT} or projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}, where {ACCOUNT} is the email address or unique id of the service account. If the {ACCOUNT} syntax is used, the project will be inferred from the account.

Declaration
public Output<string> ServiceAccountId { get; }
Property Value
Type Description
Output<System.String>
View Source

ValidAfter

The key can be used after this timestamp. A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: "2014-10-02T15:01:23.045123456Z".

Declaration
public Output<string> ValidAfter { get; }
Property Value
Type Description
Output<System.String>
View Source

ValidBefore

The key can be used before this timestamp. A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: "2014-10-02T15:01:23.045123456Z".

Declaration
public Output<string> ValidBefore { get; }
Property Value
Type Description
Output<System.String>

Methods

View Source

Get(String, Input<String>, KeyState, CustomResourceOptions)

Get an existing Key resource's state with the given name, ID, and optional extra properties used to qualify the lookup.

Declaration
public static Key Get(string name, Input<string> id, KeyState state = null, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resulting resource.

Input<System.String> id

The unique provider ID of the resource to lookup.

KeyState state

Any extra arguments used during the lookup.

CustomResourceOptions options

A bag of options that control this resource's behavior

Returns
Type Description
Key
  • View Source
Back to top Copyright 2016-2020, Pulumi Corporation.