Package com.pulumi.gcp.serviceAccount
Class Account
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.gcp.serviceAccount.Account
-
public class Account extends com.pulumi.resources.CustomResource
Allows management of a Google Cloud service account. * [API documentation](https://cloud.google.com/iam/reference/rest/v1/projects.serviceAccounts) * How-to Guides * [Official Documentation](https://cloud.google.com/compute/docs/access/service-accounts) > **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. ```java 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()); } } ``` ## Import Service accounts can be imported using their URI, e.g. ```sh $ pulumi import gcp:serviceAccount/account:Account my_sa projects/my-project/serviceAccounts/[email protected] ```
-
-
Constructor Summary
Constructors Constructor Description Account(java.lang.String name)
Account(java.lang.String name, AccountArgs args)
Account(java.lang.String name, AccountArgs args, com.pulumi.resources.CustomResourceOptions options)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.pulumi.core.Output<java.lang.String>
accountId()
com.pulumi.core.Output<java.util.Optional<java.lang.String>>
description()
com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>>
disabled()
com.pulumi.core.Output<java.util.Optional<java.lang.String>>
displayName()
com.pulumi.core.Output<java.lang.String>
email()
static Account
get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, AccountState state, com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.com.pulumi.core.Output<java.lang.String>
member()
com.pulumi.core.Output<java.lang.String>
name()
com.pulumi.core.Output<java.lang.String>
project()
com.pulumi.core.Output<java.lang.String>
uniqueId()
-
-
-
Constructor Detail
-
Account
public Account(java.lang.String name)
- Parameters:
name
- The _unique_ name of the resulting resource.
-
Account
public Account(java.lang.String name, AccountArgs args)
- Parameters:
name
- The _unique_ name of the resulting resource.args
- The arguments to use to populate this resource's properties.
-
Account
public Account(java.lang.String name, AccountArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options)
- Parameters:
name
- The _unique_ name of the resulting resource.args
- The arguments to use to populate this resource's properties.options
- A bag of options that control this resource's behavior.
-
-
Method Detail
-
accountId
public com.pulumi.core.Output<java.lang.String> accountId()
- Returns:
- 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.
-
description
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> description()
- Returns:
- A text description of the service account. Must be less than or equal to 256 UTF-8 bytes.
-
disabled
public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> disabled()
- Returns:
- 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
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> displayName()
- Returns:
- The display name for the service account. Can be updated without creating a new resource.
-
email
public com.pulumi.core.Output<java.lang.String> email()
- Returns:
- 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
public com.pulumi.core.Output<java.lang.String> member()
- Returns:
- 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
public com.pulumi.core.Output<java.lang.String> name()
- Returns:
- The fully-qualified name of the service account.
-
project
public com.pulumi.core.Output<java.lang.String> project()
- Returns:
- The ID of the project that the service account will be created in. Defaults to the provider project configuration.
-
uniqueId
public com.pulumi.core.Output<java.lang.String> uniqueId()
- Returns:
- The unique id of the service account.
-
get
public static Account get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, @Nullable AccountState state, @Nullable com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.- Parameters:
name
- The _unique_ name of the resulting resource.id
- The _unique_ provider ID of the resource to lookup.state
-options
- Optional settings to control the behavior of the CustomResource.
-
-