Account Args
data class AccountArgs(val accountId: Output<String>? = null, val description: Output<String>? = null, val disabled: Output<Boolean>? = null, val displayName: Output<String>? = null, val project: Output<String>? = null) : ConvertibleToJava<AccountArgs>
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.
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());
}
}Content copied to clipboard
Import
Service accounts can be imported using their URI, e.g. * projects/{{project_id}}/serviceAccounts/{{email}} In Terraform v1.5.0 and later, use an import block to import service accounts using one of the formats above. For exampletf import { id = "projects/{{project_id}}/serviceAccounts/{{email}}" to = google_service_account.default }
$ pulumi import gcp:serviceaccount/account:Account When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), service accounts can be imported using one of the formats above. For exampleContent copied to clipboard
$ pulumi import gcp:serviceaccount/account:Account default projects/{{project_id}}/serviceAccounts/{{email}}Content copied to clipboard