MongoDB Atlas v3.20.4 published on Wednesday, Oct 30, 2024 by Pulumi
mongodbatlas.getProjectApiKey
Explore with Pulumi AI
Example Usage
Using project_id and api_key_id attribute to query
import * as pulumi from "@pulumi/pulumi";
import * as mongodbatlas from "@pulumi/mongodbatlas";
const testProjectApiKey = new mongodbatlas.ProjectApiKey("test", {
description: "Description of your API key",
projectAssignments: [{
projectId: "64259ee860c43338194b0f8e",
roleNames: ["GROUP_READ_ONLY"],
}],
});
const test = mongodbatlas.getProjectApiKey({
projectId: "64259ee860c43338194b0f8e",
apiKeyId: testMongodbatlasApiKey.apiKeyId,
});
import pulumi
import pulumi_mongodbatlas as mongodbatlas
test_project_api_key = mongodbatlas.ProjectApiKey("test",
description="Description of your API key",
project_assignments=[{
"project_id": "64259ee860c43338194b0f8e",
"role_names": ["GROUP_READ_ONLY"],
}])
test = mongodbatlas.get_project_api_key(project_id="64259ee860c43338194b0f8e",
api_key_id=test_mongodbatlas_api_key["apiKeyId"])
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("Description of your API key"),
ProjectAssignments: mongodbatlas.ProjectApiKeyProjectAssignmentArray{
&mongodbatlas.ProjectApiKeyProjectAssignmentArgs{
ProjectId: pulumi.String("64259ee860c43338194b0f8e"),
RoleNames: pulumi.StringArray{
pulumi.String("GROUP_READ_ONLY"),
},
},
},
})
if err != nil {
return err
}
_, err = mongodbatlas.LookupProjectApiKey(ctx, &mongodbatlas.LookupProjectApiKeyArgs{
ProjectId: "64259ee860c43338194b0f8e",
ApiKeyId: testMongodbatlasApiKey.ApiKeyId,
}, nil)
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 testProjectApiKey = new Mongodbatlas.ProjectApiKey("test", new()
{
Description = "Description of your API key",
ProjectAssignments = new[]
{
new Mongodbatlas.Inputs.ProjectApiKeyProjectAssignmentArgs
{
ProjectId = "64259ee860c43338194b0f8e",
RoleNames = new[]
{
"GROUP_READ_ONLY",
},
},
},
});
var test = Mongodbatlas.GetProjectApiKey.Invoke(new()
{
ProjectId = "64259ee860c43338194b0f8e",
ApiKeyId = testMongodbatlasApiKey.ApiKeyId,
});
});
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 com.pulumi.mongodbatlas.inputs.ProjectApiKeyProjectAssignmentArgs;
import com.pulumi.mongodbatlas.MongodbatlasFunctions;
import com.pulumi.mongodbatlas.inputs.GetProjectApiKeyArgs;
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 testProjectApiKey = new ProjectApiKey("testProjectApiKey", ProjectApiKeyArgs.builder()
.description("Description of your API key")
.projectAssignments(ProjectApiKeyProjectAssignmentArgs.builder()
.projectId("64259ee860c43338194b0f8e")
.roleNames("GROUP_READ_ONLY")
.build())
.build());
final var test = MongodbatlasFunctions.getProjectApiKey(GetProjectApiKeyArgs.builder()
.projectId("64259ee860c43338194b0f8e")
.apiKeyId(testMongodbatlasApiKey.apiKeyId())
.build());
}
}
resources:
testProjectApiKey:
type: mongodbatlas:ProjectApiKey
name: test
properties:
description: Description of your API key
projectAssignments:
- projectId: 64259ee860c43338194b0f8e
roleNames:
- GROUP_READ_ONLY
variables:
test:
fn::invoke:
Function: mongodbatlas:getProjectApiKey
Arguments:
projectId: 64259ee860c43338194b0f8e
apiKeyId: ${testMongodbatlasApiKey.apiKeyId}
Using getProjectApiKey
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getProjectApiKey(args: GetProjectApiKeyArgs, opts?: InvokeOptions): Promise<GetProjectApiKeyResult>
function getProjectApiKeyOutput(args: GetProjectApiKeyOutputArgs, opts?: InvokeOptions): Output<GetProjectApiKeyResult>
def get_project_api_key(api_key_id: Optional[str] = None,
project_id: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetProjectApiKeyResult
def get_project_api_key_output(api_key_id: Optional[pulumi.Input[str]] = None,
project_id: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetProjectApiKeyResult]
func LookupProjectApiKey(ctx *Context, args *LookupProjectApiKeyArgs, opts ...InvokeOption) (*LookupProjectApiKeyResult, error)
func LookupProjectApiKeyOutput(ctx *Context, args *LookupProjectApiKeyOutputArgs, opts ...InvokeOption) LookupProjectApiKeyResultOutput
> Note: This function is named LookupProjectApiKey
in the Go SDK.
public static class GetProjectApiKey
{
public static Task<GetProjectApiKeyResult> InvokeAsync(GetProjectApiKeyArgs args, InvokeOptions? opts = null)
public static Output<GetProjectApiKeyResult> Invoke(GetProjectApiKeyInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetProjectApiKeyResult> getProjectApiKey(GetProjectApiKeyArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: mongodbatlas:index/getProjectApiKey:getProjectApiKey
arguments:
# arguments dictionary
The following arguments are supported:
- api_
key_ strid - Unique identifier for this Project API key.
- project_
id str - The unique ID for the project.
getProjectApiKey Result
The following output properties are available:
- Api
Key stringId - Description string
- Description of this Project API key.
- Id string
- The provider-assigned unique ID for this managed resource.
- Private
Key string - Private key for this Organization API key.
- Project
Assignments List<GetProject Api Key Project Assignment> - Project
Id string - Project ID to assign to Access Key
- Public
Key string - Public key for this Organization API key.
- Api
Key stringId - Description string
- Description of this Project API key.
- Id string
- The provider-assigned unique ID for this managed resource.
- Private
Key string - Private key for this Organization API key.
- Project
Assignments []GetProject Api Key Project Assignment - Project
Id string - Project ID to assign to Access Key
- Public
Key string - Public key for this Organization API key.
- api
Key StringId - description String
- Description of this Project API key.
- id String
- The provider-assigned unique ID for this managed resource.
- private
Key String - Private key for this Organization API key.
- project
Assignments List<GetProject Api Key Project Assignment> - project
Id String - Project ID to assign to Access Key
- public
Key String - Public key for this Organization API key.
- api
Key stringId - description string
- Description of this Project API key.
- id string
- The provider-assigned unique ID for this managed resource.
- private
Key string - Private key for this Organization API key.
- project
Assignments GetProject Api Key Project Assignment[] - project
Id string - Project ID to assign to Access Key
- public
Key string - Public key for this Organization API key.
- api_
key_ strid - description str
- Description of this Project API key.
- id str
- The provider-assigned unique ID for this managed resource.
- private_
key str - Private key for this Organization API key.
- project_
assignments Sequence[GetProject Api Key Project Assignment] - project_
id str - Project ID to assign to Access Key
- public_
key str - Public key for this Organization API key.
- api
Key StringId - description String
- Description of this Project API key.
- id String
- The provider-assigned unique ID for this managed resource.
- private
Key String - Private key for this Organization API key.
- project
Assignments List<Property Map> - project
Id String - Project ID to assign to Access Key
- public
Key String - Public key for this Organization API key.
Supporting Types
GetProjectApiKeyProjectAssignment
- Project
Id string - The unique ID for the project.
- Role
Names 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 MongoDB Documentation describes the valid roles that can be assigned.
- Project
Id string - The unique ID for the project.
- Role
Names []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 MongoDB Documentation describes the valid roles that can be assigned.
- project
Id String - The unique ID for the project.
- role
Names 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 MongoDB Documentation describes the valid roles that can be assigned.
- project
Id string - The unique ID for the project.
- role
Names 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 MongoDB Documentation describes the valid roles that can be assigned.
- project_
id str - The unique ID for the project.
- 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 MongoDB Documentation describes the valid roles that can be assigned.
- project
Id String - The unique ID for the project.
- role
Names 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 MongoDB Documentation describes the valid roles that can be assigned.
Package Details
- Repository
- MongoDB Atlas pulumi/pulumi-mongodbatlas
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
mongodbatlas
Terraform Provider.