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

PAPI: Directory symlink causes error in data.akamai_property_rules_template #598

Open
maquis196 opened this issue Dec 17, 2024 · 2 comments

Comments

@maquis196
Copy link

maquis196 commented Dec 17, 2024

Terraform and Akamai Terraform Provider Versions

Terraform v1.9.8-dev
on linux_amd64

  • provider registry.terraform.io/akamai/akamai v6.6.0

Affected Resource(s)

  • data.akamai_property_rules_template

Debug Output

https://gist.github.com/maquis196/65272bb8bc2298faedb70f31c5ac314f

Expected Behavior

a directory symlink causes an error but a real one works. This was encountered because we have a directory full of "shared" resources that we would like to symlink into the root of "property-snippets" and include what we need per property, but this fails.

a symlinked file doesn't cause this problem.

Actual Behavior

"Planning failed. Terraform encountered an error while generating this plan.


│ Error: reading file: read /home/maquis196/workspace/terraform-akamai/property_manager/assets.io/property-snippets/child-rules: is a directory
"

Steps to Reproduce

  1. Move property-snippets/child-rules out of module and symlink it back in
  2. terraform apply

Important Factoids

No

References

No

@mstojanowski
Copy link

Hi @maquis196 ,

Thank you for bringing this to our attention. I can confirm that symlinks are not supported. I suggest using a template_dir instead, like on example below:

data "akamai_property_rules_template" "rules" {
  template {
    template_data = <<EOT
"#include:rules.json"
EOT
    template_dir  = "/home/maquis196/workspace/terraform-akamai/property_manager/assets.io/property-snippets/child-rules"
  }

Please let me know if this meets your needs.

BR,
Marcin Stojanowski

@maquis196
Copy link
Author

maquis196 commented Dec 20, 2024

Hi, the example I used was just a quick way to reproduce the error. What I use at the moment is something like;

lrwxrwxrwx 1 maquis196 maquis196  41 Oct 15 15:07 akamai-grn.json -> ../../../_common_includes/akamai-grn.json

and called via;

    "behaviors": [
      "#include:behaviors/origin.json",
      "#include:behaviors/akamai-grn.json",
      "#include:behaviors/strict_header_parsing.json",
      "#include:behaviors/brotli.json"
    ],

Problem with this approach, is that each thing we want, has to be symlinked in (so symlinked files are fine).

I'd rather just have a "common_includes" directory symlinked to the global one, then call each snippet/rule as needed without all the symlinks.

I get this is unsupported, but im only suggesting symlinks to directories don't break the provider? (the fact files work also proves its not some kind of security thing where all the files needed have to be inside the module).

Cheers,
Chris

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants