Skip to content

Conversation

@TheEdda
Copy link
Contributor

@TheEdda TheEdda commented Sep 16, 2025

Hi, thanks for publishing this project. I love doing things not in Go.

I ran into an issue with the certificate validation failing (output from Terraform CLI log):

2025-09-16T18:08:22.729+0200 [DEBUG] provider.terraform-provider-test: WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
2025-09-16T18:08:22.729+0200 [DEBUG] provider.terraform-provider-test: I0000 00:00:1758038902.729566 4499024 ssl_transport_security.cc:1884] Handshake failed with error SSL_ERROR_SSL: error:10000412:SSL routines:OPENSSL_internal:SSLV3_ALERT_BAD_CERTIFICATE
2025-09-16T18:08:22.729+0200 [WARN]  provider.stdio: stdio service not available, stdout/stderr syncing unavailable
2025-09-16T18:08:22.729+0200 [TRACE] GRPCProvider.v6: GetProviderSchema
2025-09-16T18:08:22.729+0200 [WARN]  provider.stdio: stdio service unavailable, run will do nothing
2025-09-16T18:08:22.729+0200 [ERROR] plugin6.(*GRPCProvider).GetProviderSchema: error="rpc error: code = Unavailable desc = connection error: desc = \"transport: authentication handshake failed: tls: failed to verify certificate: x509: certificate has expired or is not yet valid: current time 2025-09-16T18:08:22+02:00 is before 2025-09-16T18:08:21Z\""
2025-09-16T18:08:22.729+0200 [TRACE] GRPCProvider.v6: Close

Turns out the self-signed certificate generated by the server is not yet valid if your system timezone has a positive offset from UTC because:

So I went ahead and fixed that :)

`datetime.now()` returns a `datetime` in the local timezone, but `x509.not_valid_before` expects a `datetime` in UTC (and does not validate this).

This causes the self-signed certificate to be not yet valid if the system timezone has a positive offset from UTC.
@hfern hfern self-requested a review September 17, 2025 00:12
@hfern
Copy link
Owner

hfern commented Sep 17, 2025

@TheEdward162 thank you for your contribution!

@hfern hfern merged commit 63f01ca into hfern:master Sep 17, 2025
6 checks passed
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

Successfully merging this pull request may close these issues.

2 participants