-
Notifications
You must be signed in to change notification settings - Fork 102
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
Terraform Apply does not work on the first execution but works on the second execution when using the TLS provider. #487
Comments
Hey there @RAK5HITHM 👋🏻, thanks for reporting the issue and sorry you're running into trouble here. From first glance, that error seems to suggest that the file function used in $ terraform validate
╷
│ Error: Invalid function argument
│
│ on main.tf line 13, in resource "tls_cert_request" "csr":
│ 13: private_key_pem = file("/tmp/.pki/private_key.pem")
│ ├────────────────
│ │ while calling file(path)
│
│ Invalid value for "path" parameter: no file exists at "/tmp/.pki/private_key.pem"; this function works only with files that are
│ distributed as part of the configuration source code, so if this file will be created by a resource in this configuration you must
│ instead obtain this result from an attribute of that resource. The If your goal is to utilize the PEM data created from the resource "tls_private_key" "private_key" {
algorithm = "RSA"
rsa_bits = 2048
}
resource "tls_cert_request" "csr" {
private_key_pem = tls_private_key.private_key.private_key_pem
subject {
common_name = "flexit.com"
organization = "FlexIT Consulting Services"
}
} |
Hello @RAK5HITHM I was able to advance this changing the file permission into 0440. |
Hey Javier,
Thank you for your input. Let me try it out.
…On Thu, Nov 7, 2024 at 8:39 PM Javier Martinez ***@***.***> wrote:
Hello @RAK5HITHM <https://github.com/RAK5HITHM> I was able to advance
this changing the file permission into 0440.
Best regards!
—
Reply to this email directly, view it on GitHub
<#487 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AZ46VTZFHF3LQWQTS77BVCLZ7N7ELAVCNFSM6AAAAABRLNU3WKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINRSGQ3TQNRUHE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Terraform CLI and Provider Versions
Terraform v1.7.5
on linux_amd64
Terraform Configuration
Expected Behavior
The resources should have be created
Actual Behavior
On the first time of execution of "Terraform apply" it will lead to an error, but again, running the command without any changes will not lead to any errors.
Terraform used the selected providers to generate the following execution plan.
Resource actions are indicated with the following symbols:
Terraform will perform the following actions:
local_file.key_data will be created
}
tls_cert_request.csr will be created
cert_request_pem = (known after apply)
id = (known after apply)
key_algorithm = (known after apply)
subject {
}
}
tls_private_key.private_key will be created
}
Plan: 3 to add, 0 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
tls_private_key.private_key: Creating...
tls_private_key.private_key: Creation complete after 0s [id=25af835c9684099533320c17d0ee4208bdf7809d]
local_file.key_data: Creating...
local_file.key_data: Creation complete after 0s [id=297e2a6a0f059da4c9746f569f44965c29f986a8]
╷
│ Error: Provider produced inconsistent final plan
│
│ When expanding the plan for tls_cert_request.csr to include new values learned so
│ far during apply, provider "registry.terraform.io/hashicorp/tls" produced an invalid
│ new value for .private_key_pem: inconsistent values for sensitive attribute.
│
│ This is a bug in the provider, which should be reported in the provider's own issue
│ tracker.
╵
Steps to Reproduce
terraform apply
How much impact is this issue causing?
Medium
Logs
No response
Additional Information
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: