-
Notifications
You must be signed in to change notification settings - Fork 47
WIP - Support Workload Identity Federation flow #1109
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
Draft
JorTurFer
wants to merge
22
commits into
stackitcloud:main
Choose a base branch
from
JorTurFer:prepare-wif
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
d95d6b8
initial commit
JorTurFer 6566b57
request id token for GH
JorTurFer 4dc71ae
.
JorTurFer b5ebf72
.
JorTurFer 203db08
.
JorTurFer cd88388
.
JorTurFer c61a7b3
Add audience parameter to GitHub request query
JorTurFer 691c705
Update provider.go
JorTurFer 9d8ca10
Fix return type in URL query parsing error
JorTurFer 3d5baa1
support passing the oidc token directly
JorTurFer cc88b49
.
JorTurFer e1204c4
.
JorTurFer a10d07a
Update tmp.yaml
JorTurFer 3029abd
.
JorTurFer 7096a0b
.
JorTurFer 7ad472b
use SDK function
JorTurFer 218c7a9
use SDK function
JorTurFer ab6afc4
use SDK function
JorTurFer c0c9670
use SDK function
JorTurFer 3fc4824
lint the code
JorTurFer 37a63ee
update docs
JorTurFer 7538212
bump sdk
JorTurFer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| # Ignore this file, it is a temporary workflow for testing purposes. | ||
|
|
||
| name: Build and Validate Provider | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - '**' | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| build-and-test: | ||
| name: Build Provider & Test Plan | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
|
|
||
| steps: | ||
| - name: Checkout Code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version-file: 'go.mod' | ||
|
|
||
| - name: Build Provider | ||
| run: | | ||
| go build -o terraform-provider-stackit | ||
| chmod +x terraform-provider-stackit | ||
| echo "BINARY_PATH=${GITHUB_WORKSPACE}" >> $GITHUB_ENV | ||
|
|
||
| - name: Configure Terraform Dev Overrides | ||
| run: | | ||
| cat <<EOF > ~/.terraformrc | ||
| provider_installation { | ||
| dev_overrides { | ||
| "stackitcloud/stackit" = "${{ env.BINARY_PATH }}" | ||
| } | ||
| # Para otros providers (random, null, etc), usa el registro normal | ||
| direct {} | ||
| } | ||
| EOF | ||
|
|
||
| echo "Terraform RC content:" | ||
| cat ~/.terraformrc | ||
|
|
||
| - name: Setup Terraform | ||
| uses: hashicorp/setup-terraform@v3 | ||
| with: | ||
| terraform_wrapper: false | ||
|
|
||
| - name: Create Test Configuration | ||
| run: | | ||
| cat <<EOF > main.tf | ||
| terraform { | ||
| required_providers { | ||
| stackit = { | ||
| source = "stackitcloud/stackit" | ||
| } | ||
| } | ||
| } | ||
|
|
||
| provider "stackit" { | ||
| default_region = "eu01" | ||
| enable_beta_resources = true | ||
| service_account_custom_endpoint = "https://service-account.api.qa.stackit.cloud" | ||
| token_custom_endpoint = "https://accounts.qa.stackit.cloud/oauth/v2/token" | ||
| service_account_email = "test-idp-njf5pc1@sa.stackit.cloud" | ||
| } | ||
|
|
||
| resource "stackit_service_account" "sa" { | ||
| project_id = "62675838-7758-4b99-a4eb-84b20ac8626b" | ||
| name = "terraform-wif-ci" | ||
| } | ||
| EOF | ||
|
|
||
| - name: Terraform Plan | ||
| run: | | ||
| # Inicializamos sin backend para pruebas rápidas | ||
| terraform init -backend=false | ||
|
|
||
| # Ejecutamos plan. Si el provider carga y la API responde, esto pasará. | ||
| terraform plan -out=tfplan | ||
| env: | ||
| STACKIT_USE_OIDC: "1" | ||
|
|
||
| - name: Terraform Apply | ||
| run: terraform apply -auto-approve tfplan | ||
| env: | ||
| STACKIT_USE_OIDC: "1" | ||
|
|
||
| - name: Terraform Destroy | ||
| if: always() | ||
| run: | | ||
| if [ -f terraform.tfstate ]; then | ||
| terraform destroy -auto-approve | ||
| else | ||
| echo "No state file found, skipping destroy." | ||
| fi | ||
| env: | ||
| STACKIT_USE_OIDC: "1" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: Shouldn't be a question
e.g.: