You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Terraform v1.3.8
on darwin_amd64
+ provider registry.terraform.io/hashicorp/tls v4.0.4
Use Cases or Problem Statement
Allow parsing multiple PEM encoded certificates when using the content attribute in a data block.
I would like to be able to use read and store multiple certificates from a single PEM file that contains a CA chain. Given a file like this (cachain.pem)
I would like to be able to load it via a data resource and reference each cert enclosed within it like so:
data "tls_certificate" "example_content" {
content = file("cachain.pem")
}
output "num_certs" {
value = length(data.tls_certificate.example_content.certificates)
}
Currently num_certs is 1 because the data source stops reading after the first PEM certificate in the file.
Proposal
I would like to update the Read function when using the content attribute to loop through the content and append each PEM block, instead of only reading the first valid PEM block in the content.
The resource type already stores certificates as a List type, so no other changes should be necessary. I also think this won't affect any backwards compatibility, since anyone currently using the content attribute is already referencing the data as a list with a 0 index.
How much impact is this issue causing?
Low
Additional Information
Will open a PR for this, but wanted to start an issue for the discussion/thoughts beforehand.
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
Terraform CLI and Provider Versions
Use Cases or Problem Statement
Allow parsing multiple PEM encoded certificates when using the
content
attribute in adata
block.I would like to be able to use read and store multiple certificates from a single PEM file that contains a CA chain. Given a file like this (cachain.pem)
I would like to be able to load it via a data resource and reference each cert enclosed within it like so:
Currently
num_certs
is 1 because the data source stops reading after the first PEM certificate in the file.Proposal
I would like to update the Read function when using the
content
attribute to loop through the content and append each PEM block, instead of only reading the first valid PEM block in the content.The resource type already stores
certificates
as a List type, so no other changes should be necessary. I also think this won't affect any backwards compatibility, since anyone currently using thecontent
attribute is already referencing the data as a list with a 0 index.How much impact is this issue causing?
Low
Additional Information
Will open a PR for this, but wanted to start an issue for the discussion/thoughts beforehand.
Code of Conduct
The text was updated successfully, but these errors were encountered: