Skip to content

Commit 20a37dd

Browse files
mnitchevfiunchinho
andauthored
Add instructions for setting up AWS test account (#227)
* Add instructions for setting up AWS test account * Update README.md Co-authored-by: Jose Armesto <[email protected]> * Update README.md * Update README.md * Update README.md --------- Co-authored-by: Jose Armesto <[email protected]>
1 parent ffd0f62 commit 20a37dd

File tree

3 files changed

+70
-0
lines changed

3 files changed

+70
-0
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,18 @@ This project uses [`LocalStack`](https://github.com/localstack/localstack) for i
5555
```
5656
$ aws --endpoint=http://localhost:4566 route53 list-hosted-zones-by-name
5757
```
58+
59+
## AWS account setup
60+
61+
To run the integration and acceptance tests against an AWS account you need to create an IAM role. To do that, first source the `aws-resolver-rules-operator-test-secrets.sh` file from LastPass and then run the following commands. Note that you also need to target the account you are setting up when using the aws cli and update the desired WC or MC account env var in the LastPass secret afterwards.
62+
63+
```shell
64+
source aws-resolver-rules-operator-test-secrets.sh
65+
aws iam create-policy --policy-name tests-aws-resolver-rules-operator --policy-document file://tests/assets/test-role-policy.json
66+
67+
policy_file=$(mktemp)
68+
envsubst <tests/assets/test-role-trust-policy.json >$policy_file
69+
aws iam create-role --role-name tests-aws-resolver-rules-operator --assume-role-policy-document file://$policy_file
70+
aws iam attach-role-policy --role-name ttests-aws-resolver-rules-operator --policy-arn arn:aws:iam::$AWS_ACCOUNT:policy/tests-aws-resolver-rules-operator
71+
rm $policy_file
72+
```

tests/assets/test-role-policy.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"Version": "2012-10-17",
3+
"Statement": [
4+
{
5+
"Sid": "VisualEditor0",
6+
"Effect": "Allow",
7+
"Action": [
8+
"ec2:DeleteManagedPrefixList",
9+
"ec2:DeleteSubnet",
10+
"ec2:ModifyManagedPrefixList",
11+
"ec2:DeleteTags",
12+
"ec2:CreateVpc",
13+
"ec2:DescribeTransitGateways",
14+
"ec2:CreateTransitGateway",
15+
"ec2:DeleteRouteTable",
16+
"ec2:AssociateRouteTable",
17+
"ec2:DeleteTransitGatewayVpcAttachment",
18+
"ec2:CreateRoute",
19+
"ec2:DescribeManagedPrefixLists",
20+
"ec2:DescribeRouteTables",
21+
"ec2:GetManagedPrefixListEntries",
22+
"ec2:CreateTags",
23+
"ec2:DeleteRoute",
24+
"ec2:CreateRouteTable",
25+
"ec2:DisassociateRouteTable",
26+
"ec2:CreateManagedPrefixList",
27+
"ec2:CreateTransitGatewayVpcAttachment",
28+
"ec2:DeleteVpc",
29+
"ec2:DescribeTransitGatewayVpcAttachments",
30+
"ec2:CreateSubnet",
31+
"ec2:DeleteTransitGateway",
32+
"ec2:DescribeSubnets",
33+
"ram:GetResourceShares",
34+
"ram:CreateResourceShare",
35+
"ram:DeleteResourceShare",
36+
"ram:GetResourceShareAssociations",
37+
"ram:ListResources"
38+
],
39+
"Resource": "*"
40+
}
41+
]
42+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"Version": "2012-10-17",
3+
"Statement": [
4+
{
5+
"Effect": "Allow",
6+
"Principal": {
7+
"AWS": "arn:aws:iam::$ROOT_ACCOUNT:user/tests-aws-network-topology-operator"
8+
},
9+
"Action": "sts:AssumeRole",
10+
"Condition": {}
11+
}
12+
]
13+
}

0 commit comments

Comments
 (0)