Skip to content
This repository was archived by the owner on Jul 20, 2024. It is now read-only.

Commit 13bc40f

Browse files
authored
Update README.md
1 parent 7caf229 commit 13bc40f

File tree

1 file changed

+54
-25
lines changed

1 file changed

+54
-25
lines changed

README.md

Lines changed: 54 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -40,31 +40,6 @@ module "nat" {
4040
```
4141

4242

43-
### Extra configuration
44-
45-
You can open SSH port to the NAT instance.
46-
47-
```tf
48-
resource "aws_security_group_rule" "nat_ssh" {
49-
security_group_id = module.nat.sg_id
50-
type = "ingress"
51-
cidr_blocks = ["0.0.0.0/0"]
52-
from_port = 22
53-
to_port = 22
54-
protocol = "tcp"
55-
}
56-
```
57-
58-
You can attach an extra policy to the IAM role of the NAT instance.
59-
60-
```tf
61-
resource "aws_iam_role_policy_attachment" "nat_iam_example" {
62-
policy_arn = "arn:aws:iam::aws:policy/SOME_POLICY_NAME"
63-
role = module.nat.iam_role_name
64-
}
65-
```
66-
67-
6843
## How it works
6944

7045
This module will create the following resources:
@@ -92,6 +67,60 @@ The NAT instance will do the following tasks on startup:
9267
See [init.sh](data/init.sh) for details.
9368

9469

70+
## Configuration
71+
72+
### Extra IAM policy
73+
74+
You can attach an extra policy to the IAM role of the NAT instance. For example,
75+
76+
```tf
77+
resource "aws_iam_role_policy" "nat_iam_ec2" {
78+
role = module.nat.iam_role_name
79+
policy = <<EOF
80+
{
81+
"Version": "2012-10-17",
82+
"Statement": [
83+
{
84+
"Effect": "Allow",
85+
"Action": [
86+
"ec2:DescribeInstances"
87+
],
88+
"Resource": "*"
89+
}
90+
]
91+
}
92+
EOF
93+
}
94+
```
95+
96+
### Extra script
97+
98+
You can set an extra script to run in the NAT instance. For example,
99+
100+
```tf
101+
module "nat" {
102+
extra_user_data = <<EOF
103+
# ...
104+
EOF
105+
}
106+
```
107+
108+
### Open SSH port
109+
110+
You can open the SSH port to the NAT instance.
111+
112+
```tf
113+
resource "aws_security_group_rule" "nat_ssh" {
114+
security_group_id = module.nat.sg_id
115+
type = "ingress"
116+
cidr_blocks = ["0.0.0.0/0"]
117+
from_port = 22
118+
to_port = 22
119+
protocol = "tcp"
120+
}
121+
```
122+
123+
95124
## Contributions
96125

97126
This is an open source software. Feel free to open issues and pull requests.

0 commit comments

Comments
 (0)