Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variables in additional_bucket_policy are not substituted anymore #153

Closed
rafaljanicki opened this issue Apr 16, 2021 · 0 comments · Fixed by #160
Closed

Variables in additional_bucket_policy are not substituted anymore #153

rafaljanicki opened this issue Apr 16, 2021 · 0 comments · Fixed by #160
Labels
bug 🐛 An issue with the system

Comments

@rafaljanicki
Copy link
Contributor

rafaljanicki commented Apr 16, 2021

Describe the Bug

The documentation states that the additional_bucket_policy variable supports variables inside such as ${bucket_name}. However, that doesn't seem to be the case anymore and the variable is passed to Terraform without any replace done. That's probably done because of the lack of template_file

Expected Behavior

${bucket_name} should be replaced to match the bucket's name

Steps to Reproduce

data "aws_iam_policy_document" "document" {
  dynamic "statement" {
    for_each = var.accounts

    content {
      sid = "JustASide${each.key}"

      actions = ["s3:GetObject"]
      resources = [
        "arn:aws:s3:::$${bucket_name}",
        "arn:aws:s3:::$${bucket_name}/*"
      ]

      principals {
        type = "AWS"
        identifiers = ["arn:aws:iam::${statement.value}:root"]
      }
    }
  }
}

module "cloudfront-s3-apigateway-cdn" {
  source = "cloudposse/cloudfront-s3-cdn/aws"
  version = "~> 0.59"

  compress = true
  dns_alias_enabled = true
  price_class = "PriceClass_All"

  acm_certificate_arn = var.static_acm_certificate_arn
  aliases = ["static.${var.static_domain_name}"]
  block_origin_public_access_enabled = true
  environment = var.environment
  name = "static"
  origin_force_destroy = true
  origin_ssl_protocols = ["TLSv1.2"]
  parent_zone_id = var.static_domain_name_zone_id
  website_enabled = true

  additional_bucket_policy = data.aws_iam_policy_document.document.json

  tags = local.common_tags
}

Environment:

Anything that will help us triage the bug will help. Here are some ideas:

  • OS: OSX
  • Module version: 0.59

Additional context

The behaviour was removed with this commit: c7e6f3e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 An issue with the system
Projects
None yet
1 participant