-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from leoc-22/bind-existing-aws-policy-to-role
feat: bind existing aws policy to role
- Loading branch information
Showing
9 changed files
with
216 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# deployer_roles | ||
|
||
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> | ||
## Requirements | ||
|
||
No requirements. | ||
|
||
## Providers | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="provider_aws"></a> [aws](#provider\_aws) | n/a | | ||
|
||
## Modules | ||
|
||
| Name | Source | Version | | ||
|------|--------|---------| | ||
| <a name="module_devops_infra_deploy"></a> [devops\_infra\_deploy](#module\_devops\_infra\_deploy) | ../.. | n/a | | ||
|
||
## Resources | ||
|
||
| Name | Type | | ||
|------|------| | ||
| [aws_iam_policy_document.ecs_infra_role_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | | ||
|
||
## Inputs | ||
|
||
No inputs. | ||
|
||
## Outputs | ||
|
||
No outputs. | ||
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
data "aws_iam_policy_document" "ecs_infra_role_policy" { | ||
statement { | ||
resources = ["arn:aws:s3:::ecs-infrastructre"] | ||
actions = [ | ||
"s3:ListBucket", | ||
] | ||
} | ||
|
||
statement { | ||
resources = ["arn:aws:s3:::ecs-infrastructre/*"] | ||
actions = [ | ||
"s3:Get*", | ||
"s3:Put*", | ||
"s3:Delete*", | ||
] | ||
} | ||
|
||
statement { | ||
resources = ["arn:aws:iam::000000000000:role/service_roles/*"] | ||
actions = ["iam:PassRole"] | ||
} | ||
|
||
// enable VPCs, subnets, route tables and internet gateways creation | ||
statement { | ||
resources = ["*"] | ||
actions = [ | ||
"ec2:Describe*", | ||
"ec2:Create*", | ||
"ec2:Delete*", | ||
"ec2:AttachInternetGateway", | ||
"ec2:AssociateRouteTable", | ||
"ec2:ModifyVpcAttribute", | ||
"ec2:DisableVpcClassicLink", | ||
"ec2:DisableVpcClassicLinkDnsSupport", | ||
"ec2:EnableVpcClassicLink", | ||
"ec2:EnableVpcClassicLinkDnsSupport", | ||
] | ||
} | ||
} | ||
|
||
module "devops_infra_deploy" { | ||
source = "../.." | ||
|
||
name_prefix = "ecsInfraDeploy" | ||
role_path = "/ecs/" | ||
role_description = "Role for deploying ECS infrastructure" | ||
iam_policy_document = data.aws_iam_policy_document.ecs_infra_role_policy.json | ||
arns_assume_role = ["arn:aws:iam::000000000000:root"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# human_roles | ||
|
||
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> | ||
## Requirements | ||
|
||
No requirements. | ||
|
||
## Providers | ||
|
||
No providers. | ||
|
||
## Modules | ||
|
||
| Name | Source | Version | | ||
|------|--------|---------| | ||
| <a name="module_amplify_and_cognito_admin"></a> [amplify\_and\_cognito\_admin](#module\_amplify\_and\_cognito\_admin) | ../.. | n/a | | ||
|
||
## Resources | ||
|
||
No resources. | ||
|
||
## Inputs | ||
|
||
No inputs. | ||
|
||
## Outputs | ||
|
||
No outputs. | ||
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module "amplify_and_cognito_admin" { | ||
source = "../.." | ||
|
||
name_prefix = "amplifyAdmin" | ||
role_path = "/human/" | ||
role_description = "Role for granting admin access on Amplify" | ||
existing_iam_policy_arns = ["arn:aws:iam::aws:policy/AdministratorAccess-Amplify"] | ||
arns_assume_role = ["arn:aws:iam::000000000000:root"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# service_roles | ||
|
||
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> | ||
## Requirements | ||
|
||
No requirements. | ||
|
||
## Providers | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="provider_aws"></a> [aws](#provider\_aws) | n/a | | ||
|
||
## Modules | ||
|
||
| Name | Source | Version | | ||
|------|--------|---------| | ||
| <a name="module_lambda_auto_link_data_iam_role"></a> [lambda\_auto\_link\_data\_iam\_role](#module\_lambda\_auto\_link\_data\_iam\_role) | ../.. | n/a | | ||
|
||
## Resources | ||
|
||
| Name | Type | | ||
|------|------| | ||
| [aws_iam_policy_document.lambda_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | | ||
|
||
## Inputs | ||
|
||
No inputs. | ||
|
||
## Outputs | ||
|
||
No outputs. | ||
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
data "aws_iam_policy_document" "lambda_policy" { | ||
statement { | ||
actions = [ | ||
"logs:CreateLogStream", | ||
"logs:PutLogEvents", | ||
] | ||
|
||
resources = ["*"] | ||
} | ||
} | ||
|
||
module "lambda_auto_link_data_iam_role" { | ||
source = "../.." | ||
|
||
name_prefix = "myLambda" | ||
role_path = "/service_roles/" | ||
role_description = "Allows resources to log to log groups" | ||
iam_policy_document = data.aws_iam_policy_document.lambda_policy.json | ||
services_assume_role = ["lambda.amazonaws.com"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,41 @@ | ||
variable "name_prefix" { | ||
default = "" | ||
description = "Name prefix for IAM role name" | ||
type = string | ||
description = "Name prefix for IAM role name" | ||
default = "" | ||
} | ||
|
||
variable "role_path" { | ||
default = "" | ||
description = "An optional IAM role path" | ||
type = string | ||
description = "An optional IAM role path" | ||
default = "" | ||
} | ||
|
||
variable "role_description" { | ||
default = "" | ||
description = "An optional IAM role description" | ||
type = string | ||
description = "An optional IAM role description" | ||
default = "" | ||
} | ||
|
||
variable "iam_policy_document" { | ||
default = "" | ||
description = "Custom IAM policy document" | ||
type = string | ||
description = "Custom IAM policy document" | ||
default = "" | ||
} | ||
|
||
variable "arns_assume_role" { | ||
variable "existing_iam_policy_arns" { | ||
type = list(string) | ||
description = "List of ARNs of existing IAM policies" | ||
default = [] | ||
} | ||
|
||
variable "arns_assume_role" { | ||
type = list(string) | ||
description = "List of ARNs of IAM entities that can assume the role" | ||
default = [] | ||
} | ||
|
||
variable "services_assume_role" { | ||
default = [] | ||
type = list(string) | ||
description = "List of services that can assume the role" | ||
default = [] | ||
} |