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

Create DataScience account, set up permission sets and assignments, a… #562

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions config/common.tfvars.example
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ accounts = {
email = "binbash-apps-prd@binbash.com.ar",
id = 666666666666
}
data-science = {
email = "binbash-data-science@binbash.com.ar",
id = 666666666666
}
}


Expand Down
13 changes: 13 additions & 0 deletions management/global/organizations/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ locals {
bbl_apps_prd = {
policy = aws_organizations_policy.standard
}
#
# Data Science: Organizational Unit Policies
#
bbl_data_science = {
policy = aws_organizations_policy.standard
}
}

root_account = {
Expand Down Expand Up @@ -81,5 +87,12 @@ locals {
email = "aws+apps-prd@binbash.com.ar",
parent_ou = "bbl_apps_prd"
}
#
# DataScience: data science workloads, MLOps, and such.
#
data-science = {
email = "aws+data-science@binbash.com.ar",
parent_ou = "bbl_data_science"
}
}
}
11 changes: 11 additions & 0 deletions management/global/sso/account_assignments.tf
Original file line number Diff line number Diff line change
Expand Up @@ -185,5 +185,16 @@ module "account_assignments" {
principal_name = local.groups["marketplaceseller"].name
account = var.accounts.shared.id
},

# -------------------------------------------------------------------------
# DataScientist Permissions
# -------------------------------------------------------------------------
{
permission_set_arn = module.permission_sets.permission_sets["DataScientist"].arn
permission_set_name = "DataScientist"
principal_type = local.principal_type_group
principal_name = local.groups["datascientists"].name
account = var.accounts.data-science.id
},
]
}
21 changes: 21 additions & 0 deletions management/global/sso/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,23 @@ locals {
"marketplaceseller",
]
}
"osvaldo.demo" = {
first_name = "Osvaldo"
last_name = "Demo"
email = "osvaldo.demo@binbash.com.ar"
groups = [
"administrators",
"devops",
]
}
"matias.sorozabal" = {
first_name = "Matias"
last_name = "Sorozabal"
email = "matias.sorozabal@binbash.com.ar"
groups = [
"datascientists",
]
}
}

#----------------------------------------------------------------------------
Expand Down Expand Up @@ -203,6 +220,10 @@ locals {
name = "MarketplaceSeller"
description = "Provides access to the AWS MaketPlace Seller."
}
datascientists = {
name = "DataScientists"
description = "Provides access to the Data Science related services."
}
}

#----------------------------------------------------------------------------
Expand Down
10 changes: 10 additions & 0 deletions management/global/sso/permission_sets.tf
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,15 @@ module "permission_sets" {
]
customer_managed_policy_attachments = []
},
{
name = "DataScientist"
description = "Provides access to AWS services that have to do with Data Science and MLOps."
relay_state = local.default_relay_state
session_duration = "PT2H"
tags = local.tags
inline_policy = data.aws_iam_policy_document.data_scientist.json
policy_attachments = []
customer_managed_policy_attachments = []
},
]
}
69 changes: 68 additions & 1 deletion management/global/sso/policies.tf
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ data "aws_iam_policy_document" "devops" {
"logs:*",
"network-firewall:*",
"networkmanager:*",
"pipes:*",
"q:*",
"ram:*",
"rds:*",
Expand All @@ -66,13 +67,15 @@ data "aws_iam_policy_document" "devops" {
"s3:*",
"ses:*",
"secretsmanager:*",
"securityhub:*",
"servicediscovery:*",
"shield:*",
"sns:*",
"sqs:*",
"ssm:*",
"sts:*",
"support:*",
"servicediscovery:*",
"synthetics:*",
"tag:*",
"transfer:*",
"trustedadvisor:*",
Expand Down Expand Up @@ -155,3 +158,67 @@ data "aws_iam_policy_document" "github_automation" {
resources = ["*"]
}
}

#------------------------------------------------------------------------------
# Data Scientist
#------------------------------------------------------------------------------
data "aws_iam_policy_document" "data_scientist" {
statement {
sid = "Default"
actions = [
"athena:*",
"autoscaling:*",
"aws-portal:*",
"ce:*",
"cloudformation:*",
"cloudwatch:*",
"config:*",
"dynamodb:*",
"ec2:*",
"ecr:*",
"ecr-public:*",
"ecs:*",
"eks:*",
"elasticloadbalancing:*",
"elasticfilesystem:*",
"es:*",
"events:*",
"glue:*",
"health:*",
"iam:*",
"kms:*",
"lambda:*",
"logs:*",
"pipes:*",
"q:*",
"ram:*",
"rds:*",
"redshift:*",
"resource-explorer:*",
"resource-explorer-2:*",
"resource-groups:*",
"route53:*",
"route53domains:*",
"route53resolver:*",
"s3:*",
"secretsmanager:*",
"sns:*",
"sqs:*",
"ssm:*",
"sts:*",
"support:*",
"tag:*",
"vpc:*",
]
resources = ["*"]
condition {
test = "StringEquals"
variable = "aws:RequestedRegion"
values = [
"${var.region}",
"${var.region_secondary}",
"us-east-1", # The original region is needed to have IAM working
]
}
}
}
Loading