1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. serviceaccount
  5. Account
Google Cloud Classic v7.16.0 published on Wednesday, Mar 27, 2024 by Pulumi

gcp.serviceaccount.Account

Explore with Pulumi AI

gcp logo
Google Cloud Classic v7.16.0 published on Wednesday, Mar 27, 2024 by Pulumi

    Allows management of a Google Cloud service account.

    Warning: If you delete and recreate a service account, you must reapply any IAM roles that it had before.

    Creation of service accounts is eventually consistent, and that can lead to errors when you try to apply ACLs to service accounts immediately after creation.

    Example Usage

    This snippet creates a service account in a project.

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const serviceAccount = new gcp.serviceaccount.Account("service_account", {
        accountId: "service-account-id",
        displayName: "Service Account",
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    service_account = gcp.serviceaccount.Account("service_account",
        account_id="service-account-id",
        display_name="Service Account")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/serviceaccount"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := serviceaccount.NewAccount(ctx, "service_account", &serviceaccount.AccountArgs{
    			AccountId:   pulumi.String("service-account-id"),
    			DisplayName: pulumi.String("Service Account"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var serviceAccount = new Gcp.ServiceAccount.Account("service_account", new()
        {
            AccountId = "service-account-id",
            DisplayName = "Service Account",
        });
    
    });
    
    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 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("service-account-id")
                .displayName("Service Account")
                .build());
    
        }
    }
    
    resources:
      serviceAccount:
        type: gcp:serviceaccount:Account
        name: service_account
        properties:
          accountId: service-account-id
          displayName: Service Account
    

    Create Account Resource

    new Account(name: string, args: AccountArgs, opts?: CustomResourceOptions);
    @overload
    def Account(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                account_id: Optional[str] = None,
                create_ignore_already_exists: Optional[bool] = None,
                description: Optional[str] = None,
                disabled: Optional[bool] = None,
                display_name: Optional[str] = None,
                project: Optional[str] = None)
    @overload
    def Account(resource_name: str,
                args: AccountArgs,
                opts: Optional[ResourceOptions] = None)
    func NewAccount(ctx *Context, name string, args AccountArgs, opts ...ResourceOption) (*Account, error)
    public Account(string name, AccountArgs args, CustomResourceOptions? opts = null)
    public Account(String name, AccountArgs args)
    public Account(String name, AccountArgs args, CustomResourceOptions options)
    
    type: gcp:serviceaccount:Account
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args AccountArgs
    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 AccountArgs
    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 AccountArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args AccountArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args AccountArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Account 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 Account resource accepts the following input properties:

    AccountId string
    The account id that is used to generate the service account email address and a stable unique id. It is unique within a project, must be 6-30 characters long, and match the regular expression a-z to comply with RFC1035. Changing this forces a new service account to be created.
    CreateIgnoreAlreadyExists bool
    If set to true, skip service account creation if a service account with the same email already exists.
    Description string
    A text description of the service account. Must be less than or equal to 256 UTF-8 bytes.
    Disabled bool
    Whether a service account is disabled or not. Defaults to false. This field has no effect during creation. Must be set after creation to disable a service account.
    DisplayName string
    The display name for the service account. Can be updated without creating a new resource.
    Project string
    The ID of the project that the service account will be created in. Defaults to the provider project configuration.
    AccountId string
    The account id that is used to generate the service account email address and a stable unique id. It is unique within a project, must be 6-30 characters long, and match the regular expression a-z to comply with RFC1035. Changing this forces a new service account to be created.
    CreateIgnoreAlreadyExists bool
    If set to true, skip service account creation if a service account with the same email already exists.
    Description string
    A text description of the service account. Must be less than or equal to 256 UTF-8 bytes.
    Disabled bool
    Whether a service account is disabled or not. Defaults to false. This field has no effect during creation. Must be set after creation to disable a service account.
    DisplayName string
    The display name for the service account. Can be updated without creating a new resource.
    Project string
    The ID of the project that the service account will be created in. Defaults to the provider project configuration.
    accountId String
    The account id that is used to generate the service account email address and a stable unique id. It is unique within a project, must be 6-30 characters long, and match the regular expression a-z to comply with RFC1035. Changing this forces a new service account to be created.
    createIgnoreAlreadyExists Boolean
    If set to true, skip service account creation if a service account with the same email already exists.
    description String
    A text description of the service account. Must be less than or equal to 256 UTF-8 bytes.
    disabled Boolean
    Whether a service account is disabled or not. Defaults to false. This field has no effect during creation. Must be set after creation to disable a service account.
    displayName String
    The display name for the service account. Can be updated without creating a new resource.
    project String
    The ID of the project that the service account will be created in. Defaults to the provider project configuration.
    accountId string
    The account id that is used to generate the service account email address and a stable unique id. It is unique within a project, must be 6-30 characters long, and match the regular expression a-z to comply with RFC1035. Changing this forces a new service account to be created.
    createIgnoreAlreadyExists boolean
    If set to true, skip service account creation if a service account with the same email already exists.
    description string
    A text description of the service account. Must be less than or equal to 256 UTF-8 bytes.
    disabled boolean
    Whether a service account is disabled or not. Defaults to false. This field has no effect during creation. Must be set after creation to disable a service account.
    displayName string
    The display name for the service account. Can be updated without creating a new resource.
    project string
    The ID of the project that the service account will be created in. Defaults to the provider project configuration.
    account_id str
    The account id that is used to generate the service account email address and a stable unique id. It is unique within a project, must be 6-30 characters long, and match the regular expression a-z to comply with RFC1035. Changing this forces a new service account to be created.
    create_ignore_already_exists bool
    If set to true, skip service account creation if a service account with the same email already exists.
    description str
    A text description of the service account. Must be less than or equal to 256 UTF-8 bytes.
    disabled bool
    Whether a service account is disabled or not. Defaults to false. This field has no effect during creation. Must be set after creation to disable a service account.
    display_name str
    The display name for the service account. Can be updated without creating a new resource.
    project str
    The ID of the project that the service account will be created in. Defaults to the provider project configuration.
    accountId String
    The account id that is used to generate the service account email address and a stable unique id. It is unique within a project, must be 6-30 characters long, and match the regular expression a-z to comply with RFC1035. Changing this forces a new service account to be created.
    createIgnoreAlreadyExists Boolean
    If set to true, skip service account creation if a service account with the same email already exists.
    description String
    A text description of the service account. Must be less than or equal to 256 UTF-8 bytes.
    disabled Boolean
    Whether a service account is disabled or not. Defaults to false. This field has no effect during creation. Must be set after creation to disable a service account.
    displayName String
    The display name for the service account. Can be updated without creating a new resource.
    project String
    The ID of the project that the service account will be created in. Defaults to the provider project configuration.

    Outputs

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

    Email string
    The e-mail address of the service account. This value should be referenced from any gcp.organizations.getIAMPolicy data sources that would grant the service account privileges.
    Id string
    The provider-assigned unique ID for this managed resource.
    Member string
    The Identity of the service account in the form serviceAccount:{email}. This value is often used to refer to the service account in order to grant IAM permissions.
    Name string
    The fully-qualified name of the service account.
    UniqueId string
    The unique id of the service account.
    Email string
    The e-mail address of the service account. This value should be referenced from any gcp.organizations.getIAMPolicy data sources that would grant the service account privileges.
    Id string
    The provider-assigned unique ID for this managed resource.
    Member string
    The Identity of the service account in the form serviceAccount:{email}. This value is often used to refer to the service account in order to grant IAM permissions.
    Name string
    The fully-qualified name of the service account.
    UniqueId string
    The unique id of the service account.
    email String
    The e-mail address of the service account. This value should be referenced from any gcp.organizations.getIAMPolicy data sources that would grant the service account privileges.
    id String
    The provider-assigned unique ID for this managed resource.
    member String
    The Identity of the service account in the form serviceAccount:{email}. This value is often used to refer to the service account in order to grant IAM permissions.
    name String
    The fully-qualified name of the service account.
    uniqueId String
    The unique id of the service account.
    email string
    The e-mail address of the service account. This value should be referenced from any gcp.organizations.getIAMPolicy data sources that would grant the service account privileges.
    id string
    The provider-assigned unique ID for this managed resource.
    member string
    The Identity of the service account in the form serviceAccount:{email}. This value is often used to refer to the service account in order to grant IAM permissions.
    name string
    The fully-qualified name of the service account.
    uniqueId string
    The unique id of the service account.
    email str
    The e-mail address of the service account. This value should be referenced from any gcp.organizations.getIAMPolicy data sources that would grant the service account privileges.
    id str
    The provider-assigned unique ID for this managed resource.
    member str
    The Identity of the service account in the form serviceAccount:{email}. This value is often used to refer to the service account in order to grant IAM permissions.
    name str
    The fully-qualified name of the service account.
    unique_id str
    The unique id of the service account.
    email String
    The e-mail address of the service account. This value should be referenced from any gcp.organizations.getIAMPolicy data sources that would grant the service account privileges.
    id String
    The provider-assigned unique ID for this managed resource.
    member String
    The Identity of the service account in the form serviceAccount:{email}. This value is often used to refer to the service account in order to grant IAM permissions.
    name String
    The fully-qualified name of the service account.
    uniqueId String
    The unique id of the service account.

    Look up Existing Account Resource

    Get an existing Account 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?: AccountState, opts?: CustomResourceOptions): Account
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            account_id: Optional[str] = None,
            create_ignore_already_exists: Optional[bool] = None,
            description: Optional[str] = None,
            disabled: Optional[bool] = None,
            display_name: Optional[str] = None,
            email: Optional[str] = None,
            member: Optional[str] = None,
            name: Optional[str] = None,
            project: Optional[str] = None,
            unique_id: Optional[str] = None) -> Account
    func GetAccount(ctx *Context, name string, id IDInput, state *AccountState, opts ...ResourceOption) (*Account, error)
    public static Account Get(string name, Input<string> id, AccountState? state, CustomResourceOptions? opts = null)
    public static Account get(String name, Output<String> id, AccountState 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:
    AccountId string
    The account id that is used to generate the service account email address and a stable unique id. It is unique within a project, must be 6-30 characters long, and match the regular expression a-z to comply with RFC1035. Changing this forces a new service account to be created.
    CreateIgnoreAlreadyExists bool
    If set to true, skip service account creation if a service account with the same email already exists.
    Description string
    A text description of the service account. Must be less than or equal to 256 UTF-8 bytes.
    Disabled bool
    Whether a service account is disabled or not. Defaults to false. This field has no effect during creation. Must be set after creation to disable a service account.
    DisplayName string
    The display name for the service account. Can be updated without creating a new resource.
    Email string
    The e-mail address of the service account. This value should be referenced from any gcp.organizations.getIAMPolicy data sources that would grant the service account privileges.
    Member string
    The Identity of the service account in the form serviceAccount:{email}. This value is often used to refer to the service account in order to grant IAM permissions.
    Name string
    The fully-qualified name 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.
    UniqueId string
    The unique id of the service account.
    AccountId string
    The account id that is used to generate the service account email address and a stable unique id. It is unique within a project, must be 6-30 characters long, and match the regular expression a-z to comply with RFC1035. Changing this forces a new service account to be created.
    CreateIgnoreAlreadyExists bool
    If set to true, skip service account creation if a service account with the same email already exists.
    Description string
    A text description of the service account. Must be less than or equal to 256 UTF-8 bytes.
    Disabled bool
    Whether a service account is disabled or not. Defaults to false. This field has no effect during creation. Must be set after creation to disable a service account.
    DisplayName string
    The display name for the service account. Can be updated without creating a new resource.
    Email string
    The e-mail address of the service account. This value should be referenced from any gcp.organizations.getIAMPolicy data sources that would grant the service account privileges.
    Member string
    The Identity of the service account in the form serviceAccount:{email}. This value is often used to refer to the service account in order to grant IAM permissions.
    Name string
    The fully-qualified name 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.
    UniqueId string
    The unique id of the service account.
    accountId String
    The account id that is used to generate the service account email address and a stable unique id. It is unique within a project, must be 6-30 characters long, and match the regular expression a-z to comply with RFC1035. Changing this forces a new service account to be created.
    createIgnoreAlreadyExists Boolean
    If set to true, skip service account creation if a service account with the same email already exists.
    description String
    A text description of the service account. Must be less than or equal to 256 UTF-8 bytes.
    disabled Boolean
    Whether a service account is disabled or not. Defaults to false. This field has no effect during creation. Must be set after creation to disable a service account.
    displayName String
    The display name for the service account. Can be updated without creating a new resource.
    email String
    The e-mail address of the service account. This value should be referenced from any gcp.organizations.getIAMPolicy data sources that would grant the service account privileges.
    member String
    The Identity of the service account in the form serviceAccount:{email}. This value is often used to refer to the service account in order to grant IAM permissions.
    name String
    The fully-qualified name 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.
    uniqueId String
    The unique id of the service account.
    accountId string
    The account id that is used to generate the service account email address and a stable unique id. It is unique within a project, must be 6-30 characters long, and match the regular expression a-z to comply with RFC1035. Changing this forces a new service account to be created.
    createIgnoreAlreadyExists boolean
    If set to true, skip service account creation if a service account with the same email already exists.
    description string
    A text description of the service account. Must be less than or equal to 256 UTF-8 bytes.
    disabled boolean
    Whether a service account is disabled or not. Defaults to false. This field has no effect during creation. Must be set after creation to disable a service account.
    displayName string
    The display name for the service account. Can be updated without creating a new resource.
    email string
    The e-mail address of the service account. This value should be referenced from any gcp.organizations.getIAMPolicy data sources that would grant the service account privileges.
    member string
    The Identity of the service account in the form serviceAccount:{email}. This value is often used to refer to the service account in order to grant IAM permissions.
    name string
    The fully-qualified name 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.
    uniqueId string
    The unique id of the service account.
    account_id str
    The account id that is used to generate the service account email address and a stable unique id. It is unique within a project, must be 6-30 characters long, and match the regular expression a-z to comply with RFC1035. Changing this forces a new service account to be created.
    create_ignore_already_exists bool
    If set to true, skip service account creation if a service account with the same email already exists.
    description str
    A text description of the service account. Must be less than or equal to 256 UTF-8 bytes.
    disabled bool
    Whether a service account is disabled or not. Defaults to false. This field has no effect during creation. Must be set after creation to disable a service account.
    display_name str
    The display name for the service account. Can be updated without creating a new resource.
    email str
    The e-mail address of the service account. This value should be referenced from any gcp.organizations.getIAMPolicy data sources that would grant the service account privileges.
    member str
    The Identity of the service account in the form serviceAccount:{email}. This value is often used to refer to the service account in order to grant IAM permissions.
    name str
    The fully-qualified name 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.
    unique_id str
    The unique id of the service account.
    accountId String
    The account id that is used to generate the service account email address and a stable unique id. It is unique within a project, must be 6-30 characters long, and match the regular expression a-z to comply with RFC1035. Changing this forces a new service account to be created.
    createIgnoreAlreadyExists Boolean
    If set to true, skip service account creation if a service account with the same email already exists.
    description String
    A text description of the service account. Must be less than or equal to 256 UTF-8 bytes.
    disabled Boolean
    Whether a service account is disabled or not. Defaults to false. This field has no effect during creation. Must be set after creation to disable a service account.
    displayName String
    The display name for the service account. Can be updated without creating a new resource.
    email String
    The e-mail address of the service account. This value should be referenced from any gcp.organizations.getIAMPolicy data sources that would grant the service account privileges.
    member String
    The Identity of the service account in the form serviceAccount:{email}. This value is often used to refer to the service account in order to grant IAM permissions.
    name String
    The fully-qualified name 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.
    uniqueId String
    The unique id of the service account.

    Import

    Service accounts can be imported using their URI, e.g.

    • projects/{{project_id}}/serviceAccounts/{{email}}

    When using the pulumi import command, service accounts can be imported using one of the formats above. For example:

    $ pulumi import gcp:serviceaccount/account:Account default projects/{{project_id}}/serviceAccounts/{{email}}
    

    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.
    gcp logo
    Google Cloud Classic v7.16.0 published on Wednesday, Mar 27, 2024 by Pulumi