opentofu: Plan detail for a resource's TypeSet block is hidden due to sensitive values
OpenTofu Version
OpenTofu v1.6.0-alpha2
on darwin_arm64
OpenTofu Configuration Files
terraform {
required_providers {
fastly = {
source = "fastly/fastly"
version = "5.5.0"
}
}
}
resource "fastly_service_vcl" "example" {
name = "opentofu_example_block_sensitive"
domain {
name = "opentofu_example_block_sensitive.integralist.co.uk"
}
backend {
address = "127.0.0.1"
name = "localhost"
port = 80
}
force_destroy = true
}
Debug Output
https://gist.github.com/Integralist/2820e49513ef22f0fd083c5ef316b742
Expected Behavior
We should see a complete diff for the backend block, something like…
+ backend {
+ address = "127.0.0.1"
+ auto_loadbalance = false
+ between_bytes_timeout = 10000
+ connect_timeout = 1000
+ error_threshold = 0
+ first_byte_timeout = 15000
+ healthcheck = ""
+ max_conn = 200
+ name = "localhost"
+ override_host = ""
+ port = 80
+ request_condition = ""
+ ssl_cert_hostname = ""
+ ssl_check_cert = true
+ ssl_sni_hostname = ""
+ use_ssl = false
+ weight = 100
}
Actual Behavior
Instead, we see the following…
+ backend {
# At least one attribute in this block is (or was) sensitive,
# so its contents will not be displayed.
}
Steps to Reproduce
tofu inittofu plan
Additional Context
This was originally reported in the Terraform repository and is currently still open (the change in behaviour was introduced in the terraform CLI version 1.4.0, and OpenTofu forked from 1.5.0).
Now, although I appreciate the rationale of hiding sensitive data from the plan, there are two problems here…
- We’re hiding the entire
backendblock’s plan, and this makes it very dangerous for anyone to apply this configuration change (as we can’t see what’s changing). Yes, it’s likely the author of the change is the one running thetofu planbut that’s not always the case, and even still mistakes happen and it’s important to be able to verify what is about to change in your infrastructure. It would be nice if just the values for each sensitive attribute was hidden rather than hiding everything. - In this particular case, I’m not actually setting any of the ‘sensitive’ attributes defined in the
backendblock. So I shouldn’t really have the block’s entire plan hidden from me as there actually is no sensitive value being set.
References
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 3
- Comments: 20 (13 by maintainers)
Thanks for creating the issue @Integralist!
I’m personally very much in favour of fixing this.
Hi @janosdebugs, I have an idea to fix it with a custom cty transformer, can you also add me to the assignees and I can submit an initial draft PR to discuss if it is a doable way.
Hi @janosdebugs @cam72cam @cube2222 , I’d like to share some investigation on this issue:
If we want to fix it in opentofu, we may need some trick. Do you have any idea of an acceptable approch? I am interested to fix it if @namgyalangmo hasn’t started to work on it yet.
Apart from provider block
api_key, you can add env varibleFASTLY_API_KEY.More’s here: https://github.com/fastly/terraform-provider-fastly/blob/main/docs/index.md#static-api-key
Hey @namgyalangmo if you don’t have a Fastly API key, please test with a provider you have a working setup for.
Hi @namgyalangmo thank you for volunteering, I’ve assigned you. I don’t have any specific input apart from what is discussed in this issue, unfortunately. Please read this section of the contribution guide before you begin coding.