1. Packages
  2. Mongodbatlas Provider
  3. API Docs
  4. getPushBasedLogExport
MongoDB Atlas v3.20.4 published on Wednesday, Oct 30, 2024 by Pulumi

mongodbatlas.getPushBasedLogExport

Explore with Pulumi AI

mongodbatlas logo
MongoDB Atlas v3.20.4 published on Wednesday, Oct 30, 2024 by Pulumi

    # Data Source: mongodbatlas.PushBasedLogExport

    mongodbatlas.PushBasedLogExport describes the configured project level settings for the push-based log export feature.

    Example Usage

    S

    import * as pulumi from "@pulumi/pulumi";
    import * as mongodbatlas from "@pulumi/mongodbatlas";
    
    export = async () => {
        const project_tf = new mongodbatlas.Project("project-tf", {
            name: atlasProjectName,
            orgId: atlasOrgId,
        });
        // Set up cloud provider access in Atlas using the created IAM role
        const setupOnly = new mongodbatlas.CloudProviderAccessSetup("setup_only", {
            projectId: project_tf.id,
            providerName: "AWS",
        });
        const authRole = new mongodbatlas.CloudProviderAccessAuthorization("auth_role", {
            projectId: project_tf.id,
            roleId: setupOnly.roleId,
            aws: {
                iamAssumedRoleArn: testRole.arn,
            },
        });
        // Set up push-based log export with authorized IAM role
        const testPushBasedLogExport = new mongodbatlas.PushBasedLogExport("test", {
            projectId: project_tf.id,
            bucketName: logBucket.bucket,
            iamRoleId: authRole.roleId,
            prefixPath: "push-based-log-test",
        });
        const test = mongodbatlas.getPushBasedLogExportOutput({
            projectId: testPushBasedLogExport.projectId,
        });
        return {
            test: test.apply(test => test.prefixPath),
        };
    }
    
    import pulumi
    import pulumi_mongodbatlas as mongodbatlas
    
    project_tf = mongodbatlas.Project("project-tf",
        name=atlas_project_name,
        org_id=atlas_org_id)
    # Set up cloud provider access in Atlas using the created IAM role
    setup_only = mongodbatlas.CloudProviderAccessSetup("setup_only",
        project_id=project_tf.id,
        provider_name="AWS")
    auth_role = mongodbatlas.CloudProviderAccessAuthorization("auth_role",
        project_id=project_tf.id,
        role_id=setup_only.role_id,
        aws={
            "iam_assumed_role_arn": test_role["arn"],
        })
    # Set up push-based log export with authorized IAM role
    test_push_based_log_export = mongodbatlas.PushBasedLogExport("test",
        project_id=project_tf.id,
        bucket_name=log_bucket["bucket"],
        iam_role_id=auth_role.role_id,
        prefix_path="push-based-log-test")
    test = mongodbatlas.get_push_based_log_export_output(project_id=test_push_based_log_export.project_id)
    pulumi.export("test", test.prefix_path)
    
    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.NewProject(ctx, "project-tf", &mongodbatlas.ProjectArgs{
    			Name:  pulumi.Any(atlasProjectName),
    			OrgId: pulumi.Any(atlasOrgId),
    		})
    		if err != nil {
    			return err
    		}
    		// Set up cloud provider access in Atlas using the created IAM role
    		setupOnly, err := mongodbatlas.NewCloudProviderAccessSetup(ctx, "setup_only", &mongodbatlas.CloudProviderAccessSetupArgs{
    			ProjectId:    project_tf.ID(),
    			ProviderName: pulumi.String("AWS"),
    		})
    		if err != nil {
    			return err
    		}
    		authRole, err := mongodbatlas.NewCloudProviderAccessAuthorization(ctx, "auth_role", &mongodbatlas.CloudProviderAccessAuthorizationArgs{
    			ProjectId: project_tf.ID(),
    			RoleId:    setupOnly.RoleId,
    			Aws: &mongodbatlas.CloudProviderAccessAuthorizationAwsArgs{
    				IamAssumedRoleArn: pulumi.Any(testRole.Arn),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		// Set up push-based log export with authorized IAM role
    		testPushBasedLogExport, err := mongodbatlas.NewPushBasedLogExport(ctx, "test", &mongodbatlas.PushBasedLogExportArgs{
    			ProjectId:  project_tf.ID(),
    			BucketName: pulumi.Any(logBucket.Bucket),
    			IamRoleId:  authRole.RoleId,
    			PrefixPath: pulumi.String("push-based-log-test"),
    		})
    		if err != nil {
    			return err
    		}
    		test := mongodbatlas.LookupPushBasedLogExportOutput(ctx, mongodbatlas.GetPushBasedLogExportOutputArgs{
    			ProjectId: testPushBasedLogExport.ProjectId,
    		}, nil)
    		ctx.Export("test", test.ApplyT(func(test mongodbatlas.GetPushBasedLogExportResult) (*string, error) {
    			return &test.PrefixPath, nil
    		}).(pulumi.StringPtrOutput))
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Mongodbatlas = Pulumi.Mongodbatlas;
    
    return await Deployment.RunAsync(() => 
    {
        var project_tf = new Mongodbatlas.Project("project-tf", new()
        {
            Name = atlasProjectName,
            OrgId = atlasOrgId,
        });
    
        // Set up cloud provider access in Atlas using the created IAM role
        var setupOnly = new Mongodbatlas.CloudProviderAccessSetup("setup_only", new()
        {
            ProjectId = project_tf.Id,
            ProviderName = "AWS",
        });
    
        var authRole = new Mongodbatlas.CloudProviderAccessAuthorization("auth_role", new()
        {
            ProjectId = project_tf.Id,
            RoleId = setupOnly.RoleId,
            Aws = new Mongodbatlas.Inputs.CloudProviderAccessAuthorizationAwsArgs
            {
                IamAssumedRoleArn = testRole.Arn,
            },
        });
    
        // Set up push-based log export with authorized IAM role
        var testPushBasedLogExport = new Mongodbatlas.PushBasedLogExport("test", new()
        {
            ProjectId = project_tf.Id,
            BucketName = logBucket.Bucket,
            IamRoleId = authRole.RoleId,
            PrefixPath = "push-based-log-test",
        });
    
        var test = Mongodbatlas.GetPushBasedLogExport.Invoke(new()
        {
            ProjectId = testPushBasedLogExport.ProjectId,
        });
    
        return new Dictionary<string, object?>
        {
            ["test"] = test.Apply(getPushBasedLogExportResult => getPushBasedLogExportResult.PrefixPath),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.mongodbatlas.Project;
    import com.pulumi.mongodbatlas.ProjectArgs;
    import com.pulumi.mongodbatlas.CloudProviderAccessSetup;
    import com.pulumi.mongodbatlas.CloudProviderAccessSetupArgs;
    import com.pulumi.mongodbatlas.CloudProviderAccessAuthorization;
    import com.pulumi.mongodbatlas.CloudProviderAccessAuthorizationArgs;
    import com.pulumi.mongodbatlas.inputs.CloudProviderAccessAuthorizationAwsArgs;
    import com.pulumi.mongodbatlas.PushBasedLogExport;
    import com.pulumi.mongodbatlas.PushBasedLogExportArgs;
    import com.pulumi.mongodbatlas.MongodbatlasFunctions;
    import com.pulumi.mongodbatlas.inputs.GetPushBasedLogExportArgs;
    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 project_tf = new Project("project-tf", ProjectArgs.builder()
                .name(atlasProjectName)
                .orgId(atlasOrgId)
                .build());
    
            // Set up cloud provider access in Atlas using the created IAM role
            var setupOnly = new CloudProviderAccessSetup("setupOnly", CloudProviderAccessSetupArgs.builder()
                .projectId(project_tf.id())
                .providerName("AWS")
                .build());
    
            var authRole = new CloudProviderAccessAuthorization("authRole", CloudProviderAccessAuthorizationArgs.builder()
                .projectId(project_tf.id())
                .roleId(setupOnly.roleId())
                .aws(CloudProviderAccessAuthorizationAwsArgs.builder()
                    .iamAssumedRoleArn(testRole.arn())
                    .build())
                .build());
    
            // Set up push-based log export with authorized IAM role
            var testPushBasedLogExport = new PushBasedLogExport("testPushBasedLogExport", PushBasedLogExportArgs.builder()
                .projectId(project_tf.id())
                .bucketName(logBucket.bucket())
                .iamRoleId(authRole.roleId())
                .prefixPath("push-based-log-test")
                .build());
    
            final var test = MongodbatlasFunctions.getPushBasedLogExport(GetPushBasedLogExportArgs.builder()
                .projectId(testPushBasedLogExport.projectId())
                .build());
    
            ctx.export("test", test.applyValue(getPushBasedLogExportResult -> getPushBasedLogExportResult).applyValue(test -> test.applyValue(getPushBasedLogExportResult -> getPushBasedLogExportResult.prefixPath())));
        }
    }
    
    resources:
      project-tf:
        type: mongodbatlas:Project
        properties:
          name: ${atlasProjectName}
          orgId: ${atlasOrgId}
      # Set up cloud provider access in Atlas using the created IAM role
      setupOnly:
        type: mongodbatlas:CloudProviderAccessSetup
        name: setup_only
        properties:
          projectId: ${["project-tf"].id}
          providerName: AWS
      authRole:
        type: mongodbatlas:CloudProviderAccessAuthorization
        name: auth_role
        properties:
          projectId: ${["project-tf"].id}
          roleId: ${setupOnly.roleId}
          aws:
            iamAssumedRoleArn: ${testRole.arn}
      # Set up push-based log export with authorized IAM role
      testPushBasedLogExport:
        type: mongodbatlas:PushBasedLogExport
        name: test
        properties:
          projectId: ${["project-tf"].id}
          bucketName: ${logBucket.bucket}
          iamRoleId: ${authRole.roleId}
          prefixPath: push-based-log-test
    variables:
      test:
        fn::invoke:
          Function: mongodbatlas:getPushBasedLogExport
          Arguments:
            projectId: ${testPushBasedLogExport.projectId}
    outputs:
      test: ${test.prefixPath}
    

    Using getPushBasedLogExport

    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 getPushBasedLogExport(args: GetPushBasedLogExportArgs, opts?: InvokeOptions): Promise<GetPushBasedLogExportResult>
    function getPushBasedLogExportOutput(args: GetPushBasedLogExportOutputArgs, opts?: InvokeOptions): Output<GetPushBasedLogExportResult>
    def get_push_based_log_export(project_id: Optional[str] = None,
                                  opts: Optional[InvokeOptions] = None) -> GetPushBasedLogExportResult
    def get_push_based_log_export_output(project_id: Optional[pulumi.Input[str]] = None,
                                  opts: Optional[InvokeOptions] = None) -> Output[GetPushBasedLogExportResult]
    func LookupPushBasedLogExport(ctx *Context, args *LookupPushBasedLogExportArgs, opts ...InvokeOption) (*LookupPushBasedLogExportResult, error)
    func LookupPushBasedLogExportOutput(ctx *Context, args *LookupPushBasedLogExportOutputArgs, opts ...InvokeOption) LookupPushBasedLogExportResultOutput

    > Note: This function is named LookupPushBasedLogExport in the Go SDK.

    public static class GetPushBasedLogExport 
    {
        public static Task<GetPushBasedLogExportResult> InvokeAsync(GetPushBasedLogExportArgs args, InvokeOptions? opts = null)
        public static Output<GetPushBasedLogExportResult> Invoke(GetPushBasedLogExportInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetPushBasedLogExportResult> getPushBasedLogExport(GetPushBasedLogExportArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: mongodbatlas:index/getPushBasedLogExport:getPushBasedLogExport
      arguments:
        # arguments dictionary

    The following arguments are supported:

    ProjectId string
    Unique 24-hexadecimal digit string that identifies your project. Use the /groups endpoint to retrieve all projects to which the authenticated user has access.
    ProjectId string
    Unique 24-hexadecimal digit string that identifies your project. Use the /groups endpoint to retrieve all projects to which the authenticated user has access.
    projectId String
    Unique 24-hexadecimal digit string that identifies your project. Use the /groups endpoint to retrieve all projects to which the authenticated user has access.
    projectId string
    Unique 24-hexadecimal digit string that identifies your project. Use the /groups endpoint to retrieve all projects to which the authenticated user has access.
    project_id str
    Unique 24-hexadecimal digit string that identifies your project. Use the /groups endpoint to retrieve all projects to which the authenticated user has access.
    projectId String
    Unique 24-hexadecimal digit string that identifies your project. Use the /groups endpoint to retrieve all projects to which the authenticated user has access.

    getPushBasedLogExport Result

    The following output properties are available:

    BucketName string
    CreateDate string
    IamRoleId string
    Id string
    The provider-assigned unique ID for this managed resource.
    PrefixPath string
    ProjectId string
    Unique 24-hexadecimal digit string that identifies your project. Use the /groups endpoint to retrieve all projects to which the authenticated user has access.
    State string
    BucketName string
    CreateDate string
    IamRoleId string
    Id string
    The provider-assigned unique ID for this managed resource.
    PrefixPath string
    ProjectId string
    Unique 24-hexadecimal digit string that identifies your project. Use the /groups endpoint to retrieve all projects to which the authenticated user has access.
    State string
    bucketName String
    createDate String
    iamRoleId String
    id String
    The provider-assigned unique ID for this managed resource.
    prefixPath String
    projectId String
    Unique 24-hexadecimal digit string that identifies your project. Use the /groups endpoint to retrieve all projects to which the authenticated user has access.
    state String
    bucketName string
    createDate string
    iamRoleId string
    id string
    The provider-assigned unique ID for this managed resource.
    prefixPath string
    projectId string
    Unique 24-hexadecimal digit string that identifies your project. Use the /groups endpoint to retrieve all projects to which the authenticated user has access.
    state string
    bucket_name str
    create_date str
    iam_role_id str
    id str
    The provider-assigned unique ID for this managed resource.
    prefix_path str
    project_id str
    Unique 24-hexadecimal digit string that identifies your project. Use the /groups endpoint to retrieve all projects to which the authenticated user has access.
    state str
    bucketName String
    createDate String
    iamRoleId String
    id String
    The provider-assigned unique ID for this managed resource.
    prefixPath String
    projectId String
    Unique 24-hexadecimal digit string that identifies your project. Use the /groups endpoint to retrieve all projects to which the authenticated user has access.
    state String

    Package Details

    Repository
    MongoDB Atlas pulumi/pulumi-mongodbatlas
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the mongodbatlas Terraform Provider.
    mongodbatlas logo
    MongoDB Atlas v3.20.4 published on Wednesday, Oct 30, 2024 by Pulumi