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",
});
}
}
Inherited Members
Namespace: Pulumi.Gcp.ServiceAccount
Assembly: Pulumi.Gcp.dll
Syntax
public class Key : CustomResource
Constructors
View SourceKey(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 SourceKeyAlgorithm
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> |
Name
The name used for this key pair
Declaration
public Output<string> Name { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
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> |
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> |
PublicKey
The public key, base64 encoded
Declaration
public Output<string> PublicKey { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
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> |
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> |
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> |
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 SourceGet(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 |