Skip to content

fix: disable retryablehttp for DPoP auth and add TFE release workflow#1

Open
Tmanoche wants to merge 2 commits intomainfrom
dpop-jwt-fix
Open

fix: disable retryablehttp for DPoP auth and add TFE release workflow#1
Tmanoche wants to merge 2 commits intomainfrom
dpop-jwt-fix

Conversation

@Tmanoche
Copy link
Copy Markdown

Summary

  • Fix DPoP JWT reuse errors: retryablehttp reuses the same request on retries, causing 'DPoP proof JWT has already been used' errors. The V2 SDK's doWithRetries() now handles retries correctly with fresh DPoP JWTs.
  • Add TFE release workflow: New GitHub Actions workflow and Python script for publishing provider to Terraform Enterprise private registry
  • Cleanup: Remove unused GitHub issue templates and workflows

Changes

DPoP JWT fix (sdk/v2_requestExecutor.go)

  • Disabled retryablehttp for DPoP auth to prevent JWT reuse on automatic retries
  • JWT is generated once in Authorize() and only regenerated on actual retries (retryCount > 0) or nonce errors

TFE Publishing

  • .github/workflows/release-tfe.yml - GitHub Actions workflow for TFE releases
  • scripts/upload_to_tfe.py - Script for publishing provider to private registry
  • docs/PUBLISHING_TO_TFE.md - Documentation for the TFE publishing process

Test plan

  • Verify DPoP authentication works without JWT reuse errors
  • Test TFE release workflow with a test release

🤖 Generated with Claude Code

DPoP JWT fix:
- retryablehttp reuses the same request on retries, causing 'DPoP proof
  JWT has already been used' errors
- V2 SDK's doWithRetries() now handles retries correctly with fresh DPoP JWTs
- JWT is generated once in Authorize() and only regenerated on actual
  retries (retryCount > 0) or nonce errors

TFE publishing:
- Add GitHub Actions workflow for Terraform Enterprise releases
- Add upload_to_tfe.py script for publishing provider to private registry
- Add documentation for the TFE publishing process

Cleanup:
- Remove unused GitHub issue templates and workflows
Copy link
Copy Markdown

@007 007 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's working, so probably all fine¯\_(ツ)_/¯

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TFE sucks, that's terrible practice.

Comment thread scripts/upload_to_tfe.py
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does GoReleaser really not have this built-in yet?

Comment thread sdk/v2_requestExecutor.go Outdated
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's a "wait until we got it" structure you can/should use instead, turns it into a proper mutex?

Comment thread sdk/v2_requestExecutor.go Outdated
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

defer right away and let your returns handle unlocking?

Comment thread sdk/v2_requestExecutor.go Outdated
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duped code?

- Add applyTokenToRequest() to apply cached token and DPoP headers
- Add cacheNewToken() to store token and DPoP values in cache
- Add setDpopHeaders() to set Authorization and DPoP headers for new tokens
- Refactor PrivateKeyAuth.Authorize and JWTAuth.Authorize to use helpers
- Reduces ~88 lines of duplicated code

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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