Skip to content

Commit bdfc572

Browse files
committed
fix linting
Signed-off-by: Jorge Turrado <jorge.turrado@mail.schwarz>
1 parent 38c49a4 commit bdfc572

3 files changed

Lines changed: 107 additions & 4 deletions

File tree

.github/workflows/tmp.yaml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# Ignore this file, it is a temporary workflow for testing purposes.
2+
3+
name: Build and Validate Provider
4+
5+
on:
6+
push:
7+
branches:
8+
- "**"
9+
workflow_dispatch:
10+
11+
jobs:
12+
build-and-test:
13+
name: Build Provider & Test Plan
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
id-token: write
18+
19+
steps:
20+
- name: Checkout Code
21+
uses: actions/checkout@v4
22+
23+
- name: Setup Go
24+
uses: actions/setup-go@v5
25+
with:
26+
go-version-file: "go.mod"
27+
28+
- name: Build Provider
29+
run: |
30+
go build -o terraform-provider-stackit
31+
chmod +x terraform-provider-stackit
32+
echo "BINARY_PATH=${GITHUB_WORKSPACE}" >> $GITHUB_ENV
33+
34+
- name: Configure Terraform Dev Overrides
35+
run: |
36+
cat <<EOF > ~/.terraformrc
37+
provider_installation {
38+
dev_overrides {
39+
"stackitcloud/stackit" = "${{ env.BINARY_PATH }}"
40+
}
41+
# Para otros providers (random, null, etc), usa el registro normal
42+
direct {}
43+
}
44+
EOF
45+
46+
echo "Terraform RC content:"
47+
cat ~/.terraformrc
48+
49+
- name: Setup Terraform
50+
uses: hashicorp/setup-terraform@v3
51+
with:
52+
terraform_wrapper: false
53+
54+
- name: Create Test Configuration
55+
run: |
56+
cat <<EOF > main.tf
57+
terraform {
58+
required_providers {
59+
stackit = {
60+
source = "stackitcloud/stackit"
61+
}
62+
}
63+
}
64+
65+
provider "stackit" {
66+
default_region = "eu01"
67+
enable_beta_resources = true
68+
service_account_custom_endpoint = "https://service-account.api.qa.stackit.cloud"
69+
token_custom_endpoint = "https://accounts.qa.stackit.cloud/oauth/v2/token"
70+
}
71+
72+
resource "stackit_service_account" "sa" {
73+
project_id = "62675838-7758-4b99-a4eb-84b20ac8626b"
74+
name = "terraform-wif-ci"
75+
}
76+
EOF
77+
78+
- name: Terraform Plan
79+
run: |
80+
# Inicializamos sin backend para pruebas rápidas
81+
terraform init
82+
83+
# Ejecutamos plan. Si el provider carga y la API responde, esto pasará.
84+
terraform plan -out=tfplan
85+
env:
86+
STACKIT_USE_OIDC: "1"
87+
STACKIT_SERVICE_ACCOUNT_EMAIL: "test-idp-njf5pc1@sa.stackit.cloud"
88+
89+
- name: Terraform Apply
90+
run: terraform apply -auto-approve tfplan
91+
env:
92+
STACKIT_USE_OIDC: "1"
93+
STACKIT_SERVICE_ACCOUNT_EMAIL: "test-idp-njf5pc1@sa.stackit.cloud"
94+
95+
- name: Terraform Destroy
96+
if: always()
97+
run: |
98+
if [ -f terraform.tfstate ]; then
99+
terraform destroy -auto-approve
100+
else
101+
echo "No state file found, skipping destroy."
102+
fi
103+
env:
104+
STACKIT_USE_OIDC: "1"
105+
STACKIT_SERVICE_ACCOUNT_EMAIL: "test-idp-njf5pc1@sa.stackit.cloud"

docs/guides/workload_identity_federation.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,7 @@ jobs:
102102
103103
- name: Terraform Init
104104
run: |
105-
# NOTE: We don't use backend for this example but you should use a backend.
106-
terraform init -backend=false
105+
terraform init
107106
env:
108107
STACKIT_USE_OIDC: "1"
109108
STACKIT_SERVICE_ACCOUNT_EMAIL: "terraform-example@sa.stackit.cloud"

templates/guides/workload_identity_federation.md.tmpl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,7 @@ jobs:
102102
103103
- name: Terraform Init
104104
run: |
105-
# NOTE: We don't use backend for this example but you should use a backend.
106-
terraform init -backend=false
105+
terraform init
107106
env:
108107
STACKIT_USE_OIDC: "1"
109108
STACKIT_SERVICE_ACCOUNT_EMAIL: "terraform-example@sa.stackit.cloud"

0 commit comments

Comments
 (0)