Skip to content
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

Perpetual diff due to use of time.Now() for creation time in JKS data #4

Open
jbg opened this issue Sep 24, 2022 · 2 comments
Open

Comments

@jbg
Copy link

jbg commented Sep 24, 2022

The jks attribute of this resource changes on every plan even if the same certificates are provided as input, because of the use of time.Now() as the CreationTime for each entry:

		err := ks.SetTrustedCertificateEntry(
			fmt.Sprintf("%d", chainIdx),
			keystore.TrustedCertificateEntry{
				CreationTime: time.Now(),
				Certificate: keystore.Certificate{
					Type:    "X.509",
					Content: certDerData,
				},
			},
		)

https://github.com/outfoxx/terraform-provider-jks-trust-store/blob/main/jks-trust-store/resource_trust_store.go#L86

and the fact that the Read() implementation just calls Create().

This causes unnecessary churn for downstream resources that depend on this resource (for example, .jks files get rewritten on every single terraform plan/apply). It would be better if a single timestamp was used for all entries during Create() and stored in the state, so that the exact same jks data can be returned on subsequent reads.

@Crazy-Hopper
Copy link

Thank you very much, @jbg !
I've reimplemented your idea in my fork https://github.com/Crazy-Hopper/terraform-provider-jks

@kdubb
Copy link
Contributor

kdubb commented Dec 6, 2023

Sorry guys we've stopped using terraform and therefore this is unmaintained.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants