gcp.storage.HmacKey
Explore with Pulumi AI
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:
- API documentation
- How-to Guides
Example Usage
Storage Hmac Key
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
// Create a new service account
const serviceAccount = new gcp.serviceaccount.Account("service_account", {accountId: "my-svc-acc"});
//Create the HMAC key for the associated service account
const key = new gcp.storage.HmacKey("key", {serviceAccountEmail: serviceAccount.email});
import pulumi
import pulumi_gcp as gcp
# Create a new service account
service_account = gcp.serviceaccount.Account("service_account", 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)
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/serviceaccount"
"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/storage"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
// Create a new service account
serviceAccount, err := serviceaccount.NewAccount(ctx, "service_account", &serviceaccount.AccountArgs{
AccountId: pulumi.String("my-svc-acc"),
})
if err != nil {
return err
}
// Create the HMAC key for the associated service account
_, err = storage.NewHmacKey(ctx, "key", &storage.HmacKeyArgs{
ServiceAccountEmail: serviceAccount.Email,
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
// Create a new service account
var serviceAccount = new Gcp.ServiceAccount.Account("service_account", 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 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) {
// Create a new service account
var serviceAccount = new Account("serviceAccount", AccountArgs.builder()
.accountId("my-svc-acc")
.build());
//Create the HMAC key for the associated service account
var key = new HmacKey("key", HmacKeyArgs.builder()
.serviceAccountEmail(serviceAccount.email())
.build());
}
}
resources:
# Create a new service account
serviceAccount:
type: gcp:serviceaccount:Account
name: service_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
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new HmacKey(name: string, args: HmacKeyArgs, opts?: CustomResourceOptions);
@overload
def HmacKey(resource_name: str,
args: HmacKeyArgs,
opts: Optional[ResourceOptions] = None)
@overload
def HmacKey(resource_name: str,
opts: Optional[ResourceOptions] = None,
service_account_email: Optional[str] = None,
project: Optional[str] = None,
state: Optional[str] = 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.
Parameters
- 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.
Constructor example
The following reference example uses placeholder values for all input properties.
var hmacKeyResource = new Gcp.Storage.HmacKey("hmacKeyResource", new()
{
ServiceAccountEmail = "string",
Project = "string",
State = "string",
});
example, err := storage.NewHmacKey(ctx, "hmacKeyResource", &storage.HmacKeyArgs{
ServiceAccountEmail: pulumi.String("string"),
Project: pulumi.String("string"),
State: pulumi.String("string"),
})
var hmacKeyResource = new HmacKey("hmacKeyResource", HmacKeyArgs.builder()
.serviceAccountEmail("string")
.project("string")
.state("string")
.build());
hmac_key_resource = gcp.storage.HmacKey("hmacKeyResource",
service_account_email="string",
project="string",
state="string")
const hmacKeyResource = new gcp.storage.HmacKey("hmacKeyResource", {
serviceAccountEmail: "string",
project: "string",
state: "string",
});
type: gcp:storage:HmacKey
properties:
project: string
serviceAccountEmail: string
state: string
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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The HmacKey resource accepts the following input properties:
- Service
Account stringEmail - 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
,INACTIVE
.
- Service
Account stringEmail - 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
,INACTIVE
.
- service
Account StringEmail - 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
,INACTIVE
.
- service
Account stringEmail - 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
,INACTIVE
.
- service_
account_ stremail - 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
,INACTIVE
.
- service
Account StringEmail - 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
,INACTIVE
.
Outputs
All input properties are implicitly available as output properties. Additionally, the HmacKey resource produces the following output properties:
- Access
Id 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.
- Time
Created 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 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.
- Time
Created 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 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.
- time
Created 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 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.
- time
Created 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.'
- access
Id 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.
- time
Created 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.
- Access
Id 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.
- Service
Account stringEmail - 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
,INACTIVE
. - Time
Created 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 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.
- Service
Account stringEmail - 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
,INACTIVE
. - Time
Created 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 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.
- service
Account StringEmail - 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
,INACTIVE
. - time
Created 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 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.
- service
Account stringEmail - 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
,INACTIVE
. - time
Created 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_ stremail - 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
,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.'
- access
Id 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.
- service
Account StringEmail - 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
,INACTIVE
. - time
Created 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:
projects/{{project}}/hmacKeys/{{access_id}}
{{project}}/{{access_id}}
{{access_id}}
When using the pulumi import
command, HmacKey can be imported using one of the formats above. For example:
$ 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}}
To learn more about importing existing cloud resources, see Importing resources.
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.