Example Usage
Create ServiceAccount Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ServiceAccount(name: string, args: ServiceAccountArgs, opts?: CustomResourceOptions);@overload
def ServiceAccount(resource_name: str,
args: ServiceAccountArgs,
opts: Optional[ResourceOptions] = None)
@overload
def ServiceAccount(resource_name: str,
opts: Optional[ResourceOptions] = None,
description: Optional[str] = None,
org_id: Optional[str] = None,
roles: Optional[Sequence[str]] = None,
name: Optional[str] = None,
secret_expires_after_hours: Optional[int] = None)func NewServiceAccount(ctx *Context, name string, args ServiceAccountArgs, opts ...ResourceOption) (*ServiceAccount, error)public ServiceAccount(string name, ServiceAccountArgs args, CustomResourceOptions? opts = null)
public ServiceAccount(String name, ServiceAccountArgs args)
public ServiceAccount(String name, ServiceAccountArgs args, CustomResourceOptions options)
type: mongodbatlas:ServiceAccount
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 ServiceAccountArgs
- 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 ServiceAccountArgs
- 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 ServiceAccountArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ServiceAccountArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ServiceAccountArgs
- 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 serviceAccountResource = new Mongodbatlas.ServiceAccount("serviceAccountResource", new()
{
Description = "string",
OrgId = "string",
Roles = new[]
{
"string",
},
Name = "string",
SecretExpiresAfterHours = 0,
});
example, err := mongodbatlas.NewServiceAccount(ctx, "serviceAccountResource", &mongodbatlas.ServiceAccountArgs{
Description: pulumi.String("string"),
OrgId: pulumi.String("string"),
Roles: pulumi.StringArray{
pulumi.String("string"),
},
Name: pulumi.String("string"),
SecretExpiresAfterHours: pulumi.Int(0),
})
var serviceAccountResource = new ServiceAccount("serviceAccountResource", ServiceAccountArgs.builder()
.description("string")
.orgId("string")
.roles("string")
.name("string")
.secretExpiresAfterHours(0)
.build());
service_account_resource = mongodbatlas.ServiceAccount("serviceAccountResource",
description="string",
org_id="string",
roles=["string"],
name="string",
secret_expires_after_hours=0)
const serviceAccountResource = new mongodbatlas.ServiceAccount("serviceAccountResource", {
description: "string",
orgId: "string",
roles: ["string"],
name: "string",
secretExpiresAfterHours: 0,
});
type: mongodbatlas:ServiceAccount
properties:
description: string
name: string
orgId: string
roles:
- string
secretExpiresAfterHours: 0
ServiceAccount 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 ServiceAccount resource accepts the following input properties:
- Description string
- Human readable description for the Service Account.
- Org
Id string - Unique 24-hexadecimal digit string that identifies the organization that contains your projects.
- Roles List<string>
- A list of organization-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.
- Org
Id string - Unique 24-hexadecimal digit string that identifies the organization that contains your projects.
- Roles []string
- A list of organization-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.
- org
Id String - Unique 24-hexadecimal digit string that identifies the organization that contains your projects.
- roles List<String>
- A list of organization-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.
- org
Id string - Unique 24-hexadecimal digit string that identifies the organization that contains your projects.
- roles string[]
- A list of organization-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.
- org_
id str - Unique 24-hexadecimal digit string that identifies the organization that contains your projects.
- roles Sequence[str]
- A list of organization-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.
- org
Id String - Unique 24-hexadecimal digit string that identifies the organization that contains your projects.
- roles List<String>
- A list of organization-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 ServiceAccount 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<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
[]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<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
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[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 ServiceAccount Resource
Get an existing ServiceAccount 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?: ServiceAccountState, opts?: CustomResourceOptions): ServiceAccount@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,
org_id: Optional[str] = None,
roles: Optional[Sequence[str]] = None,
secret_expires_after_hours: Optional[int] = None,
secrets: Optional[Sequence[ServiceAccountSecretArgs]] = None) -> ServiceAccountfunc GetServiceAccount(ctx *Context, name string, id IDInput, state *ServiceAccountState, opts ...ResourceOption) (*ServiceAccount, error)public static ServiceAccount Get(string name, Input<string> id, ServiceAccountState? state, CustomResourceOptions? opts = null)public static ServiceAccount get(String name, Output<String> id, ServiceAccountState state, CustomResourceOptions options)resources: _: type: mongodbatlas:ServiceAccount 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.
- Org
Id string - Unique 24-hexadecimal digit string that identifies the organization that contains your projects.
- Roles List<string>
- A list of organization-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<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.
- Org
Id string - Unique 24-hexadecimal digit string that identifies the organization that contains your projects.
- Roles []string
- A list of organization-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
[]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.
- org
Id String - Unique 24-hexadecimal digit string that identifies the organization that contains your projects.
- roles List<String>
- A list of organization-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<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.
- org
Id string - Unique 24-hexadecimal digit string that identifies the organization that contains your projects.
- roles string[]
- A list of organization-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
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.
- org_
id str - Unique 24-hexadecimal digit string that identifies the organization that contains your projects.
- roles Sequence[str]
- A list of organization-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[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.
- org
Id String - Unique 24-hexadecimal digit string that identifies the organization that contains your projects.
- roles List<String>
- A list of organization-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
ServiceAccountSecret, ServiceAccountSecretArgs
- 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 Service Account resource by using the Organization ID and Client ID in the format ORG_ID/CLIENT_ID, e.g.
$ terraform import mongodbatlas_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 Organization 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.
