-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
Can't create TLS Certificate: ${file("${path.module}/ca.key")}: no such file (file is created by another resource) #16136
Comments
Hi @sirmax123! Sorry for this unfortunate behavior. The For your specific use-case here, Terraform has its own resource "tls_private_key" "consul_ca" {
algorithm = "RSA"
rsa_bits = 4096
}
resource "tls_self_signed_cert" "consul_ca" {
key_algorithm = "RSA"
private_key_pem = "${tls_private_key.consul_ca.private_key_pem}"
# ...
} Using this resource also solves a different problem: provisioners only run during resource creation, and so if you were to try to plan updates to the config using a subsequent TLS keys aside, the general solution to this problem of generating custom data for use would be hashicorp/terraform-provider-external#5, which would add a resource type called |
Thank you for you reply. Unfortunately I can't use I guess this issue can be closed with 'by design' resolution, it is not a bug but expected behaviour. |
Hi again @sirmax123! Sorry for the delay in following up. In general Terraform can't guarantee that sensitive information included in configuration -- whether via There are other mechanisms to load data from external files that do obey the dependency graph, such as using the In future we plan to invest more in first-class support for storing state securely at rest, along with other features to make sensitive information in state less troublesome. |
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. |
Hi Team!
I faced with issue trying to create self-signed certificate:
So I create key file first and try to use it.
I got the following error:
It looks like ${file()} checks if file exist before actual run.
As workaround I have empty pre-created file.
The text was updated successfully, but these errors were encountered: