Terraform Commands Lab question 6

I have been trying to comment with single # & it did not work… however double # works. What is the different btw single & double # usage pls?

1 Like

Hello everybody,

Thanks for these pieces of information. Really helpful for me too. As I also got stuck on that part of the question.

resource “local_file” “key_data” {
filename = “/tmp/.pki/private_key.pem”
content = tls_private_key.private_key.private_key_pem
file_permission = “0400”
}
resource “tls_private_key” “private_key” {
algorithm = “RSA”
rsa_bits = 4096
}
resource “tls_cert_request” “csr” {
key_algorithm= “RSA”
private_key_pem= file(“/tmp/.pki/private_key.pem”)
depends_on = [ local_file.key_data ]

subject {
common_name = “flexit.com
organization = “FlexIT Consulting Services”
}
}

still not able to run the code getting below error
Invalid Configuration for Read-Only Attribute

on main.tf line 11, in resource “tls_cert_request” “csr”:
11: key_algorithm= “RSA”

Cannot set value for this attribute as the provider has marked it as
read-only. Remove the configuration line setting the value.

Refer to the provider documentation or contact the provider developers for
additional information about configurable and read-only attributes that are
supported.

Hello @Subhajit-Das
Can you please share the lab URL?

Hi, I’m raising the topic again, doesn’t work for me either, even after I put ## before key_algorithm. It passes well for terraform plan command, but when I run terraform apply it says this:

“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 “Terraform Registry” 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.”

Can someone help?

Does this solution no longer work?