Account Args
Allows management of a Google Cloud service account.
How-to Guides
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")
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 main
import (
"github.com/pulumi/pulumi-gcp/sdk/v8/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
})
}
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
Import
Service accounts can be imported using their URI, e.g.
projects/{{project_id}}/serviceAccounts/{{email}}
When using thepulumi 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}}
Constructors
Properties
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.
If set to true, skip service account creation if a service account with the same email already exists.
A text description of the service account. Must be less than or equal to 256 UTF-8 bytes.
The display name for the service account. Can be updated without creating a new resource.