mongodbatlas.ApiKey
Explore with Pulumi AI
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as mongodbatlas from "@pulumi/mongodbatlas";
const test = new mongodbatlas.ApiKey("test", {
description: "key-name",
orgId: "<ORG_ID>",
roleNames: ["ORG_READ_ONLY"],
});
import pulumi
import pulumi_mongodbatlas as mongodbatlas
test = mongodbatlas.ApiKey("test",
description="key-name",
org_id="<ORG_ID>",
role_names=["ORG_READ_ONLY"])
package main
import (
"github.com/pulumi/pulumi-mongodbatlas/sdk/v3/go/mongodbatlas"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := mongodbatlas.NewApiKey(ctx, "test", &mongodbatlas.ApiKeyArgs{
Description: pulumi.String("key-name"),
OrgId: pulumi.String("<ORG_ID>"),
RoleNames: pulumi.StringArray{
pulumi.String("ORG_READ_ONLY"),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Mongodbatlas = Pulumi.Mongodbatlas;
return await Deployment.RunAsync(() =>
{
var test = new Mongodbatlas.ApiKey("test", new()
{
Description = "key-name",
OrgId = "<ORG_ID>",
RoleNames = new[]
{
"ORG_READ_ONLY",
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.mongodbatlas.ApiKey;
import com.pulumi.mongodbatlas.ApiKeyArgs;
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 test = new ApiKey("test", ApiKeyArgs.builder()
.description("key-name")
.orgId("<ORG_ID>")
.roleNames("ORG_READ_ONLY")
.build());
}
}
resources:
test:
type: mongodbatlas:ApiKey
properties:
description: key-name
orgId: <ORG_ID>
roleNames:
- ORG_READ_ONLY
## Attributes Reference
In addition to all arguments above, the following attributes are exported:
api_key_id
- Unique identifier for this Organization API key.
Create ApiKey Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ApiKey(name: string, args: ApiKeyArgs, opts?: CustomResourceOptions);
@overload
def ApiKey(resource_name: str,
args: ApiKeyArgs,
opts: Optional[ResourceOptions] = None)
@overload
def ApiKey(resource_name: str,
opts: Optional[ResourceOptions] = None,
description: Optional[str] = None,
org_id: Optional[str] = None,
role_names: Optional[Sequence[str]] = None)
func NewApiKey(ctx *Context, name string, args ApiKeyArgs, opts ...ResourceOption) (*ApiKey, error)
public ApiKey(string name, ApiKeyArgs args, CustomResourceOptions? opts = null)
public ApiKey(String name, ApiKeyArgs args)
public ApiKey(String name, ApiKeyArgs args, CustomResourceOptions options)
type: mongodbatlas:ApiKey
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 ApiKeyArgs
- 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 ApiKeyArgs
- 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 ApiKeyArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ApiKeyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ApiKeyArgs
- 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 apiKeyResource = new Mongodbatlas.ApiKey("apiKeyResource", new()
{
Description = "string",
OrgId = "string",
RoleNames = new[]
{
"string",
},
});
example, err := mongodbatlas.NewApiKey(ctx, "apiKeyResource", &mongodbatlas.ApiKeyArgs{
Description: pulumi.String("string"),
OrgId: pulumi.String("string"),
RoleNames: pulumi.StringArray{
pulumi.String("string"),
},
})
var apiKeyResource = new ApiKey("apiKeyResource", ApiKeyArgs.builder()
.description("string")
.orgId("string")
.roleNames("string")
.build());
api_key_resource = mongodbatlas.ApiKey("apiKeyResource",
description="string",
org_id="string",
role_names=["string"])
const apiKeyResource = new mongodbatlas.ApiKey("apiKeyResource", {
description: "string",
orgId: "string",
roleNames: ["string"],
});
type: mongodbatlas:ApiKey
properties:
description: string
orgId: string
roleNames:
- string
ApiKey Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The ApiKey resource accepts the following input properties:
- Description string
- Description of this Organization API key.
- Org
Id string - Unique identifier for the organization whose API keys you want to retrieve. Use the /orgs endpoint to retrieve all organizations to which the authenticated user has access.
- Role
Names List<string> - Name of the role. This resource returns all the roles the user has in Atlas.
The following are valid roles:
ORG_OWNER
ORG_GROUP_CREATOR
ORG_BILLING_ADMIN
ORG_READ_ONLY
ORG_MEMBER
- Description string
- Description of this Organization API key.
- Org
Id string - Unique identifier for the organization whose API keys you want to retrieve. Use the /orgs endpoint to retrieve all organizations to which the authenticated user has access.
- Role
Names []string - Name of the role. This resource returns all the roles the user has in Atlas.
The following are valid roles:
ORG_OWNER
ORG_GROUP_CREATOR
ORG_BILLING_ADMIN
ORG_READ_ONLY
ORG_MEMBER
- description String
- Description of this Organization API key.
- org
Id String - Unique identifier for the organization whose API keys you want to retrieve. Use the /orgs endpoint to retrieve all organizations to which the authenticated user has access.
- role
Names List<String> - Name of the role. This resource returns all the roles the user has in Atlas.
The following are valid roles:
ORG_OWNER
ORG_GROUP_CREATOR
ORG_BILLING_ADMIN
ORG_READ_ONLY
ORG_MEMBER
- description string
- Description of this Organization API key.
- org
Id string - Unique identifier for the organization whose API keys you want to retrieve. Use the /orgs endpoint to retrieve all organizations to which the authenticated user has access.
- role
Names string[] - Name of the role. This resource returns all the roles the user has in Atlas.
The following are valid roles:
ORG_OWNER
ORG_GROUP_CREATOR
ORG_BILLING_ADMIN
ORG_READ_ONLY
ORG_MEMBER
- description str
- Description of this Organization API key.
- org_
id str - Unique identifier for the organization whose API keys you want to retrieve. Use the /orgs endpoint to retrieve all organizations to which the authenticated user has access.
- role_
names Sequence[str] - Name of the role. This resource returns all the roles the user has in Atlas.
The following are valid roles:
ORG_OWNER
ORG_GROUP_CREATOR
ORG_BILLING_ADMIN
ORG_READ_ONLY
ORG_MEMBER
- description String
- Description of this Organization API key.
- org
Id String - Unique identifier for the organization whose API keys you want to retrieve. Use the /orgs endpoint to retrieve all organizations to which the authenticated user has access.
- role
Names List<String> - Name of the role. This resource returns all the roles the user has in Atlas.
The following are valid roles:
ORG_OWNER
ORG_GROUP_CREATOR
ORG_BILLING_ADMIN
ORG_READ_ONLY
ORG_MEMBER
Outputs
All input properties are implicitly available as output properties. Additionally, the ApiKey resource produces the following output properties:
- Api
Key stringId - Id string
- The provider-assigned unique ID for this managed resource.
- Private
Key string - Public
Key string
- Api
Key stringId - Id string
- The provider-assigned unique ID for this managed resource.
- Private
Key string - Public
Key string
- api
Key StringId - id String
- The provider-assigned unique ID for this managed resource.
- private
Key String - public
Key String
- api
Key stringId - id string
- The provider-assigned unique ID for this managed resource.
- private
Key string - public
Key string
- api_
key_ strid - id str
- The provider-assigned unique ID for this managed resource.
- private_
key str - public_
key str
- api
Key StringId - id String
- The provider-assigned unique ID for this managed resource.
- private
Key String - public
Key String
Look up Existing ApiKey Resource
Get an existing ApiKey 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?: ApiKeyState, opts?: CustomResourceOptions): ApiKey
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
api_key_id: Optional[str] = None,
description: Optional[str] = None,
org_id: Optional[str] = None,
private_key: Optional[str] = None,
public_key: Optional[str] = None,
role_names: Optional[Sequence[str]] = None) -> ApiKey
func GetApiKey(ctx *Context, name string, id IDInput, state *ApiKeyState, opts ...ResourceOption) (*ApiKey, error)
public static ApiKey Get(string name, Input<string> id, ApiKeyState? state, CustomResourceOptions? opts = null)
public static ApiKey get(String name, Output<String> id, ApiKeyState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- 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.
- Api
Key stringId - Description string
- Description of this Organization API key.
- Org
Id string - Unique identifier for the organization whose API keys you want to retrieve. Use the /orgs endpoint to retrieve all organizations to which the authenticated user has access.
- Private
Key string - Public
Key string - Role
Names List<string> - Name of the role. This resource returns all the roles the user has in Atlas.
The following are valid roles:
ORG_OWNER
ORG_GROUP_CREATOR
ORG_BILLING_ADMIN
ORG_READ_ONLY
ORG_MEMBER
- Api
Key stringId - Description string
- Description of this Organization API key.
- Org
Id string - Unique identifier for the organization whose API keys you want to retrieve. Use the /orgs endpoint to retrieve all organizations to which the authenticated user has access.
- Private
Key string - Public
Key string - Role
Names []string - Name of the role. This resource returns all the roles the user has in Atlas.
The following are valid roles:
ORG_OWNER
ORG_GROUP_CREATOR
ORG_BILLING_ADMIN
ORG_READ_ONLY
ORG_MEMBER
- api
Key StringId - description String
- Description of this Organization API key.
- org
Id String - Unique identifier for the organization whose API keys you want to retrieve. Use the /orgs endpoint to retrieve all organizations to which the authenticated user has access.
- private
Key String - public
Key String - role
Names List<String> - Name of the role. This resource returns all the roles the user has in Atlas.
The following are valid roles:
ORG_OWNER
ORG_GROUP_CREATOR
ORG_BILLING_ADMIN
ORG_READ_ONLY
ORG_MEMBER
- api
Key stringId - description string
- Description of this Organization API key.
- org
Id string - Unique identifier for the organization whose API keys you want to retrieve. Use the /orgs endpoint to retrieve all organizations to which the authenticated user has access.
- private
Key string - public
Key string - role
Names string[] - Name of the role. This resource returns all the roles the user has in Atlas.
The following are valid roles:
ORG_OWNER
ORG_GROUP_CREATOR
ORG_BILLING_ADMIN
ORG_READ_ONLY
ORG_MEMBER
- api_
key_ strid - description str
- Description of this Organization API key.
- org_
id str - Unique identifier for the organization whose API keys you want to retrieve. Use the /orgs endpoint to retrieve all organizations to which the authenticated user has access.
- private_
key str - public_
key str - role_
names Sequence[str] - Name of the role. This resource returns all the roles the user has in Atlas.
The following are valid roles:
ORG_OWNER
ORG_GROUP_CREATOR
ORG_BILLING_ADMIN
ORG_READ_ONLY
ORG_MEMBER
- api
Key StringId - description String
- Description of this Organization API key.
- org
Id String - Unique identifier for the organization whose API keys you want to retrieve. Use the /orgs endpoint to retrieve all organizations to which the authenticated user has access.
- private
Key String - public
Key String - role
Names List<String> - Name of the role. This resource returns all the roles the user has in Atlas.
The following are valid roles:
ORG_OWNER
ORG_GROUP_CREATOR
ORG_BILLING_ADMIN
ORG_READ_ONLY
ORG_MEMBER
Import
API Keys must be imported using org ID, API Key ID e.g.
$ pulumi import mongodbatlas:index/apiKey:ApiKey test 5d09d6a59ccf6445652a444a-6576974933969669
See MongoDB Atlas API - API Key Documentation for more information.
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
mongodbatlas
Terraform Provider.