gcp logo
Google Cloud Classic v6.52.0, Mar 22 23

gcp.storage.HmacKey

The hmacKeys resource represents an HMAC key within Cloud Storage. The resource consists of a secret and HMAC key metadata. HMAC keys can be used as credentials for service accounts.

To get more information about HmacKey, see:

Warning: All arguments including the secret value will be stored in the raw state as plain-text. On import, the secret value will not be retrieved.

Warning: All arguments including secret will be stored in the raw state as plain-text.

Example Usage

Storage Hmac Key

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

return await Deployment.RunAsync(() => 
{
    // Create a new service account
    var serviceAccount = new Gcp.ServiceAccount.Account("serviceAccount", new()
    {
        AccountId = "my-svc-acc",
    });

    //Create the HMAC key for the associated service account
    var key = new Gcp.Storage.HmacKey("key", new()
    {
        ServiceAccountEmail = serviceAccount.Email,
    });

});
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		serviceAccount, err := serviceAccount.NewAccount(ctx, "serviceAccount", &serviceAccount.AccountArgs{
			AccountId: pulumi.String("my-svc-acc"),
		})
		if err != nil {
			return err
		}
		_, err = storage.NewHmacKey(ctx, "key", &storage.HmacKeyArgs{
			ServiceAccountEmail: serviceAccount.Email,
		})
		if err != nil {
			return err
		}
		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.storage.HmacKey;
import com.pulumi.gcp.storage.HmacKeyArgs;
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 serviceAccount = new Account("serviceAccount", AccountArgs.builder()        
            .accountId("my-svc-acc")
            .build());

        var key = new HmacKey("key", HmacKeyArgs.builder()        
            .serviceAccountEmail(serviceAccount.email())
            .build());

    }
}
import pulumi
import pulumi_gcp as gcp

# Create a new service account
service_account = gcp.service_account.Account("serviceAccount", account_id="my-svc-acc")
#Create the HMAC key for the associated service account
key = gcp.storage.HmacKey("key", service_account_email=service_account.email)
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

// Create a new service account
const serviceAccount = new gcp.serviceaccount.Account("serviceAccount", {accountId: "my-svc-acc"});
//Create the HMAC key for the associated service account
const key = new gcp.storage.HmacKey("key", {serviceAccountEmail: serviceAccount.email});
resources:
  # Create a new service account
  serviceAccount:
    type: gcp:serviceAccount:Account
    properties:
      accountId: my-svc-acc
  #Create the HMAC key for the associated service account
  key:
    type: gcp:storage:HmacKey
    properties:
      serviceAccountEmail: ${serviceAccount.email}

Create HmacKey Resource

new HmacKey(name: string, args: HmacKeyArgs, opts?: CustomResourceOptions);
@overload
def HmacKey(resource_name: str,
            opts: Optional[ResourceOptions] = None,
            project: Optional[str] = None,
            service_account_email: Optional[str] = None,
            state: Optional[str] = None)
@overload
def HmacKey(resource_name: str,
            args: HmacKeyArgs,
            opts: Optional[ResourceOptions] = None)
func NewHmacKey(ctx *Context, name string, args HmacKeyArgs, opts ...ResourceOption) (*HmacKey, error)
public HmacKey(string name, HmacKeyArgs args, CustomResourceOptions? opts = null)
public HmacKey(String name, HmacKeyArgs args)
public HmacKey(String name, HmacKeyArgs args, CustomResourceOptions options)
type: gcp:storage:HmacKey
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args HmacKeyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args HmacKeyArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args HmacKeyArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args HmacKeyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args HmacKeyArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

HmacKey Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The HmacKey resource accepts the following input properties:

ServiceAccountEmail string

The email address of the key's associated service account.

Project string

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

State string

The state of the key. Can be set to one of ACTIVE, INACTIVE. Default value is ACTIVE. Possible values are ACTIVE and INACTIVE.

ServiceAccountEmail string

The email address of the key's associated service account.

Project string

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

State string

The state of the key. Can be set to one of ACTIVE, INACTIVE. Default value is ACTIVE. Possible values are ACTIVE and INACTIVE.

serviceAccountEmail String

The email address of the key's associated service account.

project String

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

state String

The state of the key. Can be set to one of ACTIVE, INACTIVE. Default value is ACTIVE. Possible values are ACTIVE and INACTIVE.

serviceAccountEmail string

The email address of the key's associated service account.

project string

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

state string

The state of the key. Can be set to one of ACTIVE, INACTIVE. Default value is ACTIVE. Possible values are ACTIVE and INACTIVE.

service_account_email str

The email address of the key's associated service account.

project str

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

state str

The state of the key. Can be set to one of ACTIVE, INACTIVE. Default value is ACTIVE. Possible values are ACTIVE and INACTIVE.

serviceAccountEmail String

The email address of the key's associated service account.

project String

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

state String

The state of the key. Can be set to one of ACTIVE, INACTIVE. Default value is ACTIVE. Possible values are ACTIVE and INACTIVE.

Outputs

All input properties are implicitly available as output properties. Additionally, the HmacKey resource produces the following output properties:

AccessId string

The access ID of the HMAC Key.

Id string

The provider-assigned unique ID for this managed resource.

Secret string

HMAC secret key material. Note: This property is sensitive and will not be displayed in the plan.

TimeCreated string

'The creation time of the HMAC key in RFC 3339 format. '

Updated string

'The last modification time of the HMAC key metadata in RFC 3339 format.'

AccessId string

The access ID of the HMAC Key.

Id string

The provider-assigned unique ID for this managed resource.

Secret string

HMAC secret key material. Note: This property is sensitive and will not be displayed in the plan.

TimeCreated string

'The creation time of the HMAC key in RFC 3339 format. '

Updated string

'The last modification time of the HMAC key metadata in RFC 3339 format.'

accessId String

The access ID of the HMAC Key.

id String

The provider-assigned unique ID for this managed resource.

secret String

HMAC secret key material. Note: This property is sensitive and will not be displayed in the plan.

timeCreated String

'The creation time of the HMAC key in RFC 3339 format. '

updated String

'The last modification time of the HMAC key metadata in RFC 3339 format.'

accessId string

The access ID of the HMAC Key.

id string

The provider-assigned unique ID for this managed resource.

secret string

HMAC secret key material. Note: This property is sensitive and will not be displayed in the plan.

timeCreated string

'The creation time of the HMAC key in RFC 3339 format. '

updated string

'The last modification time of the HMAC key metadata in RFC 3339 format.'

access_id str

The access ID of the HMAC Key.

id str

The provider-assigned unique ID for this managed resource.

secret str

HMAC secret key material. Note: This property is sensitive and will not be displayed in the plan.

time_created str

'The creation time of the HMAC key in RFC 3339 format. '

updated str

'The last modification time of the HMAC key metadata in RFC 3339 format.'

accessId String

The access ID of the HMAC Key.

id String

The provider-assigned unique ID for this managed resource.

secret String

HMAC secret key material. Note: This property is sensitive and will not be displayed in the plan.

timeCreated String

'The creation time of the HMAC key in RFC 3339 format. '

updated String

'The last modification time of the HMAC key metadata in RFC 3339 format.'

Look up Existing HmacKey Resource

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

public static get(name: string, id: Input<ID>, state?: HmacKeyState, opts?: CustomResourceOptions): HmacKey
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        access_id: Optional[str] = None,
        project: Optional[str] = None,
        secret: Optional[str] = None,
        service_account_email: Optional[str] = None,
        state: Optional[str] = None,
        time_created: Optional[str] = None,
        updated: Optional[str] = None) -> HmacKey
func GetHmacKey(ctx *Context, name string, id IDInput, state *HmacKeyState, opts ...ResourceOption) (*HmacKey, error)
public static HmacKey Get(string name, Input<string> id, HmacKeyState? state, CustomResourceOptions? opts = null)
public static HmacKey get(String name, Output<String> id, HmacKeyState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
AccessId string

The access ID of the HMAC Key.

Project string

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

Secret string

HMAC secret key material. Note: This property is sensitive and will not be displayed in the plan.

ServiceAccountEmail string

The email address of the key's associated service account.

State string

The state of the key. Can be set to one of ACTIVE, INACTIVE. Default value is ACTIVE. Possible values are ACTIVE and INACTIVE.

TimeCreated string

'The creation time of the HMAC key in RFC 3339 format. '

Updated string

'The last modification time of the HMAC key metadata in RFC 3339 format.'

AccessId string

The access ID of the HMAC Key.

Project string

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

Secret string

HMAC secret key material. Note: This property is sensitive and will not be displayed in the plan.

ServiceAccountEmail string

The email address of the key's associated service account.

State string

The state of the key. Can be set to one of ACTIVE, INACTIVE. Default value is ACTIVE. Possible values are ACTIVE and INACTIVE.

TimeCreated string

'The creation time of the HMAC key in RFC 3339 format. '

Updated string

'The last modification time of the HMAC key metadata in RFC 3339 format.'

accessId String

The access ID of the HMAC Key.

project String

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

secret String

HMAC secret key material. Note: This property is sensitive and will not be displayed in the plan.

serviceAccountEmail String

The email address of the key's associated service account.

state String

The state of the key. Can be set to one of ACTIVE, INACTIVE. Default value is ACTIVE. Possible values are ACTIVE and INACTIVE.

timeCreated String

'The creation time of the HMAC key in RFC 3339 format. '

updated String

'The last modification time of the HMAC key metadata in RFC 3339 format.'

accessId string

The access ID of the HMAC Key.

project string

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

secret string

HMAC secret key material. Note: This property is sensitive and will not be displayed in the plan.

serviceAccountEmail string

The email address of the key's associated service account.

state string

The state of the key. Can be set to one of ACTIVE, INACTIVE. Default value is ACTIVE. Possible values are ACTIVE and INACTIVE.

timeCreated string

'The creation time of the HMAC key in RFC 3339 format. '

updated string

'The last modification time of the HMAC key metadata in RFC 3339 format.'

access_id str

The access ID of the HMAC Key.

project str

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

secret str

HMAC secret key material. Note: This property is sensitive and will not be displayed in the plan.

service_account_email str

The email address of the key's associated service account.

state str

The state of the key. Can be set to one of ACTIVE, INACTIVE. Default value is ACTIVE. Possible values are ACTIVE and INACTIVE.

time_created str

'The creation time of the HMAC key in RFC 3339 format. '

updated str

'The last modification time of the HMAC key metadata in RFC 3339 format.'

accessId String

The access ID of the HMAC Key.

project String

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

secret String

HMAC secret key material. Note: This property is sensitive and will not be displayed in the plan.

serviceAccountEmail String

The email address of the key's associated service account.

state String

The state of the key. Can be set to one of ACTIVE, INACTIVE. Default value is ACTIVE. Possible values are ACTIVE and INACTIVE.

timeCreated String

'The creation time of the HMAC key in RFC 3339 format. '

updated String

'The last modification time of the HMAC key metadata in RFC 3339 format.'

Import

HmacKey can be imported using any of these accepted formats

 $ pulumi import gcp:storage/hmacKey:HmacKey default projects/{{project}}/hmacKeys/{{access_id}}
 $ pulumi import gcp:storage/hmacKey:HmacKey default {{project}}/{{access_id}}
 $ pulumi import gcp:storage/hmacKey:HmacKey default {{access_id}}

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.