Skip to content

Commit 1fc4a19

Browse files
oliviabholmesczimergebot
authored andcommitted
New route53 poweruser (#94)
New route53 poweruserAdding in a new iam role for route53 poweruser who has all the route53 permissions cc: @austinylin
1 parent 8fc7bf0 commit 1fc4a19

File tree

5 files changed

+97
-0
lines changed

5 files changed

+97
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# AWS IAM role for Route53Domains Poweruser
2+
3+
This module will create a role which has Route53Domains FullAccess privileges.
4+
5+
## Example
6+
7+
```hcl
8+
module "route53domains-poweruser" {
9+
source = "github.com/chanzuckerberg/cztack//aws-iam-role-route53domains-poweruser?ref=v0.14.0"
10+
11+
# The name of the role to create in this account.
12+
role_name = "..."
13+
14+
# The ID of the other AWS account which can assume this role.
15+
source_account_id = "..."
16+
}
17+
18+
```
19+
20+
<!-- START -->
21+
## Inputs
22+
23+
| Name | Description | Type | Default | Required |
24+
|------|-------------|:----:|:-----:|:-----:|
25+
| iam\_path | | string | `"/"` | no |
26+
| role\_name | | string | n/a | yes |
27+
| source\_account\_id | | string | n/a | yes |
28+
29+
## Outputs
30+
31+
| Name | Description |
32+
|------|-------------|
33+
| arn | |
34+
35+
<!-- END -->
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
data "aws_iam_policy_document" "assume-role" {
2+
statement {
3+
principals {
4+
type = "AWS"
5+
identifiers = ["arn:aws:iam::${var.source_account_id}:root"]
6+
}
7+
8+
actions = ["sts:AssumeRole"]
9+
}
10+
}
11+
12+
resource "aws_iam_role" "route53domains-poweruser" {
13+
name = "${var.role_name}"
14+
path = "${var.iam_path}"
15+
assume_role_policy = "${data.aws_iam_policy_document.assume-role.json}"
16+
}
17+
18+
resource "aws_iam_role_policy_attachment" "route53domains-fullaccess" {
19+
role = "${aws_iam_role.route53domains-poweruser.name}"
20+
policy_arn = "arn:aws:iam::aws:policy/AmazonRoute53DomainsFullAccess"
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package test
2+
3+
import (
4+
"testing"
5+
6+
"github.com/chanzuckerberg/cztack/testutil"
7+
"github.com/gruntwork-io/terratest/modules/random"
8+
)
9+
10+
func TestAWSIAMRoleRoute53DomainsPoweruser(t *testing.T) {
11+
12+
curAcct := testutil.AWSCurrentAccountId(t)
13+
14+
terraformOptions := testutil.Options(
15+
testutil.IAMRegion,
16+
17+
map[string]interface{}{
18+
"role_name": random.UniqueId(),
19+
"source_account_id": curAcct,
20+
},
21+
)
22+
23+
defer testutil.Cleanup(t, terraformOptions)
24+
25+
testutil.Run(t, terraformOptions)
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
output "arn" {
2+
value = "${aws_iam_role.route53domains-poweruser.arn}"
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
variable "source_account_id" {
2+
type = "string"
3+
}
4+
5+
variable "role_name" {
6+
type = "string"
7+
}
8+
9+
variable "iam_path" {
10+
type = "string"
11+
default = "/"
12+
}

0 commit comments

Comments
 (0)