Skip to content

Commit 7760339

Browse files
[Improvement] operations/terraform-state - Improving bucket policy and docs (widdix#445)
1 parent 5a62001 commit 7760339

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

docs/operations.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,5 +100,7 @@ Creates S3 bucket and DynamoDB table used to manage remote Terraform state.
100100
1. Click **Create** to start the creation of the stack.
101101
1. Wait until the stack reaches the state **CREATE_COMPLETE**
102102

103+
> Be aware that the template creates a bucket policy using a `Deny` statement with a `NotPrincipal` element when defining the `TerraformStateUserARNs` and `TerraformStateAdminARNs` parameters. Therefore, both parameters should include the following inforamtion: account ARN (e.g., `arn:aws:iam::111111111111:root`), IAM user (e.g., `arn:aws:iam::111111111111:user/tfuser`), IAM role (e.g., `arn:aws:iam::111111111111:role/tfadmin`) and assumed-role user (e.g., `arn:aws:sts::111111111111:assumed-role/tfadmin/session`). Check out [NotPrincipal with Deny](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_notprincipal.html#specifying-notprincipal-allow) to learn more.
104+
103105
### Dependencies
104106
* `security/kms-key.yaml` (**required**)

operations/terraform-state.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ Resources:
7575
Resource:
7676
- !Sub '${StateBucket.Arn}'
7777
- !Sub '${StateBucket.Arn}/*'
78-
Principal:
79-
AWS: !Split [',', !Ref TerraformStateUserARNs]
78+
NotPrincipal:
79+
AWS: !Split [',', !Ref TerraformStateAdminARNs]
8080
- Effect: 'Deny'
8181
Action: 's3:*'
8282
Resource:

0 commit comments

Comments
 (0)