File tree Expand file tree Collapse file tree 2 files changed +48
-17
lines changed Expand file tree Collapse file tree 2 files changed +48
-17
lines changed Original file line number Diff line number Diff line change 1+ 
2+ data  "aws_iam_policy_document"  "segment_policy_doc"  {
3+   statement  {
4+     sid  =  " cross_account" 
5+ 
6+     actions  =  
7+       " s3:GetBucketLocation" 
8+       " s3:ListBucket" 
9+       " s3:GetObject" 
10+       " s3:PutObject" 
11+       " s3:PutObjectAcl" 
12+       " s3:GetObjectAcl" 
13+       " s3:DeleteObject" 
14+     ]
15+ 
16+     principals  {
17+       type         =  " AWS" 
18+       identifiers  =  " arn:aws:iam::${ var . data_account } :root" 
19+     }
20+ 
21+     resources  =  
22+       " arn:aws:s3:::${ var . s3_bucket } " 
23+       " arn:aws:s3:::${ var . s3_bucket } /*" 
24+     ]
25+ 
26+   }
27+ 
28+   statement  {
29+     sid  =  " AllowSegmentUser" 
30+     effect  =  " Allow" 
31+     principals  {
32+       type  =  " AWS" 
33+       identifiers  =  " arn:aws:iam::107630771604:user/s3-copy" 
34+     }
35+     actions  =   " S3:PutObject" 
36+     resources  =  " arn:aws:s3:::${ var . s3_bucket } /*" 
37+   }
38+ 
39+ }
40+ 
41+ 
142module  "s3_bucket"  {
243  source  =  " https://github.com/terraform-aws-modules/terraform-aws-s3-bucket/archive/v1.9.0.zip//terraform-aws-s3-bucket-1.9.0" 
344
@@ -10,21 +51,6 @@ module "s3_bucket" {
1051
1152  tags  =  . tags 
1253
13-   policy  =  << POLICY 
14-   { 
15-     "Version": "2008-10-17", 
16-     "Id": "Policy1425281770533", 
17-     "Statement": [ 
18-       { 
19-         "Sid": "AllowSegmentUser", 
20-         "Effect": "Allow", 
21-         "Principal": { 
22-           "AWS": "arn:aws:iam::107630771604:user/s3-copy" 
23-         }, 
24-         "Action": "s3:PutObject", 
25-         "Resource": "arn:aws:s3:::${ var . s3_bucket } /*" 
26-       } 
27-     ] 
28-   } 
29- POLICY 
54+   policy  =  . aws_iam_policy_document . segment_policy_doc . json 
55+   
3056}
Original file line number Diff line number Diff line change @@ -9,6 +9,11 @@ variable "tags" {
99  default      =  
1010}
1111
12+ variable  "data_account"  {
13+   description  =  " aws account id for data account" 
14+   type  =  " string" 
15+ } 
16+ 
1217locals  {
1318  tags  =  " ${ merge (map (" vendor" " segment" . tags )} " 
1419}
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments