Skip to content
This repository has been archived by the owner on Dec 5, 2020. It is now read-only.

ignition_directory and ignition_file support only decimal value for mode #68

Open
PawelZ-iHQ opened this issue Apr 20, 2020 · 8 comments

Comments

@PawelZ-iHQ
Copy link

PawelZ-iHQ commented Apr 20, 2020

Ignition documentation for ignition_file and ignition_directory state that mode argument can be provided either octal or decimal:

mode - (Optional) The directory's permission mode. Note that the mode can be specified as either an octal value (e.g 0755) or a decimal value (i.e. 493 as equivalent to the octal 0755).

While provided values are evaluated as decimals only, even with leading 0. For example 0755 results with --wxrw--wx 0363 octal and 243 decimal.
Quick look at the code suggests that mode is evaluated as TypeInt.

Please either extend code, so both octal and decimal are evaluated correctly or update documentation to state that only decimal values are accepted.

@sean-abbott
Copy link

I am having this problem as well.

@obourdon
Copy link
Contributor

Seems like a regression to me as I remember getting this to work

@obourdon
Copy link
Contributor

@sean-abbott @PawelZ-iHQ what version of terraform are you using ? (0.11, 0.12, 0.13)
I think it is working well with 0.11 but have the same issue you are mentioning with 0.12

@obourdon
Copy link
Contributor

to make sure my code works in all cases, I use expression like:

mode = format("%d", "0644")

@obourdon
Copy link
Contributor

The following code works well with terraform 0.11:

variable "v1" {
  default = 0644
}
output "input-v1" {
  value = "${var.v1}"
}

which gives:

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

Outputs:

input-v1 = 420

but with terraform 0.12:

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

Outputs:

input-v1 = 644

@obourdon
Copy link
Contributor

obourdon commented Sep 23, 2020

In fact it does not work either with format for TF 0.12 anymore: hashicorp/terraform#22143

@sean-abbott
Copy link

I'm using 0.12, and will probably look at migrating to 0.13 the next time I touch terraform.

@egeturgay
Copy link

I had a brief look at this and I don't think It'd be possible to use octal values given the constraints on HCL2 as I explained in community-terraform-providers#4 (comment)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants