Update solution.md (#398)
* Update solution.md I have added a solution to the exercise using Terraform * Update solution.md fixed some indentations * Update solution.md * Update solution.md Added a solution using Terraform
This commit is contained in:
parent
88f72441b4
commit
b2b0a600aa
@ -23,3 +23,37 @@ As you probably know at this point, it's not recommended to work with the root a
|
|||||||
10. Click on "Next: Tags"
|
10. Click on "Next: Tags"
|
||||||
11. Add a tag with the key `Role` and the value `DevOps`
|
11. Add a tag with the key `Role` and the value `DevOps`
|
||||||
12. Click on "Review" and then create on "Create user"
|
12. Click on "Review" and then create on "Create user"
|
||||||
|
|
||||||
|
13. ### Solution using Terraform
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
resource "aws_iam_group_membership" "team" {
|
||||||
|
name = "tf-testing-group-membership"
|
||||||
|
|
||||||
|
users = [
|
||||||
|
aws_iam_user.newuser.name,
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
|
group = aws_iam_group.admin.name
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "aws_iam_group_policy_attachment" "test-attach" {
|
||||||
|
group = aws_iam_group.admin.name
|
||||||
|
policy_arn = "arn:aws:iam::aws:policy/AdministratorAccess"
|
||||||
|
}
|
||||||
|
resource "aws_iam_group" "admin" {
|
||||||
|
name = "admin"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "aws_iam_user" "newuser" {
|
||||||
|
name = "newuser"
|
||||||
|
path = "/system/"
|
||||||
|
|
||||||
|
tags = {
|
||||||
|
Role = "DevOps"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
@ -30,3 +30,17 @@ MFA:
|
|||||||
3. Expand "Multi-factor authentication (MFA)" and click on "Activate MFA"
|
3. Expand "Multi-factor authentication (MFA)" and click on "Activate MFA"
|
||||||
4. Choose one of the devices
|
4. Choose one of the devices
|
||||||
5. Follow the instructions to set it up and click on "Assign MFA"
|
5. Follow the instructions to set it up and click on "Assign MFA"
|
||||||
|
|
||||||
|
6. ### Solution using Terraform:
|
||||||
|
|
||||||
|
```
|
||||||
|
resource "aws_iam_account_password_policy" "strict" {
|
||||||
|
minimum_password_length = 8
|
||||||
|
require_numbers = true
|
||||||
|
allow_users_to_change_password = true
|
||||||
|
password_reuse_prevention = 1
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Note:** You cannot add MFA through terraform, you have to do it in the GUI.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user