mongodbatlas logo
MongoDB Atlas v3.7.2, Mar 31 23

mongodbatlas.ProjectApiKey

Explore with Pulumi AI

Import

API Keys must be imported using org ID, API Key ID e.g.

 $ pulumi import mongodbatlas:index/projectApiKey:ProjectApiKey test 5d09d6a59ccf6445652a444a-6576974933969669

See MongoDB Atlas API - API Key - Documentation for more information.

Example Usage

using System.Collections.Generic;
using Pulumi;
using Mongodbatlas = Pulumi.Mongodbatlas;

return await Deployment.RunAsync(() => 
{
    var test = new Mongodbatlas.ProjectApiKey("test", new()
    {
        Description = "key-name",
        ProjectId = "<PROJECT_ID>",
        RoleNames = new[]
        {
            "GROUP_OWNER",
        },
    });

});
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.NewProjectApiKey(ctx, "test", &mongodbatlas.ProjectApiKeyArgs{
			Description: pulumi.String("key-name"),
			ProjectId:   pulumi.String("<PROJECT_ID>"),
			RoleNames: pulumi.StringArray{
				pulumi.String("GROUP_OWNER"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.mongodbatlas.ProjectApiKey;
import com.pulumi.mongodbatlas.ProjectApiKeyArgs;
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 ProjectApiKey("test", ProjectApiKeyArgs.builder()        
            .description("key-name")
            .projectId("<PROJECT_ID>")
            .roleNames("GROUP_OWNER")
            .build());

    }
}
import pulumi
import pulumi_mongodbatlas as mongodbatlas

test = mongodbatlas.ProjectApiKey("test",
    description="key-name",
    project_id="<PROJECT_ID>",
    role_names=["GROUP_OWNER"])
import * as pulumi from "@pulumi/pulumi";
import * as mongodbatlas from "@pulumi/mongodbatlas";

const test = new mongodbatlas.ProjectApiKey("test", {
    description: "key-name",
    projectId: "<PROJECT_ID>",
    roleNames: ["GROUP_OWNER"],
});
resources:
  test:
    type: mongodbatlas:ProjectApiKey
    properties:
      description: key-name
      projectId: <PROJECT_ID>
      roleNames:
        - GROUP_OWNER

Create ProjectApiKey Resource

new ProjectApiKey(name: string, args: ProjectApiKeyArgs, opts?: CustomResourceOptions);
@overload
def ProjectApiKey(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  description: Optional[str] = None,
                  project_id: Optional[str] = None,
                  role_names: Optional[Sequence[str]] = None)
@overload
def ProjectApiKey(resource_name: str,
                  args: ProjectApiKeyInitArgs,
                  opts: Optional[ResourceOptions] = None)
func NewProjectApiKey(ctx *Context, name string, args ProjectApiKeyArgs, opts ...ResourceOption) (*ProjectApiKey, error)
public ProjectApiKey(string name, ProjectApiKeyArgs args, CustomResourceOptions? opts = null)
public ProjectApiKey(String name, ProjectApiKeyArgs args)
public ProjectApiKey(String name, ProjectApiKeyArgs args, CustomResourceOptions options)
type: mongodbatlas:ProjectApiKey
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args ProjectApiKeyArgs
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 ProjectApiKeyInitArgs
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 ProjectApiKeyArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args ProjectApiKeyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args ProjectApiKeyArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

ProjectApiKey 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 ProjectApiKey resource accepts the following input properties:

Description string

Description of this Organization API key.

ProjectId string
RoleNames List<string>

List of Project roles that the Programmatic API key needs to have. Ensure you provide: at least one role and ensure all roles are valid for the Project. You must specify an array even if you are only associating a single role with the Programmatic API key. The following are valid roles:

Description string

Description of this Organization API key.

ProjectId string
RoleNames []string

List of Project roles that the Programmatic API key needs to have. Ensure you provide: at least one role and ensure all roles are valid for the Project. You must specify an array even if you are only associating a single role with the Programmatic API key. The following are valid roles:

description String

Description of this Organization API key.

projectId String
roleNames List<String>

List of Project roles that the Programmatic API key needs to have. Ensure you provide: at least one role and ensure all roles are valid for the Project. You must specify an array even if you are only associating a single role with the Programmatic API key. The following are valid roles:

description string

Description of this Organization API key.

projectId string
roleNames string[]

List of Project roles that the Programmatic API key needs to have. Ensure you provide: at least one role and ensure all roles are valid for the Project. You must specify an array even if you are only associating a single role with the Programmatic API key. The following are valid roles:

description str

Description of this Organization API key.

project_id str
role_names Sequence[str]

List of Project roles that the Programmatic API key needs to have. Ensure you provide: at least one role and ensure all roles are valid for the Project. You must specify an array even if you are only associating a single role with the Programmatic API key. The following are valid roles:

description String

Description of this Organization API key.

projectId String
roleNames List<String>

List of Project roles that the Programmatic API key needs to have. Ensure you provide: at least one role and ensure all roles are valid for the Project. You must specify an array even if you are only associating a single role with the Programmatic API key. The following are valid roles:

Outputs

All input properties are implicitly available as output properties. Additionally, the ProjectApiKey resource produces the following output properties:

ApiKeyId string

The unique identifier of the Programmatic API key you want to associate with the Project. The Programmatic API key and Project must share the same parent organization. Note: this is not the publicKey of the Programmatic API key but the id of the key. See Programmatic API Keys for more.

Id string

The provider-assigned unique ID for this managed resource.

PrivateKey string
PublicKey string
ApiKeyId string

The unique identifier of the Programmatic API key you want to associate with the Project. The Programmatic API key and Project must share the same parent organization. Note: this is not the publicKey of the Programmatic API key but the id of the key. See Programmatic API Keys for more.

Id string

The provider-assigned unique ID for this managed resource.

PrivateKey string
PublicKey string
apiKeyId String

The unique identifier of the Programmatic API key you want to associate with the Project. The Programmatic API key and Project must share the same parent organization. Note: this is not the publicKey of the Programmatic API key but the id of the key. See Programmatic API Keys for more.

id String

The provider-assigned unique ID for this managed resource.

privateKey String
publicKey String
apiKeyId string

The unique identifier of the Programmatic API key you want to associate with the Project. The Programmatic API key and Project must share the same parent organization. Note: this is not the publicKey of the Programmatic API key but the id of the key. See Programmatic API Keys for more.

id string

The provider-assigned unique ID for this managed resource.

privateKey string
publicKey string
api_key_id str

The unique identifier of the Programmatic API key you want to associate with the Project. The Programmatic API key and Project must share the same parent organization. Note: this is not the publicKey of the Programmatic API key but the id of the key. See Programmatic API Keys for more.

id str

The provider-assigned unique ID for this managed resource.

private_key str
public_key str
apiKeyId String

The unique identifier of the Programmatic API key you want to associate with the Project. The Programmatic API key and Project must share the same parent organization. Note: this is not the publicKey of the Programmatic API key but the id of the key. See Programmatic API Keys for more.

id String

The provider-assigned unique ID for this managed resource.

privateKey String
publicKey String

Look up Existing ProjectApiKey Resource

Get an existing ProjectApiKey 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?: ProjectApiKeyState, opts?: CustomResourceOptions): ProjectApiKey
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        api_key_id: Optional[str] = None,
        description: Optional[str] = None,
        private_key: Optional[str] = None,
        project_id: Optional[str] = None,
        public_key: Optional[str] = None,
        role_names: Optional[Sequence[str]] = None) -> ProjectApiKey
func GetProjectApiKey(ctx *Context, name string, id IDInput, state *ProjectApiKeyState, opts ...ResourceOption) (*ProjectApiKey, error)
public static ProjectApiKey Get(string name, Input<string> id, ProjectApiKeyState? state, CustomResourceOptions? opts = null)
public static ProjectApiKey get(String name, Output<String> id, ProjectApiKeyState 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.
The following state arguments are supported:
ApiKeyId string

The unique identifier of the Programmatic API key you want to associate with the Project. The Programmatic API key and Project must share the same parent organization. Note: this is not the publicKey of the Programmatic API key but the id of the key. See Programmatic API Keys for more.

Description string

Description of this Organization API key.

PrivateKey string
ProjectId string
PublicKey string
RoleNames List<string>

List of Project roles that the Programmatic API key needs to have. Ensure you provide: at least one role and ensure all roles are valid for the Project. You must specify an array even if you are only associating a single role with the Programmatic API key. The following are valid roles:

ApiKeyId string

The unique identifier of the Programmatic API key you want to associate with the Project. The Programmatic API key and Project must share the same parent organization. Note: this is not the publicKey of the Programmatic API key but the id of the key. See Programmatic API Keys for more.

Description string

Description of this Organization API key.

PrivateKey string
ProjectId string
PublicKey string
RoleNames []string

List of Project roles that the Programmatic API key needs to have. Ensure you provide: at least one role and ensure all roles are valid for the Project. You must specify an array even if you are only associating a single role with the Programmatic API key. The following are valid roles:

apiKeyId String

The unique identifier of the Programmatic API key you want to associate with the Project. The Programmatic API key and Project must share the same parent organization. Note: this is not the publicKey of the Programmatic API key but the id of the key. See Programmatic API Keys for more.

description String

Description of this Organization API key.

privateKey String
projectId String
publicKey String
roleNames List<String>

List of Project roles that the Programmatic API key needs to have. Ensure you provide: at least one role and ensure all roles are valid for the Project. You must specify an array even if you are only associating a single role with the Programmatic API key. The following are valid roles:

apiKeyId string

The unique identifier of the Programmatic API key you want to associate with the Project. The Programmatic API key and Project must share the same parent organization. Note: this is not the publicKey of the Programmatic API key but the id of the key. See Programmatic API Keys for more.

description string

Description of this Organization API key.

privateKey string
projectId string
publicKey string
roleNames string[]

List of Project roles that the Programmatic API key needs to have. Ensure you provide: at least one role and ensure all roles are valid for the Project. You must specify an array even if you are only associating a single role with the Programmatic API key. The following are valid roles:

api_key_id str

The unique identifier of the Programmatic API key you want to associate with the Project. The Programmatic API key and Project must share the same parent organization. Note: this is not the publicKey of the Programmatic API key but the id of the key. See Programmatic API Keys for more.

description str

Description of this Organization API key.

private_key str
project_id str
public_key str
role_names Sequence[str]

List of Project roles that the Programmatic API key needs to have. Ensure you provide: at least one role and ensure all roles are valid for the Project. You must specify an array even if you are only associating a single role with the Programmatic API key. The following are valid roles:

apiKeyId String

The unique identifier of the Programmatic API key you want to associate with the Project. The Programmatic API key and Project must share the same parent organization. Note: this is not the publicKey of the Programmatic API key but the id of the key. See Programmatic API Keys for more.

description String

Description of this Organization API key.

privateKey String
projectId String
publicKey String
roleNames List<String>

List of Project roles that the Programmatic API key needs to have. Ensure you provide: at least one role and ensure all roles are valid for the Project. You must specify an array even if you are only associating a single role with the Programmatic API key. The following are valid roles:

Package Details

Repository
MongoDB Atlas pulumi/pulumi-mongodbatlas
License
Apache-2.0
Notes

This Pulumi package is based on the mongodbatlas Terraform Provider.