[Section 5.25 - Modules] Problema Criação Bucket Website #48
              
                Unanswered
              
          
                  
                    
                      jacksonpedrini
                    
                  
                
                  asked this question in
                Q&A
              
            Replies: 4 comments 2 replies
-
| 
         @chgasparoto , consegue me dar um help nisso?  | 
  
Beta Was this translation helpful? Give feedback.
                  
                    1 reply
                  
                
            -
| 
         Esse é meu código do s3.tf: data "template_file" "s3-public-policy" {
  template = file("policy.json")
  vars     = { bucket_name = local.domain }
}
module "logs" {
  source        = "github.com/chgasparoto/terraform-s3-object-notification"
  name          = "${local.domain}-logs"
  acl           = "log-delivery-write"
  force_destroy = !local.has_domain
}
module "website" {
  source        = "github.com/chgasparoto/terraform-s3-object-notification"
  name          = local.domain
  acl           = "public-read"
  policy        = data.template_file.s3-public-policy.rendered
  force_destroy = !local.has_domain
  versioning = {
    enabled = true
  }
  filepath = "${path.module}/../website/build"
  website = {
    index_document = "index.html"
    error_document = "index.html"
  }
  logging = {
    target_bucket = module.logs.name
    target_prefix = "access/"
  }
}
module "redirect" {
  source        = "github.com/chgasparoto/terraform-s3-object-notification"
  name          = "www.${local.domain}"
  acl           = "public-read"
  force_destroy = !local.has_domain
  website = {
    redirect_all_requests_to = local.has_domain ? var.domain : module.website.website
  }
} | 
  
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            -
| 
         E este é meu policy.json:   {
    "Version": "2008-10-17",
    "Statement": [
      {
        "Sid": "PublicReadForGetBucketObjects",
        "Effect": "Allow",
        "Principal": {
          "AWS": "*"
        },
        "Action": "s3:GetObject",
        "Resource": "arn:aws:s3:::${bucket_name}/*"
      }
    ]
  } | 
  
Beta Was this translation helpful? Give feedback.
                  
                    1 reply
                  
                
            -
| 
         Era isso mesmo, não acredito que não me atentei a isso. Muito obrigado @chgasparoto.  | 
  
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
Boa tarde Pessoal,
Ao criar o bucket do website, está me apresentando o erro abaixo:
Revisei os meus códigos porém não estou conseguindo achar o erro, pois o exemplo está igual ao do curso.
Beta Was this translation helpful? Give feedback.
All reactions