Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added AWS IAM data helpers #255

Merged
merged 2 commits into from
Aug 24, 2020
Merged

Added AWS IAM data helpers #255

merged 2 commits into from
Aug 24, 2020

Conversation

nfx
Copy link
Contributor

@nfx nfx commented Aug 18, 2020

End-to-end example of provisioning Cross-account IAM role:

variable "account_id" {
  type        = string
  description = "External ID you find on https://accounts.cloud.databricks.com/#aws"
}

data "databricks_aws_crossaccount_policy" "this" {}
resource "aws_iam_policy" "cross_account_policy" {
  name   = "${var.prefix}-crossaccount-iam-policy"
  policy = data.databricks_aws_crossaccount_policy.this.json
}

data "databricks_aws_assume_role_policy" "this" {
    external_id = var.account_id
}

resource "aws_iam_role" "cross_account" {
  name               = "${var.prefix}-crossaccount-iam-role"
  assume_role_policy = data.databricks_aws_assume_role_policy.this.json
  description        = "Grants Databricks full access to VPC resources"
}

resource "aws_iam_role_policy_attachment" "cross_account" {
  policy_arn = aws_iam_policy.cross_account_policy.arn
  role       = aws_iam_role.cross_account.name
}

// required only in case of multiworkspace setup
resource "databricks_mws_credentials" "this" {
  provider         = databricks.mws
  account_id       = var.account_id
  credentials_name = "${var.prefix}-creds"
  role_arn         = aws_iam_role.cross_account.arn
}

@nfx nfx requested a review from stikkireddy August 18, 2020 21:27
@TravisBuddy
Copy link

Hey @nfx,
Your changes look good to me!

View build log

TravisBuddy Request Identifier: 5c8e3c20-e19a-11ea-81c3-ef1e647c3fbd

@codecov-commenter
Copy link

codecov-commenter commented Aug 18, 2020

Codecov Report

Merging #255 into master will decrease coverage by 1.27%.
The diff coverage is 6.25%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #255      +/-   ##
==========================================
- Coverage   62.37%   61.10%   -1.28%     
==========================================
  Files          53       54       +1     
  Lines        6374     6512     +138     
==========================================
+ Hits         3976     3979       +3     
- Misses       2066     2201     +135     
  Partials      332      332              
Impacted Files Coverage Δ
access/data_aws_policies.go 0.00% <0.00%> (ø)
provider/provider.go 88.92% <100.00%> (+0.09%) ⬆️

Condition map[string]map[string]string `json:"Condition,omitempty"`
}

func DataAwsCrossAccountRolicy() *schema.Resource {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a docs page

}
```

## Attribute Reference
Copy link
Contributor

@stikkireddy stikkireddy Aug 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the other docs in the repo make a clear distinction between attribute and argument.

Argument should be user inputs where attributes are outputs/read only values computed by the resource/datasource.

This should use the naming convention

Argument reference

  • <varname> - (Required/Computed/Optional) (Datatype) (content)

Attribute reference

  • <varname> - (Datatype) (content)

policy = data.databricks_aws_bucket_policy.this.json
}
```
## Argument Reference
Copy link
Contributor

@stikkireddy stikkireddy Aug 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the other docs in the repo make a clear distinction between attribute and argument.

Argument should be user inputs where attributes are outputs/read only values computed by the resource/datasource.

The bucket_name should be an argument where the json is an attribute.

This should use the naming convention

Argument reference

  • <varname> - (Required/Computed/Optional) (Datatype) (content)

Attribute reference

  • <varname> - (Datatype) (content)

Copy link
Contributor

@stikkireddy stikkireddy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please make the following changes

@nfx nfx added this to the v0.2.4 milestone Aug 19, 2020
@TravisBuddy
Copy link

Hey @nfx,
Your changes look good to me!

View build log

TravisBuddy Request Identifier: 0abe0730-e641-11ea-aa37-f5f007553843

@nfx
Copy link
Contributor Author

nfx commented Aug 24, 2020

@stikkireddy will add documentation as requested in pre-release testing branch

@nfx nfx merged commit b95bcac into master Aug 24, 2020
@nfx nfx deleted the aws-data-sources branch August 24, 2020 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants