At one point I tried the content_base64 option for local_file on one of my config files. Then I reverted this change back to content. After doing this, each local_file resource that I have produces a unsupported attribute "content_base64" error. I have used grep base64 *.tf and cannot find any reference to this setting throughout my terraform configuration. I've provided a sample local_file config below that is failing according to the DEBUG output, also provided below. The only workaround is to delete all local files and also remove them from the terraform state, but the error continues to crop up once terraform has created the files anew. Nothing is wrong with the files otherwise. Very strange and currently I'm considering wiping our state file and simply starting with a new apply since I don't know what else could be causing this.
→ terraform -v
Terraform v0.12.3
+ provider.aws v2.15.0
+ provider.local v1.2.2
+ provider.null v2.1.2
+ provider.random v2.1.2
+ provider.template v2.1.2
resource "local_file" "pgpass" {
content = "${aws_db_instance.db.endpoint}:db-example:${aws_db_instance.db.username}:${var.db-password}"
filename = "../pgpass-${terraform.workspace}"
}
2019/07/09 09:54:51 [DEBUG] ReferenceTransformer: "local_file.pgpass" references: []
2019/07/09 09:54:51 [TRACE] Completed graph transform *terraform.ReferenceTransformer (no changes)
2019/07/09 09:54:51 [TRACE] Executing graph transform *terraform.RootTransformer
2019/07/09 09:54:51 [TRACE] Completed graph transform *terraform.RootTransformer (no changes)
2019/07/09 09:54:51 [ERROR] <root>: eval: *terraform.EvalReadState, err: unsupported attribute "content_base64"
2019/07/09 09:54:51 [ERROR] <root>: eval: *terraform.EvalSequence, err: unsupported attribute "content_base64"
2019/07/09 09:54:51 [TRACE] [walkRefresh] Exiting eval tree: local_file.pgpass
2019/07/09 09:54:51 [TRACE] vertex "local_file.pgpass": visit complete
2019/07/09 09:54:51 [TRACE] vertex "local_file.pgpass": dynamic subgraph encountered errors
Error: unsupported attribute "content_base64"
Should create the file without content_base64 and without error.
Consistently getting content_base64 error and failing to apply terraform configuration.
terraform apply and allow the deployment to complete successfully.terraform applyI am unable to reproduce the problem outside of the large project that I'm in. I've attempted to set a single local_file to content_base64 and back to content, but it does not have the same problem.
I believe I am in a bad state and I'm considering wiping my state file. I attempted to try content_base64 on a single local_file configuration, but now each time I run terraform apply and the files exist, I get the "content_base64" error for each file that is being created locally.
Clear all local files from both terraform and locally and terraform apply.
I have the same error. There’s a difference, I never remember using ‘content_base64’, its just simple files. My workaround was to delete all occurrences of content_base64: null from tfstate.
The local provider added support for base64 encoding in version 1.3.0. However, your version information shows you're using version 1.2.2. I think you probably tried your content_base64 experiment while on the newer version (since that attribute didn't exist prior to 1.3.0), and then switched providers back to 1.2.2 (perhaps unintentionally--maybe you had a bad merge in source control, or maybe you haven't used version constraints on your provider?).
I'm able to reproduce your issue by initializing and applying a Terraform file like this:
provider "local" {
version = "1.3.0"
}
resource "local_file" "foo" {
content_base64 = "Zm9vCg=="
filename = "foo.txt"
}
...and then modifying the Terraform file as follows, initializing (to pick up the provider version change), and applying:
provider "local" {
version = "1.2.2"
}
resource "local_file" "foo" {
content = "foo\n"
filename = "foo.txt"
}
You should be able to solve your problem by switching back to version 1.3.0 of the provider.
I think you are right, sir, thank you! I didn’t switch just the version, it was the OS, on a dual boot, which had one of them on an old version. Thanks for your time!
Hi all!
@jcttrll is right that you need to be on local provider 1.3.0 or greater to use this feature. Because of that, I'm going to close this out. Thanks!
It works!
For anyone else facing this a simple terraform init -upgrade resolved this.
I believe the cause here was a mix of trying out base64 while using a CI server that always installs the latest version. I'll look into either pinning the version or just getting better about updating the providers.
I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Most helpful comment
It works!
For anyone else facing this a simple
terraform init -upgraderesolved this.I believe the cause here was a mix of trying out base64 while using a CI server that always installs the latest version. I'll look into either pinning the version or just getting better about updating the providers.