Example Usage
Create ProjectServiceAccount Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ProjectServiceAccount(name: string, args: ProjectServiceAccountArgs, opts?: CustomResourceOptions);@overload
def ProjectServiceAccount(resource_name: str,
args: ProjectServiceAccountArgs,
opts: Optional[ResourceOptions] = None)
@overload
def ProjectServiceAccount(resource_name: str,
opts: Optional[ResourceOptions] = None,
description: Optional[str] = None,
project_id: Optional[str] = None,
roles: Optional[Sequence[str]] = None,
name: Optional[str] = None,
secret_expires_after_hours: Optional[int] = None)func NewProjectServiceAccount(ctx *Context, name string, args ProjectServiceAccountArgs, opts ...ResourceOption) (*ProjectServiceAccount, error)public ProjectServiceAccount(string name, ProjectServiceAccountArgs args, CustomResourceOptions? opts = null)
public ProjectServiceAccount(String name, ProjectServiceAccountArgs args)
public ProjectServiceAccount(String name, ProjectServiceAccountArgs args, CustomResourceOptions options)
type: mongodbatlas:ProjectServiceAccount
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 ProjectServiceAccountArgs
- 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 ProjectServiceAccountArgs
- 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 ProjectServiceAccountArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ProjectServiceAccountArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ProjectServiceAccountArgs
- 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 projectServiceAccountResource = new Mongodbatlas.ProjectServiceAccount("projectServiceAccountResource", new()
{
Description = "string",
ProjectId = "string",
Roles = new[]
{
"string",
},
Name = "string",
SecretExpiresAfterHours = 0,
});
example, err := mongodbatlas.NewProjectServiceAccount(ctx, "projectServiceAccountResource", &mongodbatlas.ProjectServiceAccountArgs{
Description: pulumi.String("string"),
ProjectId: pulumi.String("string"),
Roles: pulumi.StringArray{
pulumi.String("string"),
},
Name: pulumi.String("string"),
SecretExpiresAfterHours: pulumi.Int(0),
})
var projectServiceAccountResource = new ProjectServiceAccount("projectServiceAccountResource", ProjectServiceAccountArgs.builder()
.description("string")
.projectId("string")
.roles("string")
.name("string")
.secretExpiresAfterHours(0)
.build());
project_service_account_resource = mongodbatlas.ProjectServiceAccount("projectServiceAccountResource",
description="string",
project_id="string",
roles=["string"],
name="string",
secret_expires_after_hours=0)
const projectServiceAccountResource = new mongodbatlas.ProjectServiceAccount("projectServiceAccountResource", {
description: "string",
projectId: "string",
roles: ["string"],
name: "string",
secretExpiresAfterHours: 0,
});
type: mongodbatlas:ProjectServiceAccount
properties:
description: string
name: string
projectId: string
roles:
- string
secretExpiresAfterHours: 0
ProjectServiceAccount 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 ProjectServiceAccount resource accepts the following input properties:
- Description string
- Human readable description for the Service Account.
- Project
Id string - Unique 24-hexadecimal digit string that identifies your project.
- Roles List<string>
- A list of project-level roles for the Service Account.
- Name string
- Human-readable name for the Service Account. The name is modifiable and does not have to be unique.
- Secret
Expires intAfter Hours - The expiration time of the new Service Account secret, provided in hours. The minimum and maximum allowed expiration times are subject to change and are controlled by the organization's settings. This attribute is required when creating the Service Account and you cannot update it later.
- Description string
- Human readable description for the Service Account.
- Project
Id string - Unique 24-hexadecimal digit string that identifies your project.
- Roles []string
- A list of project-level roles for the Service Account.
- Name string
- Human-readable name for the Service Account. The name is modifiable and does not have to be unique.
- Secret
Expires intAfter Hours - The expiration time of the new Service Account secret, provided in hours. The minimum and maximum allowed expiration times are subject to change and are controlled by the organization's settings. This attribute is required when creating the Service Account and you cannot update it later.
- description String
- Human readable description for the Service Account.
- project
Id String - Unique 24-hexadecimal digit string that identifies your project.
- roles List<String>
- A list of project-level roles for the Service Account.
- name String
- Human-readable name for the Service Account. The name is modifiable and does not have to be unique.
- secret
Expires IntegerAfter Hours - The expiration time of the new Service Account secret, provided in hours. The minimum and maximum allowed expiration times are subject to change and are controlled by the organization's settings. This attribute is required when creating the Service Account and you cannot update it later.
- description string
- Human readable description for the Service Account.
- project
Id string - Unique 24-hexadecimal digit string that identifies your project.
- roles string[]
- A list of project-level roles for the Service Account.
- name string
- Human-readable name for the Service Account. The name is modifiable and does not have to be unique.
- secret
Expires numberAfter Hours - The expiration time of the new Service Account secret, provided in hours. The minimum and maximum allowed expiration times are subject to change and are controlled by the organization's settings. This attribute is required when creating the Service Account and you cannot update it later.
- description str
- Human readable description for the Service Account.
- project_
id str - Unique 24-hexadecimal digit string that identifies your project.
- roles Sequence[str]
- A list of project-level roles for the Service Account.
- name str
- Human-readable name for the Service Account. The name is modifiable and does not have to be unique.
- secret_
expires_ intafter_ hours - The expiration time of the new Service Account secret, provided in hours. The minimum and maximum allowed expiration times are subject to change and are controlled by the organization's settings. This attribute is required when creating the Service Account and you cannot update it later.
- description String
- Human readable description for the Service Account.
- project
Id String - Unique 24-hexadecimal digit string that identifies your project.
- roles List<String>
- A list of project-level roles for the Service Account.
- name String
- Human-readable name for the Service Account. The name is modifiable and does not have to be unique.
- secret
Expires NumberAfter Hours - The expiration time of the new Service Account secret, provided in hours. The minimum and maximum allowed expiration times are subject to change and are controlled by the organization's settings. This attribute is required when creating the Service Account and you cannot update it later.
Outputs
All input properties are implicitly available as output properties. Additionally, the ProjectServiceAccount resource produces the following output properties:
- Client
Id string - The Client ID of the Service Account.
- Created
At string - The date that the Service Account was created on. This parameter expresses its value in the ISO 8601 timestamp format in UTC.
- Id string
- The provider-assigned unique ID for this managed resource.
- Secrets
List<Project
Service Account Secret> - A list of secrets associated with the specified Service Account.
- Client
Id string - The Client ID of the Service Account.
- Created
At string - The date that the Service Account was created on. This parameter expresses its value in the ISO 8601 timestamp format in UTC.
- Id string
- The provider-assigned unique ID for this managed resource.
- Secrets
[]Project
Service Account Secret Type - A list of secrets associated with the specified Service Account.
- client
Id String - The Client ID of the Service Account.
- created
At String - The date that the Service Account was created on. This parameter expresses its value in the ISO 8601 timestamp format in UTC.
- id String
- The provider-assigned unique ID for this managed resource.
- secrets
List<Project
Service Account Secret> - A list of secrets associated with the specified Service Account.
- client
Id string - The Client ID of the Service Account.
- created
At string - The date that the Service Account was created on. This parameter expresses its value in the ISO 8601 timestamp format in UTC.
- id string
- The provider-assigned unique ID for this managed resource.
- secrets
Project
Service Account Secret[] - A list of secrets associated with the specified Service Account.
- client_
id str - The Client ID of the Service Account.
- created_
at str - The date that the Service Account was created on. This parameter expresses its value in the ISO 8601 timestamp format in UTC.
- id str
- The provider-assigned unique ID for this managed resource.
- secrets
Sequence[Project
Service Account Secret] - A list of secrets associated with the specified Service Account.
- client
Id String - The Client ID of the Service Account.
- created
At String - The date that the Service Account was created on. This parameter expresses its value in the ISO 8601 timestamp format in UTC.
- id String
- The provider-assigned unique ID for this managed resource.
- secrets List<Property Map>
- A list of secrets associated with the specified Service Account.
Look up Existing ProjectServiceAccount Resource
Get an existing ProjectServiceAccount 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?: ProjectServiceAccountState, opts?: CustomResourceOptions): ProjectServiceAccount@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
client_id: Optional[str] = None,
created_at: Optional[str] = None,
description: Optional[str] = None,
name: Optional[str] = None,
project_id: Optional[str] = None,
roles: Optional[Sequence[str]] = None,
secret_expires_after_hours: Optional[int] = None,
secrets: Optional[Sequence[ProjectServiceAccountSecretArgs]] = None) -> ProjectServiceAccountfunc GetProjectServiceAccount(ctx *Context, name string, id IDInput, state *ProjectServiceAccountState, opts ...ResourceOption) (*ProjectServiceAccount, error)public static ProjectServiceAccount Get(string name, Input<string> id, ProjectServiceAccountState? state, CustomResourceOptions? opts = null)public static ProjectServiceAccount get(String name, Output<String> id, ProjectServiceAccountState state, CustomResourceOptions options)resources: _: type: mongodbatlas:ProjectServiceAccount get: id: ${id}- 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.
- Client
Id string - The Client ID of the Service Account.
- Created
At string - The date that the Service Account was created on. This parameter expresses its value in the ISO 8601 timestamp format in UTC.
- Description string
- Human readable description for the Service Account.
- Name string
- Human-readable name for the Service Account. The name is modifiable and does not have to be unique.
- Project
Id string - Unique 24-hexadecimal digit string that identifies your project.
- Roles List<string>
- A list of project-level roles for the Service Account.
- Secret
Expires intAfter Hours - The expiration time of the new Service Account secret, provided in hours. The minimum and maximum allowed expiration times are subject to change and are controlled by the organization's settings. This attribute is required when creating the Service Account and you cannot update it later.
- Secrets
List<Project
Service Account Secret> - A list of secrets associated with the specified Service Account.
- Client
Id string - The Client ID of the Service Account.
- Created
At string - The date that the Service Account was created on. This parameter expresses its value in the ISO 8601 timestamp format in UTC.
- Description string
- Human readable description for the Service Account.
- Name string
- Human-readable name for the Service Account. The name is modifiable and does not have to be unique.
- Project
Id string - Unique 24-hexadecimal digit string that identifies your project.
- Roles []string
- A list of project-level roles for the Service Account.
- Secret
Expires intAfter Hours - The expiration time of the new Service Account secret, provided in hours. The minimum and maximum allowed expiration times are subject to change and are controlled by the organization's settings. This attribute is required when creating the Service Account and you cannot update it later.
- Secrets
[]Project
Service Account Secret Type Args - A list of secrets associated with the specified Service Account.
- client
Id String - The Client ID of the Service Account.
- created
At String - The date that the Service Account was created on. This parameter expresses its value in the ISO 8601 timestamp format in UTC.
- description String
- Human readable description for the Service Account.
- name String
- Human-readable name for the Service Account. The name is modifiable and does not have to be unique.
- project
Id String - Unique 24-hexadecimal digit string that identifies your project.
- roles List<String>
- A list of project-level roles for the Service Account.
- secret
Expires IntegerAfter Hours - The expiration time of the new Service Account secret, provided in hours. The minimum and maximum allowed expiration times are subject to change and are controlled by the organization's settings. This attribute is required when creating the Service Account and you cannot update it later.
- secrets
List<Project
Service Account Secret> - A list of secrets associated with the specified Service Account.
- client
Id string - The Client ID of the Service Account.
- created
At string - The date that the Service Account was created on. This parameter expresses its value in the ISO 8601 timestamp format in UTC.
- description string
- Human readable description for the Service Account.
- name string
- Human-readable name for the Service Account. The name is modifiable and does not have to be unique.
- project
Id string - Unique 24-hexadecimal digit string that identifies your project.
- roles string[]
- A list of project-level roles for the Service Account.
- secret
Expires numberAfter Hours - The expiration time of the new Service Account secret, provided in hours. The minimum and maximum allowed expiration times are subject to change and are controlled by the organization's settings. This attribute is required when creating the Service Account and you cannot update it later.
- secrets
Project
Service Account Secret[] - A list of secrets associated with the specified Service Account.
- client_
id str - The Client ID of the Service Account.
- created_
at str - The date that the Service Account was created on. This parameter expresses its value in the ISO 8601 timestamp format in UTC.
- description str
- Human readable description for the Service Account.
- name str
- Human-readable name for the Service Account. The name is modifiable and does not have to be unique.
- project_
id str - Unique 24-hexadecimal digit string that identifies your project.
- roles Sequence[str]
- A list of project-level roles for the Service Account.
- secret_
expires_ intafter_ hours - The expiration time of the new Service Account secret, provided in hours. The minimum and maximum allowed expiration times are subject to change and are controlled by the organization's settings. This attribute is required when creating the Service Account and you cannot update it later.
- secrets
Sequence[Project
Service Account Secret Args] - A list of secrets associated with the specified Service Account.
- client
Id String - The Client ID of the Service Account.
- created
At String - The date that the Service Account was created on. This parameter expresses its value in the ISO 8601 timestamp format in UTC.
- description String
- Human readable description for the Service Account.
- name String
- Human-readable name for the Service Account. The name is modifiable and does not have to be unique.
- project
Id String - Unique 24-hexadecimal digit string that identifies your project.
- roles List<String>
- A list of project-level roles for the Service Account.
- secret
Expires NumberAfter Hours - The expiration time of the new Service Account secret, provided in hours. The minimum and maximum allowed expiration times are subject to change and are controlled by the organization's settings. This attribute is required when creating the Service Account and you cannot update it later.
- secrets List<Property Map>
- A list of secrets associated with the specified Service Account.
Supporting Types
ProjectServiceAccountSecret, ProjectServiceAccountSecretArgs
- Created
At string - The date that the secret was created on. This parameter expresses its value in the ISO 8601 timestamp format in UTC.
- Expires
At string - The date for the expiration of the secret. This parameter expresses its value in the ISO 8601 timestamp format in UTC.
- Last
Used stringAt - The last time the secret was used. This parameter expresses its value in the ISO 8601 timestamp format in UTC.
- Masked
Secret stringValue - The masked Service Account secret.
- Secret string
- The secret for the Service Account. It will be returned only the first time after creation.
- Secret
Id string - Unique 24-hexadecimal digit string that identifies the secret.
- Created
At string - The date that the secret was created on. This parameter expresses its value in the ISO 8601 timestamp format in UTC.
- Expires
At string - The date for the expiration of the secret. This parameter expresses its value in the ISO 8601 timestamp format in UTC.
- Last
Used stringAt - The last time the secret was used. This parameter expresses its value in the ISO 8601 timestamp format in UTC.
- Masked
Secret stringValue - The masked Service Account secret.
- Secret string
- The secret for the Service Account. It will be returned only the first time after creation.
- Secret
Id string - Unique 24-hexadecimal digit string that identifies the secret.
- created
At String - The date that the secret was created on. This parameter expresses its value in the ISO 8601 timestamp format in UTC.
- expires
At String - The date for the expiration of the secret. This parameter expresses its value in the ISO 8601 timestamp format in UTC.
- last
Used StringAt - The last time the secret was used. This parameter expresses its value in the ISO 8601 timestamp format in UTC.
- masked
Secret StringValue - The masked Service Account secret.
- secret String
- The secret for the Service Account. It will be returned only the first time after creation.
- secret
Id String - Unique 24-hexadecimal digit string that identifies the secret.
- created
At string - The date that the secret was created on. This parameter expresses its value in the ISO 8601 timestamp format in UTC.
- expires
At string - The date for the expiration of the secret. This parameter expresses its value in the ISO 8601 timestamp format in UTC.
- last
Used stringAt - The last time the secret was used. This parameter expresses its value in the ISO 8601 timestamp format in UTC.
- masked
Secret stringValue - The masked Service Account secret.
- secret string
- The secret for the Service Account. It will be returned only the first time after creation.
- secret
Id string - Unique 24-hexadecimal digit string that identifies the secret.
- created_
at str - The date that the secret was created on. This parameter expresses its value in the ISO 8601 timestamp format in UTC.
- expires_
at str - The date for the expiration of the secret. This parameter expresses its value in the ISO 8601 timestamp format in UTC.
- last_
used_ strat - The last time the secret was used. This parameter expresses its value in the ISO 8601 timestamp format in UTC.
- masked_
secret_ strvalue - The masked Service Account secret.
- secret str
- The secret for the Service Account. It will be returned only the first time after creation.
- secret_
id str - Unique 24-hexadecimal digit string that identifies the secret.
- created
At String - The date that the secret was created on. This parameter expresses its value in the ISO 8601 timestamp format in UTC.
- expires
At String - The date for the expiration of the secret. This parameter expresses its value in the ISO 8601 timestamp format in UTC.
- last
Used StringAt - The last time the secret was used. This parameter expresses its value in the ISO 8601 timestamp format in UTC.
- masked
Secret StringValue - The masked Service Account secret.
- secret String
- The secret for the Service Account. It will be returned only the first time after creation.
- secret
Id String - Unique 24-hexadecimal digit string that identifies the secret.
Import
Import the Project Service Account resource by using the Project ID and Client ID in the format PROJECT_ID/CLIENT_ID, e.g.
$ terraform import mongodbatlas_project_service_account.test 6117ac2fe2a3d04ed27a987v/mdb_sa_id_1234567890abcdef12345678
NOTE:
secret_expires_after_hoursis not populated during import and should be omitted in the resource definition when importing the resource.
For more information, see Create One Project Service Account in the MongoDB Atlas API documentation.
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- MongoDB Atlas pulumi/pulumi-mongodbatlas
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
mongodbatlasTerraform Provider.
