databricks.MwsCredentials
Explore with Pulumi AI
Related Resources
The following resources are used in the same context:
- Provisioning Databricks on AWS guide.
- databricks.MwsCustomerManagedKeys to configure KMS keys for new workspaces within AWS.
- databricks.MwsLogDelivery to configure delivery of billable usage logs and audit logs.
- databricks.MwsNetworks to configure VPC & subnets for new workspaces within AWS.
- databricks.MwsStorageConfigurations to configure root bucket new workspaces within AWS.
- databricks.MwsWorkspaces to set up workspaces in E2 architecture on AWS.
Example Usage
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
using Databricks = Pulumi.Databricks;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var databricksAccountId = config.RequireObject<dynamic>("databricksAccountId");
var thisAwsAssumeRolePolicy = Databricks.GetAwsAssumeRolePolicy.Invoke(new()
{
ExternalId = databricksAccountId,
});
var crossAccountRole = new Aws.Iam.Role("crossAccountRole", new()
{
AssumeRolePolicy = thisAwsAssumeRolePolicy.Apply(getAwsAssumeRolePolicyResult => getAwsAssumeRolePolicyResult.Json),
Tags = @var.Tags,
});
var thisAwsCrossAccountPolicy = Databricks.GetAwsCrossAccountPolicy.Invoke();
var thisRolePolicy = new Aws.Iam.RolePolicy("thisRolePolicy", new()
{
Role = crossAccountRole.Id,
Policy = thisAwsCrossAccountPolicy.Apply(getAwsCrossAccountPolicyResult => getAwsCrossAccountPolicyResult.Json),
});
var thisMwsCredentials = new Databricks.MwsCredentials("thisMwsCredentials", new()
{
AccountId = databricksAccountId,
CredentialsName = $"{local.Prefix}-creds",
RoleArn = crossAccountRole.Arn,
}, new CustomResourceOptions
{
Provider = databricks.Mws,
});
});
package main
import (
"fmt"
"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/iam"
"github.com/pulumi/pulumi-databricks/sdk/go/databricks"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
cfg := config.New(ctx, "")
databricksAccountId := cfg.RequireObject("databricksAccountId")
thisAwsAssumeRolePolicy, err := databricks.GetAwsAssumeRolePolicy(ctx, &databricks.GetAwsAssumeRolePolicyArgs{
ExternalId: databricksAccountId,
}, nil)
if err != nil {
return err
}
crossAccountRole, err := iam.NewRole(ctx, "crossAccountRole", &iam.RoleArgs{
AssumeRolePolicy: *pulumi.String(thisAwsAssumeRolePolicy.Json),
Tags: pulumi.Any(_var.Tags),
})
if err != nil {
return err
}
thisAwsCrossAccountPolicy, err := databricks.GetAwsCrossAccountPolicy(ctx, nil, nil)
if err != nil {
return err
}
_, err = iam.NewRolePolicy(ctx, "thisRolePolicy", &iam.RolePolicyArgs{
Role: crossAccountRole.ID(),
Policy: *pulumi.String(thisAwsCrossAccountPolicy.Json),
})
if err != nil {
return err
}
_, err = databricks.NewMwsCredentials(ctx, "thisMwsCredentials", &databricks.MwsCredentialsArgs{
AccountId: pulumi.Any(databricksAccountId),
CredentialsName: pulumi.String(fmt.Sprintf("%v-creds", local.Prefix)),
RoleArn: crossAccountRole.Arn,
}, pulumi.Provider(databricks.Mws))
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.databricks.DatabricksFunctions;
import com.pulumi.databricks.inputs.GetAwsAssumeRolePolicyArgs;
import com.pulumi.aws.iam.Role;
import com.pulumi.aws.iam.RoleArgs;
import com.pulumi.databricks.inputs.GetAwsCrossAccountPolicyArgs;
import com.pulumi.aws.iam.RolePolicy;
import com.pulumi.aws.iam.RolePolicyArgs;
import com.pulumi.databricks.MwsCredentials;
import com.pulumi.databricks.MwsCredentialsArgs;
import com.pulumi.resources.CustomResourceOptions;
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) {
final var config = ctx.config();
final var databricksAccountId = config.get("databricksAccountId");
final var thisAwsAssumeRolePolicy = DatabricksFunctions.getAwsAssumeRolePolicy(GetAwsAssumeRolePolicyArgs.builder()
.externalId(databricksAccountId)
.build());
var crossAccountRole = new Role("crossAccountRole", RoleArgs.builder()
.assumeRolePolicy(thisAwsAssumeRolePolicy.applyValue(getAwsAssumeRolePolicyResult -> getAwsAssumeRolePolicyResult.json()))
.tags(var_.tags())
.build());
final var thisAwsCrossAccountPolicy = DatabricksFunctions.getAwsCrossAccountPolicy();
var thisRolePolicy = new RolePolicy("thisRolePolicy", RolePolicyArgs.builder()
.role(crossAccountRole.id())
.policy(thisAwsCrossAccountPolicy.applyValue(getAwsCrossAccountPolicyResult -> getAwsCrossAccountPolicyResult.json()))
.build());
var thisMwsCredentials = new MwsCredentials("thisMwsCredentials", MwsCredentialsArgs.builder()
.accountId(databricksAccountId)
.credentialsName(String.format("%s-creds", local.prefix()))
.roleArn(crossAccountRole.arn())
.build(), CustomResourceOptions.builder()
.provider(databricks.mws())
.build());
}
}
import pulumi
import pulumi_aws as aws
import pulumi_databricks as databricks
config = pulumi.Config()
databricks_account_id = config.require_object("databricksAccountId")
this_aws_assume_role_policy = databricks.get_aws_assume_role_policy(external_id=databricks_account_id)
cross_account_role = aws.iam.Role("crossAccountRole",
assume_role_policy=this_aws_assume_role_policy.json,
tags=var["tags"])
this_aws_cross_account_policy = databricks.get_aws_cross_account_policy()
this_role_policy = aws.iam.RolePolicy("thisRolePolicy",
role=cross_account_role.id,
policy=this_aws_cross_account_policy.json)
this_mws_credentials = databricks.MwsCredentials("thisMwsCredentials",
account_id=databricks_account_id,
credentials_name=f"{local['prefix']}-creds",
role_arn=cross_account_role.arn,
opts=pulumi.ResourceOptions(provider=databricks["mws"]))
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
import * as databricks from "@pulumi/databricks";
const config = new pulumi.Config();
const databricksAccountId = config.requireObject("databricksAccountId");
const thisAwsAssumeRolePolicy = databricks.getAwsAssumeRolePolicy({
externalId: databricksAccountId,
});
const crossAccountRole = new aws.iam.Role("crossAccountRole", {
assumeRolePolicy: thisAwsAssumeRolePolicy.then(thisAwsAssumeRolePolicy => thisAwsAssumeRolePolicy.json),
tags: _var.tags,
});
const thisAwsCrossAccountPolicy = databricks.getAwsCrossAccountPolicy({});
const thisRolePolicy = new aws.iam.RolePolicy("thisRolePolicy", {
role: crossAccountRole.id,
policy: thisAwsCrossAccountPolicy.then(thisAwsCrossAccountPolicy => thisAwsCrossAccountPolicy.json),
});
const thisMwsCredentials = new databricks.MwsCredentials("thisMwsCredentials", {
accountId: databricksAccountId,
credentialsName: `${local.prefix}-creds`,
roleArn: crossAccountRole.arn,
}, {
provider: databricks.mws,
});
configuration:
databricksAccountId:
type: dynamic
resources:
crossAccountRole:
type: aws:iam:Role
properties:
assumeRolePolicy: ${thisAwsAssumeRolePolicy.json}
tags: ${var.tags}
thisRolePolicy:
type: aws:iam:RolePolicy
properties:
role: ${crossAccountRole.id}
policy: ${thisAwsCrossAccountPolicy.json}
thisMwsCredentials:
type: databricks:MwsCredentials
properties:
accountId: ${databricksAccountId}
credentialsName: ${local.prefix}-creds
roleArn: ${crossAccountRole.arn}
options:
provider: ${databricks.mws}
variables:
thisAwsAssumeRolePolicy:
fn::invoke:
Function: databricks:getAwsAssumeRolePolicy
Arguments:
externalId: ${databricksAccountId}
thisAwsCrossAccountPolicy:
fn::invoke:
Function: databricks:getAwsCrossAccountPolicy
Arguments: {}
Create MwsCredentials Resource
new MwsCredentials(name: string, args: MwsCredentialsArgs, opts?: CustomResourceOptions);
@overload
def MwsCredentials(resource_name: str,
opts: Optional[ResourceOptions] = None,
account_id: Optional[str] = None,
credentials_name: Optional[str] = None,
role_arn: Optional[str] = None)
@overload
def MwsCredentials(resource_name: str,
args: MwsCredentialsArgs,
opts: Optional[ResourceOptions] = None)
func NewMwsCredentials(ctx *Context, name string, args MwsCredentialsArgs, opts ...ResourceOption) (*MwsCredentials, error)
public MwsCredentials(string name, MwsCredentialsArgs args, CustomResourceOptions? opts = null)
public MwsCredentials(String name, MwsCredentialsArgs args)
public MwsCredentials(String name, MwsCredentialsArgs args, CustomResourceOptions options)
type: databricks:MwsCredentials
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args MwsCredentialsArgs
- 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 MwsCredentialsArgs
- 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 MwsCredentialsArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args MwsCredentialsArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args MwsCredentialsArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
MwsCredentials 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 MwsCredentials resource accepts the following input properties:
- Account
Id string Account Id that could be found in the bottom left corner of Accounts Console
- Credentials
Name string name of credentials to register
- Role
Arn string ARN of cross-account role
- Account
Id string Account Id that could be found in the bottom left corner of Accounts Console
- Credentials
Name string name of credentials to register
- Role
Arn string ARN of cross-account role
- account
Id String Account Id that could be found in the bottom left corner of Accounts Console
- credentials
Name String name of credentials to register
- role
Arn String ARN of cross-account role
- account
Id string Account Id that could be found in the bottom left corner of Accounts Console
- credentials
Name string name of credentials to register
- role
Arn string ARN of cross-account role
- account_
id str Account Id that could be found in the bottom left corner of Accounts Console
- credentials_
name str name of credentials to register
- role_
arn str ARN of cross-account role
- account
Id String Account Id that could be found in the bottom left corner of Accounts Console
- credentials
Name String name of credentials to register
- role
Arn String ARN of cross-account role
Outputs
All input properties are implicitly available as output properties. Additionally, the MwsCredentials resource produces the following output properties:
- Creation
Time int (Integer) time of credentials registration
- Credentials
Id string (String) identifier of credentials
- External
Id string - Id string
The provider-assigned unique ID for this managed resource.
- Creation
Time int (Integer) time of credentials registration
- Credentials
Id string (String) identifier of credentials
- External
Id string - Id string
The provider-assigned unique ID for this managed resource.
- creation
Time Integer (Integer) time of credentials registration
- credentials
Id String (String) identifier of credentials
- external
Id String - id String
The provider-assigned unique ID for this managed resource.
- creation
Time number (Integer) time of credentials registration
- credentials
Id string (String) identifier of credentials
- external
Id string - id string
The provider-assigned unique ID for this managed resource.
- creation_
time int (Integer) time of credentials registration
- credentials_
id str (String) identifier of credentials
- external_
id str - id str
The provider-assigned unique ID for this managed resource.
- creation
Time Number (Integer) time of credentials registration
- credentials
Id String (String) identifier of credentials
- external
Id String - id String
The provider-assigned unique ID for this managed resource.
Look up Existing MwsCredentials Resource
Get an existing MwsCredentials 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?: MwsCredentialsState, opts?: CustomResourceOptions): MwsCredentials
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
account_id: Optional[str] = None,
creation_time: Optional[int] = None,
credentials_id: Optional[str] = None,
credentials_name: Optional[str] = None,
external_id: Optional[str] = None,
role_arn: Optional[str] = None) -> MwsCredentials
func GetMwsCredentials(ctx *Context, name string, id IDInput, state *MwsCredentialsState, opts ...ResourceOption) (*MwsCredentials, error)
public static MwsCredentials Get(string name, Input<string> id, MwsCredentialsState? state, CustomResourceOptions? opts = null)
public static MwsCredentials get(String name, Output<String> id, MwsCredentialsState 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.
- Account
Id string Account Id that could be found in the bottom left corner of Accounts Console
- Creation
Time int (Integer) time of credentials registration
- Credentials
Id string (String) identifier of credentials
- Credentials
Name string name of credentials to register
- External
Id string - Role
Arn string ARN of cross-account role
- Account
Id string Account Id that could be found in the bottom left corner of Accounts Console
- Creation
Time int (Integer) time of credentials registration
- Credentials
Id string (String) identifier of credentials
- Credentials
Name string name of credentials to register
- External
Id string - Role
Arn string ARN of cross-account role
- account
Id String Account Id that could be found in the bottom left corner of Accounts Console
- creation
Time Integer (Integer) time of credentials registration
- credentials
Id String (String) identifier of credentials
- credentials
Name String name of credentials to register
- external
Id String - role
Arn String ARN of cross-account role
- account
Id string Account Id that could be found in the bottom left corner of Accounts Console
- creation
Time number (Integer) time of credentials registration
- credentials
Id string (String) identifier of credentials
- credentials
Name string name of credentials to register
- external
Id string - role
Arn string ARN of cross-account role
- account_
id str Account Id that could be found in the bottom left corner of Accounts Console
- creation_
time int (Integer) time of credentials registration
- credentials_
id str (String) identifier of credentials
- credentials_
name str name of credentials to register
- external_
id str - role_
arn str ARN of cross-account role
- account
Id String Account Id that could be found in the bottom left corner of Accounts Console
- creation
Time Number (Integer) time of credentials registration
- credentials
Id String (String) identifier of credentials
- credentials
Name String name of credentials to register
- external
Id String - role
Arn String ARN of cross-account role
Import
-> Note Importing this resource is not currently supported.
Package Details
- Repository
- databricks pulumi/pulumi-databricks
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
databricks
Terraform Provider.