Compare commits

...

180 commits
v0.1.0 ... main

Author SHA1 Message Date
6b5b97ac9a
Merge pull request 'fix: extend PGSQL fail wait cycle' (#113) from fix/longer_fail_wait_cycle into main
All checks were successful
Publish / Check GoReleaser config (push) Successful in 5s
Publish / Publish provider (push) Successful in 5m40s
Reviewed-on: #113
2026-05-07 07:55:51 +00:00
Marcel S. Henselin
29cf260d56 fix: extend PGSQL fail wait cycle
All checks were successful
CI Workflow / Check GoReleaser config (pull_request) Successful in 43s
Notify on new PR / Notify via Google Chat (pull_request) Successful in 1m10s
CI Workflow / Prepare GO cache (pull_request) Successful in 5m4s
CI Workflow / CI run tests (pull_request) Successful in 5m40s
TF Acceptance Tests Workflow / Acceptance Tests (pull_request) Successful in 13m22s
CI Workflow / CI run build and linting (pull_request) Successful in 7m51s
CI Workflow / Code coverage report (pull_request) Successful in 45s
CI Workflow / Test readiness for publishing provider (pull_request) Successful in 15m5s
2026-05-07 09:55:03 +02:00
4e217e20a4
Merge pull request 'chore: update docs' (#112) from fix/gen_docs into main
All checks were successful
Publish / Check GoReleaser config (push) Successful in 5s
Publish / Publish provider (push) Successful in 5m49s
Reviewed-on: #112
2026-05-07 07:49:49 +00:00
Marcel S. Henselin
2f2b5cd04a chore: update docs
All checks were successful
CI Workflow / Check GoReleaser config (pull_request) Successful in 1m20s
Notify on new PR / Notify via Google Chat (pull_request) Successful in 1m20s
CI Workflow / Prepare GO cache (pull_request) Successful in 2m53s
CI Workflow / CI run build and linting (pull_request) Successful in 10m9s
CI Workflow / CI run tests (pull_request) Successful in 10m42s
CI Workflow / Code coverage report (pull_request) Successful in 47s
TF Acceptance Tests Workflow / Acceptance Tests (pull_request) Successful in 17m46s
CI Workflow / Test readiness for publishing provider (pull_request) Successful in 21m10s
2026-05-07 09:49:17 +02:00
6c26089930
chore: update docs (#111)
All checks were successful
Publish / Check GoReleaser config (push) Successful in 5s
Publish / Publish provider (push) Successful in 5m55s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Reviewed-on: #111
2026-05-07 07:37:22 +00:00
c31a8a787a
fix: wrong data type (#110)
All checks were successful
Publish / Check GoReleaser config (push) Successful in 6s
Publish / Publish provider (push) Successful in 6m22s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Reviewed-on: #110
2026-05-07 07:13:50 +00:00
515b7b1357
fix: wrong flavor source (#109)
All checks were successful
Publish / Check GoReleaser config (push) Successful in 6s
Publish / Publish provider (push) Successful in 5m45s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Reviewed-on: #109
2026-05-07 06:51:19 +00:00
e6d2d3e10a
fix: re-enable sqlserverflex flavor (#108)
All checks were successful
Publish / Check GoReleaser config (push) Successful in 5s
Publish / Publish provider (push) Successful in 5m46s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Reviewed-on: #108
2026-05-07 06:35:19 +00:00
8fee76f037
fix: postgresqlflex flavor errors (#107)
All checks were successful
Publish / Check GoReleaser config (push) Successful in 4s
Publish / Publish provider (push) Successful in 13m40s
feat: enable old v2 flavor handling
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Reviewed-on: #107
2026-05-07 05:38:11 +00:00
ebb3ec051d
Merge pull request 'fix: notification in thread' (#105) from fix/notify_pipeline_typo into main
Reviewed-on: #105
2026-04-17 09:00:58 +00:00
Marcel S. Henselin
e5b2681142 fix: notification in thread
[skip ci]
2026-04-17 11:00:40 +02:00
e65c74e6e7
Merge pull request 'feat: add notification in thread' (#104) from fix/fix_pipeline into main
Reviewed-on: #104
2026-04-17 08:36:39 +00:00
afde034d64
Merge branch 'main' into fix/fix_pipeline
Some checks failed
CI Workflow / Check GoReleaser config (pull_request) Failing after 1m53s
CI Workflow / Prepare GO cache (pull_request) Successful in 5m44s
CI Workflow / Test readiness for publishing provider (pull_request) Has been skipped
CI Workflow / CI run tests (pull_request) Has been skipped
CI Workflow / CI run build and linting (pull_request) Has been skipped
CI Workflow / Code coverage report (pull_request) Has been skipped
TF Acceptance Tests Workflow / Acceptance Tests (pull_request) Successful in 30m39s
2026-04-17 08:35:57 +00:00
Marcel S. Henselin
7b911ebf70 feat: add notification in thread
[skip ci]
2026-04-17 10:35:19 +02:00
e320e80956
Merge pull request 'fix: fix publish pipeline' (#103) from fix/fix_pipeline into main
All checks were successful
Publish / Check GoReleaser config (push) Successful in 5s
Publish / Publish provider (push) Successful in 13m38s
Reviewed-on: #103
2026-04-17 08:30:24 +00:00
Marcel S. Henselin
4d96cc8951 fix: fix publish pipeline
[skip ci]
2026-04-17 10:29:59 +02:00
f9a3d4265c
Merge pull request 'fix: update SDK version to fix unknown json value error' (#102) from fix/update_sdk_version into main
Some checks failed
Publish / Check GoReleaser config (push) Successful in 10s
Publish / Publish provider (push) Failing after 1m10s
Reviewed-on: #102
2026-04-17 08:25:49 +00:00
Marcel S. Henselin
1298c3fbf1 fix: update SDK version to fix unknown json value error
feat: add eu02 to available zones in sqlserver

[skip ci]
2026-04-17 10:24:48 +02:00
fa641d29c5
Merge pull request 'fix: try fix test runs' (#101) from fix/sql_server_test into main
Reviewed-on: #101
2026-03-27 20:20:59 +00:00
Marcel S. Henselin
dab47d4690 fix: try fix test runs
[skip ci]
2026-03-27 21:19:53 +01:00
a0351798e0
Merge pull request 'fix: try fix empty outputs' (#100) from fix/acc_test into main
Reviewed-on: #100
2026-03-27 17:35:01 +00:00
f7b022ec6c
Merge branch 'main' into fix/acc_test
Some checks failed
CI Workflow / Check GoReleaser config (pull_request) Failing after 1m16s
CI Workflow / Prepare GO cache (pull_request) Successful in 6m2s
CI Workflow / Test readiness for publishing provider (pull_request) Has been skipped
CI Workflow / CI run tests (pull_request) Has been skipped
CI Workflow / CI run build and linting (pull_request) Has been skipped
CI Workflow / Code coverage report (pull_request) Has been skipped
TF Acceptance Tests Workflow / Acceptance Tests (pull_request) Successful in 1h40m49s
2026-03-27 17:34:38 +00:00
Marcel S. Henselin
6e3d2b51fa fix: try fix empty outputs
[skip ci]
2026-03-27 18:34:22 +01:00
Marcel S. Henselin
9ef7ce9029 fix: try fix empty outputs
[skip ci]
2026-03-27 18:33:12 +01:00
aac1a2ba17
fix: pipeline_fix (#99)
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Reviewed-on: #99
2026-03-27 17:07:50 +00:00
d16b97a8e9
Merge pull request 'fix: empty string on required input' (#98) from fix/empty_string into main
Reviewed-on: #98
2026-03-27 15:26:13 +00:00
Marcel S. Henselin
edc5e869ce fix: empty string on required input
[skip ci]
2026-03-27 16:25:56 +01:00
7b2dfaea44
chore: refactor pipelines (#97)
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Reviewed-on: #97
2026-03-27 15:23:30 +00:00
2893a11c0a
chore: refactor pipelines (#96)
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Reviewed-on: #96
2026-03-26 16:18:00 +00:00
0b5e15d1c5
Merge pull request 'chore: add notifications' (#95) from chore/add_notify into main
Reviewed-on: #95
2026-03-25 12:40:53 +00:00
Marcel S. Henselin
8a6d932107 chore: add notifications
[skip ci]
2026-03-25 13:40:23 +01:00
956cedef08
Merge pull request 'chore: pipelines' (#94) from chore/pipelines into main
All checks were successful
Publish / Check GoReleaser config (push) Successful in 5s
Publish / Publish provider (push) Successful in 5m32s
Reviewed-on: #94
2026-03-25 12:32:29 +00:00
Marcel S. Henselin
d5b4e02437 fix: adjust timeout
Some checks failed
CI Workflow / Check GoReleaser config (pull_request) Failing after 1m33s
Notify on new PR / Notify via Google Chat (pull_request) Successful in 2m4s
CI Workflow / Prepare GO cache (pull_request) Successful in 4m40s
CI Workflow / Test readiness for publishing provider (pull_request) Has been skipped
CI Workflow / CI run tests (pull_request) Has been skipped
CI Workflow / CI run build and linting (pull_request) Has been skipped
CI Workflow / Code coverage report (pull_request) Has been skipped
TF Acceptance Tests Workflow / Acceptance Tests (pull_request) Failing after 1h37m59s
2026-03-25 13:31:03 +01:00
Marcel S. Henselin
bb15293dd3 fix: adjust timeout 2026-03-25 13:30:36 +01:00
Marcel S. Henselin
6e6e771631 chore: add notification action
[skip ci]
2026-03-25 12:17:16 +01:00
Marcel S. Henselin
683bc64c12 chore: add notification action
[skip ci]
2026-03-25 12:14:54 +01:00
Marcel S. Henselin
064d2cf1db chore: add notification action
[skip ci]
2026-03-25 11:17:33 +01:00
Marcel S. Henselin
722c46b12d chore: add notification action
[skip ci]
2026-03-25 11:09:32 +01:00
03776cc7fd
Merge branch 'alpha' into main
Some checks failed
CI Workflow / Check GoReleaser config (pull_request) Failing after 1m22s
CI Workflow / Prepare GO cache (pull_request) Successful in 6m20s
CI Workflow / Test readiness for publishing provider (pull_request) Has been skipped
CI Workflow / CI run tests (pull_request) Has been skipped
CI Workflow / CI run build and linting (pull_request) Has been skipped
CI Workflow / Code coverage report (pull_request) Has been skipped
TF Acceptance Tests Workflow / Acceptance Tests (pull_request) Failing after 23m2s
2026-03-25 09:23:47 +00:00
9060aa9f6a
Merge pull request 'chore: add terraform install step to action' (#93) from chore/action_step into main
Some checks failed
CI Workflow / Check GoReleaser config (pull_request) Failing after 59s
CI Workflow / Prepare GO cache (pull_request) Successful in 5m23s
CI Workflow / Test readiness for publishing provider (pull_request) Has been skipped
CI Workflow / CI run tests (pull_request) Has been skipped
CI Workflow / CI run build and linting (pull_request) Has been skipped
CI Workflow / Code coverage report (pull_request) Has been skipped
TF Acceptance Tests Workflow / Acceptance Tests (pull_request) Failing after 1h41m56s
Reviewed-on: #93
2026-03-25 09:23:14 +00:00
Marcel S. Henselin
5a1dc9cd94 chore: add terraform install step to action
[skip ci]
2026-03-25 10:22:48 +01:00
d34927537a
Merge pull request 'fix: adjust timeouts to 90 mins' (#92) from fix/adjust_timeouts_90_min into main
Some checks failed
Publish / Check GoReleaser config (push) Successful in 10s
CI Workflow / Check GoReleaser config (pull_request) Failing after 47s
CI Workflow / Prepare GO cache (pull_request) Successful in 5m39s
CI Workflow / Test readiness for publishing provider (pull_request) Has been skipped
CI Workflow / CI run tests (pull_request) Has been skipped
CI Workflow / CI run build and linting (pull_request) Has been skipped
CI Workflow / Code coverage report (pull_request) Has been skipped
Publish / Publish provider (push) Successful in 14m52s
TF Acceptance Tests Workflow / Acceptance Tests (pull_request) Failing after 1h38m32s
Reviewed-on: #92
2026-03-25 08:45:31 +00:00
Marcel S. Henselin
83b0860115 fix: adjust timeouts to 90 mins
Some checks failed
CI Workflow / Check GoReleaser config (pull_request) Failing after 1m2s
CI Workflow / Prepare GO cache (pull_request) Successful in 5m33s
CI Workflow / Test readiness for publishing provider (pull_request) Has been skipped
CI Workflow / CI run tests (pull_request) Has been skipped
CI Workflow / CI run build and linting (pull_request) Has been skipped
CI Workflow / Code coverage report (pull_request) Has been skipped
TF Acceptance Tests Workflow / Acceptance Tests (pull_request) Failing after 1h39m47s
2026-03-25 09:40:44 +01:00
Marcel S. Henselin
97645d7a66 fix: update pipelines
[skip ci]
2026-03-18 11:24:57 +01:00
Marcel S. Henselin
94f3dad963 fix: update pipelines
[skip ci]
2026-03-18 11:17:42 +01:00
Marcel S. Henselin
c081f5f7bd fix: update pipelines
[skip ci]
2026-03-18 11:14:33 +01:00
Marcel S. Henselin
8ab8656b5c fix: update pipelines
[skip ci]
2026-03-18 09:59:38 +01:00
Marcel S. Henselin
63435e5e63 fix: update pipelines
[skip ci]
2026-03-18 09:56:24 +01:00
Marcel S. Henselin
e974ccf906 fix: update pipelines
Some checks failed
TF Acceptance Tests Workflow / Acceptance Tests (pull_request) Has been cancelled
Publish / Check GoReleaser config (push) Successful in 5s
CI Workflow / Check GoReleaser config (pull_request) Failing after 1m21s
Publish / Publish provider (push) Successful in 5m46s
CI Workflow / Prepare GO cache (pull_request) Successful in 7m36s
CI Workflow / Test readiness for publishing provider (pull_request) Has been skipped
CI Workflow / CI run tests (pull_request) Has been skipped
CI Workflow / CI run build and linting (pull_request) Has been skipped
CI Workflow / Code coverage report (pull_request) Has been skipped
2026-03-18 09:40:23 +01:00
Marcel S. Henselin
1fd2df5c76 fix: update pipelines
Some checks failed
CI Workflow / Check GoReleaser config (pull_request) Failing after 1m43s
Publish / Check GoReleaser config (push) Failing after 1m19s
Publish / Publish provider (push) Has been skipped
CI Workflow / Prepare GO cache (pull_request) Successful in 6m55s
CI Workflow / Test readiness for publishing provider (pull_request) Has been skipped
CI Workflow / CI run tests (pull_request) Has been skipped
CI Workflow / CI run build and linting (pull_request) Has been skipped
CI Workflow / Code coverage report (pull_request) Has been skipped
TF Acceptance Tests Workflow / Acceptance Tests (pull_request) Failing after 28m45s
fix: implement sql server 200 error
2026-03-18 09:35:14 +01:00
Marcel S. Henselin
aaabadde1a chore: update publish pipeline
Some checks failed
CI Workflow / Check GoReleaser config (pull_request) Successful in 7s
TF Acceptance Tests Workflow / Acceptance Tests (pull_request) Has been cancelled
CI Workflow / Test readiness for publishing provider (pull_request) Has been cancelled
CI Workflow / Prepare GO cache (pull_request) Has been cancelled
CI Workflow / CI run tests (pull_request) Has been cancelled
CI Workflow / CI run build and linting (pull_request) Has been cancelled
CI Workflow / Code coverage report (pull_request) Has been cancelled
Publish / Check GoReleaser config (push) Successful in 8s
Publish / Publish provider (push) Successful in 14m13s
2026-03-17 17:42:25 +01:00
Marcel S. Henselin
0a5bc30d9c chore: update publish pipeline
[skip ci]
2026-03-17 17:39:22 +01:00
Marcel S. Henselin
8ff6b2a4d8 chore: update publish pipeline
[skip ci]
2026-03-17 17:37:36 +01:00
3dbb04c917
chore: update publish pipeline (#91)
[skip ci]

## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Reviewed-on: #91
2026-03-17 16:29:06 +00:00
a1d1750a79
chore: update publish pipeline (#90)
[skip ci]

## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Reviewed-on: #90
2026-03-17 16:21:23 +00:00
76af35f27d
chore: update publish pipeline (#88)
[skip ci]

## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Reviewed-on: #88
2026-03-17 15:59:25 +00:00
01deb9022d
chore: update README (#87)
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Co-authored-by: Marcel S. Henselin <marcel@henselin.net>
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Reviewed-on: #87
2026-03-17 15:33:21 +00:00
Marcel S. Henselin
91fe23f5e8 chore: update README
[skip ci]
2026-03-17 16:32:22 +01:00
Marcel S. Henselin
4913ff1c3a Merge branch 'alpha'
# Conflicts:
#	tools/go.sum
2026-03-17 16:25:23 +01:00
dd77da71dd
feat: more_tests (#85)
Some checks failed
Publish / Check GoReleaser config (push) Successful in 7s
Publish / Publish provider (push) Successful in 7m41s
CI Workflow / Check GoReleaser config (pull_request) Successful in 6s
CI Workflow / Prepare GO cache (pull_request) Successful in 10m18s
CI Workflow / Test readiness for publishing provider (pull_request) Has been cancelled
CI Workflow / Code coverage report (pull_request) Has been cancelled
CI Workflow / CI run build and linting (pull_request) Has been cancelled
CI Workflow / CI run tests (pull_request) Has been cancelled
TF Acceptance Tests Workflow / Acceptance Tests (pull_request) Failing after 26m13s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Reviewed-on: #85
2026-03-17 15:02:08 +00:00
Marcel S. Henselin
431f6eff8c chore: add sample to main 2026-03-13 11:23:22 +01:00
Marcel S. Henselin
a310d1454a Merge remote-tracking branch 'origin/alpha'
# Conflicts:
#	.github/workflows/publish.yaml
#	generator/cmd/build/build.go
#	generator/cmd/rootCmd.go
#	generator/main.go
#	stackit/internal/services/sqlserverflexalpha/sqlserverflex_acc_test.go
2026-03-13 11:22:10 +01:00
3790894563
feat(generator): generate nav file (#83)
Some checks failed
CI Workflow / Check GoReleaser config (pull_request) Successful in 5s
CI Workflow / Prepare GO cache (pull_request) Successful in 5m4s
Publish / Check GoReleaser config (push) Successful in 1m14s
CI Workflow / Test readiness for publishing provider (pull_request) Successful in 20m19s
Publish / Publish provider (push) Successful in 20m56s
CI Workflow / CI run build and linting (pull_request) Successful in 26m50s
CI Workflow / Code coverage report (pull_request) Successful in 10s
CI Workflow / CI run tests (pull_request) Failing after 50m42s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Reviewed-on: #83
2026-03-13 09:53:54 +00:00
f173fd54fe
fix: fix publish pipeline (#82)
All checks were successful
Publish / Check GoReleaser config (push) Successful in 9s
Publish / Publish provider (push) Successful in 28m2s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Reviewed-on: #82
2026-03-11 13:28:48 +00:00
1033d7e034
fix: builder and sdk changes (#81)
Some checks failed
Publish / Check GoReleaser config (push) Successful in 8s
Publish / Publish provider (push) Failing after 20s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-authored-by: marcel.henselin <marcel.henselin@stackit.cloud>
Reviewed-on: #81
2026-03-11 13:13:46 +00:00
marcel.henselin
635a9abf20
fix: disable shell color in runnerstats (#80)
Signed-off-by: marcel.henselin <marcel.henselin@stackit.cloud>

## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #80
Co-authored-by: marcel.henselin <marcel.henselin@stackit.cloud>
Co-committed-by: marcel.henselin <marcel.henselin@stackit.cloud>
2026-02-27 10:25:10 +00:00
marcel.henselin
07458c5677
feat: add runner stats (#79)
Signed-off-by: marcel.henselin <marcel.henselin@stackit.cloud>

## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #79
Co-authored-by: marcel.henselin <marcel.henselin@stackit.cloud>
Co-committed-by: marcel.henselin <marcel.henselin@stackit.cloud>
2026-02-27 10:20:02 +00:00
marcel.henselin
eb13630d2f
feat: test STACKIT runner (#78)
Signed-off-by: marcel.henselin <marcel.henselin@stackit.cloud>

## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #78
Co-authored-by: marcel.henselin <marcel.henselin@stackit.cloud>
Co-committed-by: marcel.henselin <marcel.henselin@stackit.cloud>
2026-02-27 10:08:09 +00:00
4a2819787d
fix: linting (#77)
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #77
Co-authored-by: Andre Harms <andre.harms@stackit.cloud>
Co-committed-by: Andre Harms <andre.harms@stackit.cloud>
2026-02-19 08:54:34 +00:00
Marcel S. Henselin
36eccc52c3
fix: null_ident (#76)
All checks were successful
Publish / Check GoReleaser config (push) Successful in 9s
Publish / Publish provider (push) Successful in 34m58s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #76
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-02-17 17:18:40 +00:00
Marcel S. Henselin
841e702b95
fix: encryption_fix (#75)
All checks were successful
Publish / Check GoReleaser config (push) Successful in 12s
Publish / Publish provider (push) Successful in 33m28s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #75
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-02-17 09:42:46 +00:00
Marcel S. Henselin
aba831cbdd
fix: some_fixes (#74)
All checks were successful
Publish / Check GoReleaser config (push) Successful in 8s
Publish / Publish provider (push) Successful in 14m6s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #74
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-02-16 19:49:02 +00:00
Marcel S. Henselin
89a24ce780
fix: try fix errors (#73)
All checks were successful
Publish / Check GoReleaser config (push) Successful in 9s
Publish / Publish provider (push) Successful in 43m1s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #73
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-02-16 19:09:42 +00:00
Marcel S. Henselin
f05e90c35a
fix: some more fix tests (#72)
All checks were successful
Publish / Check GoReleaser config (push) Successful in 5s
Publish / Publish provider (push) Successful in 12m42s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #72
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-02-16 16:12:53 +00:00
Marcel S. Henselin
7ee82366d7
fix: try fix errors (#71)
All checks were successful
Publish / Check GoReleaser config (push) Successful in 11s
Publish / Publish provider (push) Successful in 35m24s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #71
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-02-16 13:40:05 +00:00
d5644ec27f
chore: #64 add system hardening with retry logic for client (#68)
All checks were successful
Publish / Check GoReleaser config (push) Successful in 5s
Publish / Publish provider (push) Successful in 12m49s
- implement RetryRoundTripper

Refs: #64

Reviewed-on: #68
Reviewed-by: Marcel_Henselin <marcel.henselin@stackit.cloud>
Co-authored-by: Andre Harms <andre.harms@stackit.cloud>
Co-committed-by: Andre Harms <andre.harms@stackit.cloud>
2026-02-16 09:35:21 +00:00
Marcel S. Henselin
20e9b3ca4c
fix: #66 non generic api error handling (#67)
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #67
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-02-16 09:20:36 +00:00
Marcel S. Henselin
43223f5d1f
fix: #63 sort user roles to prevent state change (#65)
fix: include recent api changes
Reviewed-on: #65
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-02-16 09:04:16 +00:00
Marcel S. Henselin
452f73877f
fix: fix pgsql db state (#62)
All checks were successful
Publish / Check GoReleaser config (push) Successful in 5s
Publish / Publish provider (push) Successful in 12m26s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #62
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-02-13 17:06:57 +00:00
Marcel S. Henselin
55a0917a86
fix: fix sqlserverflexalpha (#61)
All checks were successful
Publish / Check GoReleaser config (push) Successful in 5s
Publish / Publish provider (push) Successful in 12m55s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #61
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-02-13 16:23:42 +00:00
Marcel_Henselin
d90236b02e
chore: refactorings (#60)
All checks were successful
Publish / Check GoReleaser config (push) Successful in 4s
Publish / Publish provider (push) Successful in 12m30s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #60
2026-02-13 15:49:32 +00:00
Marcel S. Henselin
b1f8c8a4d9
fix: fix wrong order of params (#59)
All checks were successful
Publish / Check GoReleaser config (push) Successful in 10s
Publish / Publish provider (push) Successful in 34m9s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #59
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-02-13 14:55:36 +00:00
Marcel S. Henselin
e01ae1a920
fix: fix lintings (#58)
All checks were successful
Publish / Check GoReleaser config (push) Successful in 5s
Publish / Publish provider (push) Successful in 12m24s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #58
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-02-13 14:27:14 +00:00
Marcel S. Henselin
843fc46f54
fix: tests (#57)
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #57
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-02-13 10:38:19 +00:00
Marcel S. Henselin
10af1dbbba
fix: postgres_fixes (#54)
Some checks failed
Publish / Check GoReleaser config (push) Successful in 9s
Publish / Publish provider (push) Successful in 30m38s
CI Workflow / Check GoReleaser config (pull_request) Successful in 6s
CI Workflow / CI (pull_request) Failing after 22m26s
CI Workflow / Code coverage report (pull_request) Has been skipped
CI Workflow / Test readiness for publishing provider (pull_request) Successful in 37m30s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #54
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-02-13 08:15:21 +00:00
Marcel S. Henselin
459120d3b3
fix: sqlserver return values mapping (#53)
All checks were successful
Publish / Check GoReleaser config (push) Successful in 11s
Publish / Publish provider (push) Successful in 30m7s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #53
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-02-12 15:14:53 +00:00
Marcel S. Henselin
82c654f3ba
fix: publisher - create versions file correctly (#52)
All checks were successful
Publish / Check GoReleaser config (push) Successful in 16s
Publish / Publish provider (push) Successful in 43m11s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #52
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-02-12 12:03:14 +00:00
Marcel S. Henselin
0c9ecfc670
fix: sqlserver beta fixes (#51)
All checks were successful
Publish / Check GoReleaser config (push) Successful in 11s
Publish / Publish provider (push) Successful in 48m24s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #51
Reviewed-by: Andre_Harms <andre.harms@stackit.cloud>
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-02-12 11:42:37 +00:00
131e1700bb
fix: change identity handling for user & database (#50)
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #50
Reviewed-by: Marcel_Henselin <marcel.henselin@stackit.cloud>
Co-authored-by: Andre Harms <andre.harms@stackit.cloud>
Co-committed-by: Andre Harms <andre.harms@stackit.cloud>
2026-02-11 15:39:20 +00:00
Marcel S. Henselin
86fc98461c
chore: add sqlserveralpha tests (#49)
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #49
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-02-11 15:21:57 +00:00
Marcel S. Henselin
ed7ff0f58e
chore: add tests (#48)
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #48
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-02-11 14:20:41 +00:00
Marcel S. Henselin
f2bffa9ece
chore: add_protocol (#47)
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #47
Reviewed-by: Andre_Harms <andre.harms@stackit.cloud>
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-02-11 09:07:38 +00:00
399e8ccb0c
feat: update sql server flex configuration for user and database (#46)
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #46
Reviewed-by: Marcel_Henselin <marcel.henselin@stackit.cloud>
Co-authored-by: Andre Harms <andre.harms@stackit.cloud>
Co-committed-by: Andre Harms <andre.harms@stackit.cloud>
2026-02-11 09:03:31 +00:00
Marcel S. Henselin
e21fe64326
feat: add_testing (#45)
All checks were successful
Publish / Check GoReleaser config (push) Successful in 13s
Publish / Publish provider (push) Successful in 23m29s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #45
Reviewed-by: Andre_Harms <andre.harms@stackit.cloud>
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-02-10 16:46:21 +00:00
4991897eca
fix: fix mapping tests (#44)
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #44
Reviewed-by: Marcel_Henselin <marcel.henselin@stackit.cloud>
Co-authored-by: Andre Harms <andre.harms@stackit.cloud>
Co-committed-by: Andre Harms <andre.harms@stackit.cloud>
2026-02-10 16:06:10 +00:00
Marcel_Henselin
b737875c68
fix: fix README.md (#42)
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #42
Reviewed-by: Andre_Harms <andre.harms@stackit.cloud>
2026-02-10 13:32:15 +00:00
marcel.henselin
9dbf36dd35
chore: activate darwin and windows builds (#43)
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #43
Co-authored-by: marcel.henselin <marcel.henselin@stackit.cloud>
Co-committed-by: marcel.henselin <marcel.henselin@stackit.cloud>
2026-02-10 13:31:42 +00:00
Marcel S. Henselin
00a43dfb4c
fix: fix wrong identity handling in Read (#41)
All checks were successful
Publish / Check GoReleaser config (push) Successful in 12s
Publish / Publish provider (push) Successful in 7m54s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #41
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-02-10 12:25:19 +00:00
Marcel S. Henselin
b63526b065
chore: regenerate gen files (#40)
All checks were successful
Publish / Check GoReleaser config (push) Successful in 13s
Publish / Publish provider (push) Successful in 19m5s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #40
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-02-10 09:56:54 +00:00
Marcel S. Henselin
68e4c137f1
fix: fix build pipeline error (#38)
Some checks failed
Publish / Check GoReleaser config (push) Successful in 5s
Publish / Publish provider (push) Failing after 4m1s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #38
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-02-10 09:32:06 +00:00
Marcel_Henselin
6e23dab949
feat: create docs upload pipeline (#37)
Some checks failed
Publish / Check GoReleaser config (push) Successful in 14s
Publish / Publish provider (push) Failing after 15m24s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #37
Reviewed-by: Andre_Harms <andre.harms@stackit.cloud>
2026-02-10 08:21:01 +00:00
de019908d2
chore: changed and refactored providers (#36)
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Reviewed-on: #36
Reviewed-by: Marcel_Henselin <marcel.henselin@stackit.cloud>
Co-authored-by: Andre Harms <andre.harms@stackit.cloud>
Co-committed-by: Andre Harms <andre.harms@stackit.cloud>
2026-02-10 08:10:02 +00:00
Marcel S. Henselin
b1b359f436
feat: refactor testing (#35)
Some checks failed
Publish / Check GoReleaser config (push) Successful in 5s
Publish / Publish provider (push) Failing after 3m54s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #35
Reviewed-by: Andre_Harms <andre.harms@stackit.cloud>
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-02-09 07:28:01 +00:00
Marcel S. Henselin
32e41d8b44
feat: testing (#34)
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #34
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-02-06 09:57:51 +00:00
Marcel S. Henselin
c22e758b2c
fix: sqlserver_beta (#33)
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #33
Reviewed-by: Andre_Harms <andre.harms@stackit.cloud>
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-02-05 15:11:41 +00:00
Marcel S. Henselin
581e45eb9c
feat: SQL server beta and templates refactoring (#32)
Some checks failed
Publish / Check GoReleaser config (push) Successful in 5s
Publish / Publish provider (push) Failing after 4m6s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #32
Reviewed-by: Andre_Harms <andre.harms@stackit.cloud>
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-02-05 09:55:32 +00:00
Marcel_Henselin
4549ba63e5
fix: refactor sqlserver to handle encryption correctly (#31)
All checks were successful
Publish / Check GoReleaser config (push) Successful in 6s
Publish / Publish provider (push) Successful in 6m59s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #31
Reviewed-by: Andre_Harms <andre.harms@stackit.cloud>
2026-02-04 07:30:00 +00:00
marcel.henselin
80d1d12278
fix: add missing folder creation in pipeline (#30)
All checks were successful
Publish / Check GoReleaser config (push) Successful in 13s
Publish / Publish provider (push) Successful in 11m17s
Signed-off-by: marcel.henselin <marcel.henselin@stackit.cloud>

## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #30
Co-authored-by: marcel.henselin <marcel.henselin@stackit.cloud>
Co-committed-by: marcel.henselin <marcel.henselin@stackit.cloud>
2026-02-03 15:22:31 +00:00
marcel.henselin
5e9051fb89
fix: update publish pipeline (#29)
Some checks failed
Publish / Check GoReleaser config (push) Successful in 11s
Publish / Publish provider (push) Failing after 8m47s
need to create a folder upfront

Signed-off-by: marcel.henselin <marcel.henselin@stackit.cloud>

## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #29
Co-authored-by: marcel.henselin <marcel.henselin@stackit.cloud>
Co-committed-by: marcel.henselin <marcel.henselin@stackit.cloud>
2026-02-03 15:05:34 +00:00
Marcel_Henselin
e7176b2eef
Merge pull request 'fix: spec files in subfolders and refactored builder' (#28) from fix/cmd_refactor_subfolders_and-version into alpha
Some checks failed
Publish / Check GoReleaser config (push) Successful in 6s
Publish / Publish provider (push) Failing after 4m8s
Reviewed-on: #28
Reviewed-by: Andre_Harms <andre.harms@stackit.cloud>
2026-02-03 08:27:22 +00:00
Marcel S. Henselin
2c0e8e874e fix: spec files in subfolders and refactored builder
Some checks failed
CI Workflow / Check GoReleaser config (pull_request) Successful in 6s
CI Workflow / Test readiness for publishing provider (pull_request) Failing after 6m6s
CI Workflow / CI (pull_request) Failing after 6m26s
CI Workflow / Code coverage report (pull_request) Has been skipped
2026-02-03 09:25:43 +01:00
Marcel S. Henselin
3dbf79c95f
fix: refactor sqlserver handle optional encryption (#27)
All checks were successful
Publish / Check GoReleaser config (push) Successful in 12s
Publish / Publish provider (push) Successful in 17m14s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #27
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-02-02 10:52:21 +00:00
Marcel S. Henselin
a5a388f238
chore: refactor import urls after repo move (#26)
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #26
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-02-02 10:01:27 +00:00
Marcel S. Henselin
cd390b1dfc
fix: fix publisher is creating wrong urls (#25)
All checks were successful
Publish / Check GoReleaser config (push) Successful in 12s
Publish / Publish provider (push) Successful in 6m44s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #25
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-01-30 15:35:32 +00:00
Marcel S. Henselin
9242a9526c
fix: fix publisher (#24)
All checks were successful
Publish / Check GoReleaser config (push) Successful in 9s
Publish / Publish provider (push) Successful in 6m44s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #24
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-01-30 15:05:56 +00:00
Marcel_Henselin
760bcfd658
fix: fix releaser (#23)
Some checks failed
Publish / Check GoReleaser config (push) Successful in 13s
Publish / Publish provider (push) Failing after 28m53s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #23
2026-01-30 14:28:48 +00:00
Marcel S. Henselin
024534da5f
fix: fix releaser to use correct string format in gpg strings (#22)
All checks were successful
Publish / Check GoReleaser config (push) Successful in 9s
Publish / Publish provider (push) Successful in 17m45s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #22
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-01-30 13:50:39 +00:00
Marcel_Henselin
4e479a365b
fix: fix ci pipeline (#21)
All checks were successful
Publish / Check GoReleaser config (push) Successful in 6s
Publish / Publish provider (push) Successful in 6m46s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #21
2026-01-30 13:33:50 +00:00
Marcel S. Henselin
50184f4478
fix: fix releaser to be able to replace a version (#20)
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #20
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-01-30 13:32:42 +00:00
Marcel S. Henselin
8532f09ce2
fix: fix pipelines to quote string (#19)
All checks were successful
Publish / Check GoReleaser config (push) Successful in 23s
Publish / Publish provider (push) Successful in 11m13s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #19
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-01-30 13:12:05 +00:00
Marcel S. Henselin
ee89243b3a
fix: pipeline_fixes (#18)
All checks were successful
Publish / Check GoReleaser config (push) Successful in 9s
Publish / Publish provider (push) Successful in 6m39s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #18
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-01-30 12:48:20 +00:00
Marcel S. Henselin
70f7492043
fix: deactivate release pipeline (#17)
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #17
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-01-30 11:08:35 +00:00
Marcel_Henselin
4153035eae
fix: pgsql_api_updates (#16)
Some checks failed
Publish / Check GoReleaser config (push) Successful in 4s
Release / goreleaser (push) Failing after 23s
Publish / Publish provider (push) Failing after 6m29s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #16
2026-01-30 10:59:24 +00:00
Marcel S. Henselin
f3d66c7569
fix: refactor postgres genereated files (#15)
Some checks failed
Publish / Check GoReleaser config (push) Successful in 4s
Release / goreleaser (push) Failing after 28s
Publish / Publish provider (push) Failing after 6m28s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #15
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-01-30 10:37:50 +00:00
Marcel S. Henselin
a9df5b0ff5
fix: refactor publish command (#14)
Some checks failed
Publish / Check GoReleaser config (push) Successful in 5s
Release / goreleaser (push) Failing after 27s
Publish / Publish provider (push) Failing after 4m4s
feat: add connection info

fix: prevent postgresql from failing when encryption is empty

## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #14
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-01-30 10:15:49 +00:00
Marcel S. Henselin
5ec2ab8c67
fix: refactor publish pipeline (#13)
Some checks failed
Publish / Check GoReleaser config (push) Successful in 5s
Release / goreleaser (push) Failing after 24s
Publish / Publish provider (push) Successful in 6m38s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #13
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-01-29 17:09:46 +00:00
Marcel S. Henselin
bb54206ba9
fix: refactor publish command (#12)
Some checks failed
Publish / Check GoReleaser config (push) Successful in 5s
Release / goreleaser (push) Failing after 26s
Publish / Publish provider (push) Successful in 6m49s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #12
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-01-29 16:48:31 +00:00
Marcel S. Henselin
7fe135f337
fix: refactor publish command (#11)
Some checks failed
Publish / Check GoReleaser config (push) Successful in 6s
Release / goreleaser (push) Failing after 28s
Publish / Publish provider (push) Successful in 6m50s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #11
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-01-29 16:22:18 +00:00
Marcel S. Henselin
0a21d9f0f2
fix: refactor package generation (#10)
Some checks failed
Publish / Check GoReleaser config (push) Successful in 5s
Release / goreleaser (push) Failing after 27s
Publish / Publish provider (push) Failing after 6m43s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #10
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-01-29 16:00:09 +00:00
Marcel S. Henselin
37ba538a8e
fix: refactor pipeline (#9)
Some checks failed
Publish / Check GoReleaser config (push) Successful in 6s
Release / goreleaser (push) Failing after 26s
Publish / Publish provider (push) Failing after 3m57s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #9
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-01-29 15:23:59 +00:00
Marcel S. Henselin
f986d919da
fix: pipeline_fix (#8)
Some checks failed
Publish / Check GoReleaser config (push) Successful in 5s
Release / goreleaser (push) Failing after 27s
Publish / Publish provider (push) Failing after 6m51s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #8
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-01-29 15:14:17 +00:00
Marcel S. Henselin
5e303ba8dd
fix: do not use SNAPSHOT on push tags (#6)
chore: disable some platforms for now

## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #6
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-01-29 15:04:42 +00:00
Marcel S. Henselin
3149537a4a
fix: need to create key file from secret (#5)
Some checks failed
Release / goreleaser (push) Failing after 26s
Publish / Check GoReleaser config (push) Successful in 6s
Publish / Publish provider (push) Failing after 12m45s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #5
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-01-29 14:30:13 +00:00
Marcel S. Henselin
9f41c4da7f
feat: auto generated files and new structure (#4)
Some checks failed
Publish / Check GoReleaser config (push) Successful in 4s
Release / goreleaser (push) Failing after 29s
Publish / Publish provider (push) Failing after 4m24s
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #4
Reviewed-by: Andre_Harms <andre.harms@stackit.cloud>
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-01-29 14:10:25 +00:00
979220be66
chore: adjust pagination for postgres database and flavor listing (#20)
* feat: implement pagination for database listing

* fix: change database_id attribute type from string to int64

* refactor: rename getDatabase to getDatabaseById for clarity

* fix: improve error handling for database not found scenario

* feat: add validation for database_id and name attributes; implement separate functions for fetching databases by ID and name

* feat: implement database client interface and update database fetching functions

* refactor: rename matcher to filter for clarity and update pagination logic

* feat: implement flavors retrieval with pagination and filtering support

* refactor: rename flavor import for consistency and clarity

* feat: add support for InstanceStatePending in wait handler logic

* refactor: simplify GetFlavorsRequest and GetFlavorsRequestExecute by removing pagination parameters

* refactor: improve readability of test cases by formatting function signatures and restructuring test runs

* refactor: remove pagination parameters from GetFlavorsRequest in test case

* refactor: simplify function signatures and improve readability in datasource and resource files

* refactor: add descriptions for user-related attributes in datasource schema

* refactor: enhance user resource schema with additional attributes and improve logging

* refactor: delete unused file

* refactor: standardize formatting and improve function naming for user resource management

* refactor: remove skip from TestMapFields and update roles initialization in resource tests

* fix: golangci lint issues

* fix: golangci lint issues again

* fix: golangci lint issues again
2026-01-16 16:23:10 +01:00
Marcel S. Henselin
0150fea302
Feat/separate functions (#19)
* chore: work save

* fix: refactor flavors

* fix: refactor pg user and database

* fix: refactor flavor parameters

* fix: refactor tf script

* chore: work save

* chore: work save

* chore: work save

---------

Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-01-13 12:19:12 +01:00
Marcel S. Henselin
910551f09d fix: fix tests 2025-12-30 17:14:37 +01:00
Marcel S. Henselin
e2f2cecdf7 fix: linting cleanup 2025-12-30 16:45:53 +01:00
Marcel S. Henselin
468841db57 fix: linting cleanup 2025-12-30 16:43:42 +01:00
Marcel S. Henselin
6b513231b3 fix: refactor wait tests 2025-12-30 16:38:16 +01:00
Marcel S. Henselin
b374a2b300 fix: add missing docs 2025-12-30 16:31:42 +01:00
Marcel S. Henselin
29f693308e fix: re-implement acl part in top level
feat: implement tf identity
2025-12-30 16:30:18 +01:00
Marcel S. Henselin
1027643f95 fix: remove obsolete field in test 2025-12-30 13:28:26 +01:00
Marcel S. Henselin
1c0ba50668 fix: add missing files 2025-12-30 13:24:08 +01:00
Marcel S. Henselin
9a18db49ad fix: add missing pagination to api client
fix: add missing docs
2025-12-30 11:50:36 +01:00
Marcel S. Henselin
7d66568003 fix: adjust tests to new api version with acl in network segment 2025-12-30 08:04:53 +01:00
Marcel S. Henselin
318d2e0962 feat: work savenew api version with acl in network segment 2025-12-30 07:57:33 +01:00
Marcel S. Henselin
5cab4b79ee chore: work save 2025-12-30 07:43:57 +01:00
Marcel S. Henselin
81f422f944 fix: adjust linting in terraform files 2025-12-29 11:36:56 +01:00
Marcel S. Henselin
a5ff1146a0 fix: adjust linting in ci pipeline 2025-12-29 11:29:20 +01:00
Marcel S. Henselin
dac41ed65e fix: fixed missing error handlers 2025-12-29 11:21:28 +01:00
Marcel S. Henselin
8998ef0332 fix: fixed missing error handlers 2025-12-29 11:18:21 +01:00
Marcel S. Henselin
ff9f47edc3 fix: fixed some tests 2025-12-29 11:10:42 +01:00
Marcel S. Henselin
5b6576da1c
Fix/fix tests (#18)
* fix: fix and adjust tests to new api

* fix: add missing testdata file

* fix: add missing docs

* fix: ignore docs flow for now

* fix: fix  linting
2025-12-29 07:12:30 +01:00
Marcel S. Henselin
25fb4453f0
Feat/alpa postgres database (#15)
* chore: implement datasource

* chore: register datasource

---------

Co-authored-by: Andre Harms <andre.harms@stackit.cloud>
2025-12-23 11:38:05 +01:00
Marcel S. Henselin
126e22414d fix: refactor correct linter version 2025-12-22 17:09:22 +01:00
Marcel S. Henselin
3a24b9e930 fix: replace linting with GH action 2025-12-22 17:06:58 +01:00
Marcel S. Henselin
76b61859da fix: add missing functions 2025-12-22 17:02:38 +01:00
Marcel S. Henselin
b08b32ef1d fix: add psql datasource 2025-12-22 11:17:38 +01:00
Marcel S. Henselin
d01ae71b75 fix: int64 user_id and some more 2025-12-22 10:56:04 +01:00
Marcel S. Henselin
6aac685ed4
Feat/alpa postgres user (#14)
* chore: add stackit_postgresflexalpha_user resource

* chore: refactor postgresflex user resource to postgresflexalpha

* chore: refactor wait handlers and update API client interfaces for postgresflexalpha

* chore: add stackit_postgresflexalpha_user data source example

* fix: refactor sqlserverflexalpha user resource and enhance schema with status and default_database

---------

Co-authored-by: Andre Harms <andre.harms@stackit.cloud>
2025-12-22 10:02:25 +01:00
Marcel S. Henselin
f0414ab3b9
Feat/alpa sqlserver user (#13)
* fix: update API client references to use sqlserverflexalpha package

* chore: add stackit_sqlserverflexalpha_user resource and instance_id variable

* fix: refactor sqlserverflexalpha user resource and enhance schema with status and default_database

---------

Co-authored-by: Andre Harms <andre.harms@stackit.cloud>
2025-12-22 09:41:03 +01:00
Marcel S. Henselin
9e04ab2630
Fix: pgsql fix (#10)
* fix: remove license header from files

* fix: updated docs and sample
---------

Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2025-12-22 09:23:53 +01:00
Marcel S. Henselin
99f2853ae5
Feat: alpha sqlserver user (#12)
* fix: remove unused attribute types and functions from backup models

* fix: update API client references to use sqlserverflexalpha package

* fix: update package references to use sqlserverflexalpha and modify user data source model

* fix: add sqlserverflexalpha user data source to provider

* fix: add sqlserverflexalpha user resource and update related functionality

* chore: add stackit_sqlserverflexalpha_user resource and instance_id variable

* fix: refactor sqlserverflexalpha user resource and enhance schema with status and default_database

* chore: remove not needed service files

* chore: cleanup import in utils

* fix: provider name change

* fix: clone missing doc files

* fix: docs adjustments

* fix: docs CI scripts

* fix: docs naming

* fix: remove guides from docs

* fix: adjust examples

* fix: remove obsolete doc templates

* fix: docs adjustments

* fix: add missing doc file

* fix: temp rename file

---------

Co-authored-by: Andre Harms <andre.harms@stackit.cloud>
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2025-12-19 15:15:42 +01:00
Marcel S. Henselin
c9193e0237
Feat: alpha postgres user (#11)
* chore: add stackit_postgresflexalpha_user resource

* chore: refactor postgresflex user resource to postgresflexalpha

* chore: refactor wait handlers and update API client interfaces for postgresflexalpha

* chore: add stackit_postgresflexalpha_user data source example

---------

Co-authored-by: Andre Harms <andre.harms@stackit.cloud>
2025-12-19 15:07:44 +01:00
Marcel S. Henselin
944a75295f
Fix: fix imports and names (#9)
* fix: add missing entries and correct refs

* fix: add missing docs

---------

Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2025-12-19 12:34:16 +01:00
Marcel S. Henselin
db080dc89a
Feat/add sqlserver user (#8)
fix: correct wrong import

---------

Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2025-12-19 12:00:51 +01:00
Marcel S. Henselin
70db08f43f
Feat/mssql alpha instance (#7)
* chore: add missing resources

---------

Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2025-12-19 11:55:29 +01:00
Marcel S. Henselin
08afbcf574
fix: add missing entries (#6)
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2025-12-19 11:51:46 +01:00
Marcel S. Henselin
ce2f3fca00
Feat/alpa postgres user (#5)
* chore: add stackit_postgresflexalpha_user resource

* chore: refactor postgresflex user resource to postgresflexalpha

* chore: refactor wait handlers and update API client interfaces for postgresflexalpha

* chore: add stackit_postgresflexalpha_user data source example

---------

Co-authored-by: Andre Harms <andre.harms@stackit.cloud>
2025-12-19 11:48:21 +01:00
Marcel S. Henselin
75e003ae9a chore: update docs 2025-12-19 11:35:49 +01:00
Marcel S. Henselin
7de63b5b8e Merge branch 'main' into alpha
# Conflicts:
#	docs/data-sources/sqlserverflexalpha_user.md
#	docs/index.md
#	docs/resources/postgresflexalpha_instance.md
#	docs/resources/sqlserverflexalpha_user.md
#	examples/data-sources/stackitprivatepreview_postgresflexalpha_database/data-source.tf
#	examples/data-sources/stackitprivatepreview_postgresflexalpha_instance/data-source.tf
#	examples/data-sources/stackitprivatepreview_postgresflexalpha_user/data-source.tf
#	examples/data-sources/stackitprivatepreview_sqlserverflexalpha_instance/data-source.tf
#	examples/data-sources/stackitprivatepreview_sqlserverflexalpha_user/data-source.tf
#	examples/provider/provider.tf
#	examples/resources/stackitprivatepreview_postgresflexalpha_database/resource.tf
#	examples/resources/stackitprivatepreview_postgresflexalpha_instance/resource.tf
#	examples/resources/stackitprivatepreview_postgresflexalpha_user/resource.tf
#	examples/resources/stackitprivatepreview_sqlserverflexalpha_instance/resource.tf
#	examples/resources/stackitprivatepreview_sqlserverflexalpha_user/resource.tf
#	go.mod
#	go.sum
#	golang-ci.yaml
#	main.go
#	scripts/check-docs.sh
#	scripts/lint-golangci-lint.sh
#	scripts/project.sh
#	scripts/replace.sh
#	scripts/tfplugindocs.sh
#	stackit/internal/conversion/conversion.go
#	stackit/internal/conversion/conversion_test.go
#	stackit/internal/core/core.go
#	stackit/internal/core/core_test.go
#	stackit/internal/features/beta.go
#	stackit/internal/features/beta_test.go
#	stackit/internal/features/experiments.go
#	stackit/internal/features/experiments_test.go
#	stackit/internal/services/postgresflexalpha/database/datasource.go.bak
#	stackit/internal/services/postgresflexalpha/database/resource.go.bak
#	stackit/internal/services/postgresflexalpha/database/resource_test.go.bak
#	stackit/internal/services/postgresflexalpha/instance/datasource.go.bak
#	stackit/internal/services/postgresflexalpha/instance/resource.go
#	stackit/internal/services/postgresflexalpha/instance/use_state_for_unknown_if_flavor_unchanged_modifier.go
#	stackit/internal/services/postgresflexalpha/postgresflex_acc_test.go
#	stackit/internal/services/postgresflexalpha/user/datasource.go
#	stackit/internal/services/postgresflexalpha/user/datasource_test.go
#	stackit/internal/services/postgresflexalpha/user/resource.go
#	stackit/internal/services/postgresflexalpha/user/resource_test.go
#	stackit/internal/services/postgresflexalpha/utils/util.go
#	stackit/internal/services/postgresflexalpha/utils/util_test.go
#	stackit/internal/services/sqlserverflexalpha/instance/datasource.go
#	stackit/internal/services/sqlserverflexalpha/instance/resource.go
#	stackit/internal/services/sqlserverflexalpha/sqlserverflex_acc_test.go
#	stackit/internal/services/sqlserverflexalpha/testdata/resource-max.tf
#	stackit/internal/services/sqlserverflexalpha/testdata/resource-min.tf
#	stackit/internal/services/sqlserverflexalpha/user/datasource.go
#	stackit/internal/services/sqlserverflexalpha/user/resource.go
#	stackit/internal/services/sqlserverflexalpha/utils/util.go
#	stackit/internal/services/sqlserverflexalpha/utils/util_test.go
#	stackit/internal/testutil/testutil.go
#	stackit/internal/testutil/testutil_test.go
#	stackit/internal/utils/attributes.go
#	stackit/internal/utils/attributes_test.go
#	stackit/internal/utils/headers.go
#	stackit/internal/utils/headers_test.go
#	stackit/internal/utils/regions.go
#	stackit/internal/utils/regions_test.go
#	stackit/internal/utils/use_state_for_unknown_if.go
#	stackit/internal/utils/use_state_for_unknown_if_test.go
#	stackit/internal/utils/utils.go
#	stackit/internal/utils/utils_test.go
#	stackit/internal/validate/validate.go
#	stackit/internal/validate/validate_test.go
#	stackit/provider.go
#	stackit/provider_acc_test.go
#	stackit/testdata/provider-all-attributes.tf
#	stackit/testdata/provider-credentials.tf
#	stackit/testdata/provider-invalid-attribute.tf
2025-12-19 11:33:29 +01:00
Marcel S. Henselin
feef0b61d6 chore: fixing tests 2025-12-19 09:49:19 +01:00
Marcel S. Henselin
a861661036 feat: add sqlserver instance 2025-12-19 09:05:48 +01:00
Marcel S. Henselin
5381516661
feat: mssql alpha instance (#2)
* fix: remove unused attribute types and functions from backup models

* fix: update API client references to use sqlserverflexalpha package

* fix: update package references to use sqlserverflexalpha and modify user data source model

* fix: add sqlserverflexalpha user data source to provider

* fix: add sqlserverflexalpha user resource and update related functionality

* chore: add stackit_sqlserverflexalpha_user resource and instance_id variable

* fix: refactor sqlserverflexalpha user resource and enhance schema with status and default_database

---------

Co-authored-by: Andre Harms <andre.harms@stackit.cloud>
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2025-12-19 08:56:46 +01:00
Marcel S. Henselin
df25ceffd4 chore: cleanup alpha branch 2025-12-17 16:14:25 +01:00
Marcel S. Henselin
c07c81b091
Merge branch 'stackitcloud:main' into alpha 2025-12-17 16:09:23 +01:00
Marcel S. Henselin
3b07f3f1d3 chore: add missing folders 2025-12-11 11:15:54 +01:00
Marcel S. Henselin
48b1c99ede chore: add missing wait folder 2025-12-11 11:04:44 +01:00
Marcel S. Henselin
30070d8470 chore: initial push to be able to work together 2025-12-11 09:59:41 +01:00
132 changed files with 6038 additions and 3947 deletions

View file

@ -2,14 +2,19 @@ name: Acceptance Testing
description: "Acceptance Testing pipeline" description: "Acceptance Testing pipeline"
inputs: inputs:
tf_debug:
description: "enable terraform debug logs"
default: 'false'
required: true
test_timeout_string: test_timeout_string:
description: "string that determines the timeout (default: 45m)" description: "string that determines the timeout (default: 45m)"
default: '45m' default: '90m'
required: true required: true
go-version: go-version:
description: "go version to install" description: "go version to install"
default: '1.25' default: '1.26'
required: true required: true
project_id: project_id:
@ -60,20 +65,18 @@ inputs:
description: "testfile to run" description: "testfile to run"
default: '' default: ''
outputs:
result:
value: ${{ steps.testrun.outputs.result }}
description: "the output of the tests"
#outputs: status:
# random-number: value: ${{ steps.status.outputs.status }}
# description: "Random number" description: "the status of the tests"
# value: ${{ steps.random-number-generator.outputs.random-number }}
runs: runs:
using: "composite" using: "composite"
steps: steps:
# - name: Random Number Generator
# id: random-number-generator
# run: echo "random-number=$(echo $RANDOM)" >> $GITHUB_OUTPUT
# shell: bash
- name: Install needed tools - name: Install needed tools
shell: bash shell: bash
run: | run: |
@ -89,6 +92,15 @@ runs:
fi fi
echo "::endgroup::" echo "::endgroup::"
# Install latest version of Terraform
- uses: hashicorp/setup-terraform@v4
with:
terraform_wrapper: false
- uses: actions/setup-node@v6
with:
node-version: '24.x'
- name: Setup JAVA - name: Setup JAVA
uses: actions/setup-java@v5 uses: actions/setup-java@v5
with: with:
@ -141,6 +153,12 @@ runs:
${{ steps.goenv.outputs.gomodcache }} ${{ steps.goenv.outputs.gomodcache }}
key: ${{ runner.os }}-gopkg key: ${{ runner.os }}-gopkg
- name: Define service account file path variable
id: service_account
shell: bash
run: |
echo "safilepath=${PWD}/stackit/${{ inputs.service_account_json_file_path }}" >> "$GITHUB_OUTPUT"
- name: Creating service_account file from json input - name: Creating service_account file from json input
if: inputs.service_account_json_content != '' if: inputs.service_account_json_content != ''
shell: bash shell: bash
@ -185,61 +203,35 @@ runs:
ls -l stackit/"${{ inputs.service_account_json_file_path }}" ls -l stackit/"${{ inputs.service_account_json_file_path }}"
echo "::endgroup::" echo "::endgroup::"
- name: Run acceptance test file
if: ${{ inputs.test_file != '' }}
shell: bash
run: |
echo "::group::go test file"
set -e
set -o pipefail
echo "Running acceptance tests for the terraform provider"
cd stackit || exit 1
TF_ACC=1 \
TF_ACC_PROJECT_ID=${TF_ACC_PROJECT_ID} \
TF_ACC_REGION=${TF_ACC_REGION} \
TF_ACC_TEST_PROJECT_USER_EMAIL=${TF_ACC_TEST_PROJECT_USER_EMAIL} \
TF_ACC_SERVICE_ACCOUNT_FILE="${PWD}/${{ inputs.service_account_json_file_path }}" \
TF_ACC_KEK_KEY_ID=${TF_ACC_KEK_KEY_ID} \
TF_ACC_KEK_KEY_RING_ID=${TF_ACC_KEK_KEY_RING_ID} \
TF_ACC_KEK_KEY_VERSION=${TF_ACC_KEK_KEY_VERSION} \
TF_ACC_KEK_SERVICE_ACCOUNT=${TF_ACC_KEK_SERVICE_ACCOUNT} \
go test ${{ inputs.test_file }} -count=1 -timeout=${{ inputs.test_timeout_string }}
echo "::endgroup::"
env:
TF_ACC_PROJECT_ID: ${{ inputs.project_id }}
TF_ACC_REGION: ${{ inputs.region }}
TF_ACC_TEST_PROJECT_USER_EMAIL: ${{ inputs.project_user_email }}
TF_ACC_KEK_KEY_ID: ${{ inputs.tf_acc_kek_key_id }}
TF_ACC_KEK_KEY_RING_ID: ${{ inputs.tf_acc_kek_key_ring_id }}
TF_ACC_KEK_KEY_VERSION: ${{ inputs.tf_acc_kek_key_version }}
TF_ACC_KEK_SERVICE_ACCOUNT: ${{ inputs.tf_acc_kek_service_account }}
# - name: Run test action
# if: ${{ inputs.test_file == '' }}
# env:
# TF_ACC: 1
# TF_ACC_PROJECT_ID: ${{ inputs.project_id }}
# TF_ACC_REGION: ${{ inputs.region }}
# TF_ACC_TEST_PROJECT_USER_EMAIL: ${{ inputs.project_user_email }}
# TF_ACC_KEK_KEY_ID: ${{ inputs.tf_acc_kek_key_id }}
# TF_ACC_KEK_KEY_RING_ID: ${{ inputs.tf_acc_kek_key_ring_id }}
# TF_ACC_KEK_KEY_VERSION: ${{ inputs.tf_acc_kek_key_version }}
# TF_ACC_KEK_SERVICE_ACCOUNT: ${{ inputs.tf_acc_kek_service_account }}
# TF_ACC_SERVICE_ACCOUNT_FILE: "${PWD}/${{ inputs.service_account_json_file_path }}"
# uses: robherley/go-test-action@v0.1.0
# with:
# testArguments: "./... -timeout 45m"
- name: Run acceptance tests - name: Run acceptance tests
if: ${{ inputs.test_file == '' }} id: testrun
shell: bash shell: bash
run: | run: |
echo "::group::go test all" echo "::group::go test"
set -e set -e
set -o pipefail set -o pipefail
if [[ "${{ inputs.tf_debug }}" == "true" ]]; then
TF_LOG=INFO
export TF_LOG
fi
testfile="${{ inputs.test_file }}"
echo "result=no result before run" >> "$GITHUB_OUTPUT"
echo "Running acceptance tests for the terraform provider" echo "Running acceptance tests for the terraform provider"
if [[ -z "$testfile" ]]; then
testfile="./..."
fi
if [[ -z "$testfile" ]]; then
echo "ERROR: No test file provided"
exit 1
fi
set +e
cd stackit || exit 1 cd stackit || exit 1
TF_ACC=1 \ TF_ACC=1 \
TF_ACC_PROJECT_ID=${TF_ACC_PROJECT_ID} \ TF_ACC_PROJECT_ID=${TF_ACC_PROJECT_ID} \
@ -250,7 +242,21 @@ runs:
TF_ACC_KEK_KEY_RING_ID=${TF_ACC_KEK_KEY_RING_ID} \ TF_ACC_KEK_KEY_RING_ID=${TF_ACC_KEK_KEY_RING_ID} \
TF_ACC_KEK_KEY_VERSION=${TF_ACC_KEK_KEY_VERSION} \ TF_ACC_KEK_KEY_VERSION=${TF_ACC_KEK_KEY_VERSION} \
TF_ACC_KEK_SERVICE_ACCOUNT=${TF_ACC_KEK_SERVICE_ACCOUNT} \ TF_ACC_KEK_SERVICE_ACCOUNT=${TF_ACC_KEK_SERVICE_ACCOUNT} \
go test ./... -count=1 -timeout=${{ inputs.test_timeout_string }} go test -v ${testfile} -timeout=${{ inputs.test_timeout_string }} | tee -a acc_test_run.log
set -e
have_fail=$(cat acc_test_run.log | grep FAIL)
if [[ -n $have_fail ]]; then
echo "::endgroup::"
echo "::group::go test result"
echo "Test failed, see acc_test_run.log for details"
echo "${have_fail}"
echo "result=<b>FAIL:</b> <br />${have_fail}" >> "$GITHUB_OUTPUT"
echo "::endgroup::"
exit 1
fi
echo "result=no FAIL detected" >> "$GITHUB_OUTPUT"
echo "::endgroup::" echo "::endgroup::"
env: env:
TF_ACC_PROJECT_ID: ${{ inputs.project_id }} TF_ACC_PROJECT_ID: ${{ inputs.project_id }}
@ -260,3 +266,17 @@ runs:
TF_ACC_KEK_KEY_RING_ID: ${{ inputs.tf_acc_kek_key_ring_id }} TF_ACC_KEK_KEY_RING_ID: ${{ inputs.tf_acc_kek_key_ring_id }}
TF_ACC_KEK_KEY_VERSION: ${{ inputs.tf_acc_kek_key_version }} TF_ACC_KEK_KEY_VERSION: ${{ inputs.tf_acc_kek_key_version }}
TF_ACC_KEK_SERVICE_ACCOUNT: ${{ inputs.tf_acc_kek_service_account }} TF_ACC_KEK_SERVICE_ACCOUNT: ${{ inputs.tf_acc_kek_service_account }}
- name: Set status output variable
if: always()
id: status
shell: bash
run: |
echo "status=${{ steps.testrun.outcome == 'success' && 'SUCCESS' || 'FAILURE' }}" >> "$GITHUB_OUTPUT"
- name: Upload test log artifact
if: always()
uses: actions/upload-artifact@v3
with:
name: acc_test.log
path: "stackit/acc_test_run.log"

View file

@ -3,7 +3,7 @@ description: "Build pipeline"
inputs: inputs:
go-version: go-version:
description: "Go version to install" description: "Go version to install"
default: '1.25' default: '1.26'
required: true required: true
java-distribution: java-distribution:
description: "JAVA distribution to use (default: temurin)" description: "JAVA distribution to use (default: temurin)"

1
.github/actions/clean_up/README.md vendored Normal file
View file

@ -0,0 +1 @@
# acceptance test action

227
.github/actions/clean_up/action.yaml vendored Normal file
View file

@ -0,0 +1,227 @@
name: CleanUp Project Resources
description: "Acceptance Testing CleanUp"
inputs:
project_id:
description: "STACKIT project ID for tests"
required: true
region:
description: "STACKIT region for tests"
default: 'eu01'
required: true
tf_resource_prefix:
description: "prefix in resource names"
default: 'tf-acc-'
required: true
service_account_json_content:
description: "STACKIT service account JSON file contents"
required: true
default: ''
service_account_json_content_b64:
description: "STACKIT service account JSON file contents"
required: true
default: ''
list_only:
description: "only list resources, DO NOT delete"
required: true
default: 'true'
log_level:
description: "Log Level"
required: true
default: 'warning'
outputs:
cli-version:
description: "stackit cli version"
value: ${{ steps.stackit_version.outputs.version }}
pre_count:
description: "number of resources found"
value: ${{ steps.retrieve_pre.outputs.count }}
post_count:
description: "number of resources found"
value: ${{ steps.retrieve_post.outputs.count }}
status:
description: "status of the test"
value: ${{ steps.status.outputs.status }}
runs:
using: "composite"
steps:
- name: Install needed tools
shell: bash
run: |
echo "::group::apt install"
set -e
apt-get -y -qq update >apt_update.log 2>apt_update_err.log
if [ $? -ne 0 ]; then
cat apt_update.log apt_update_err.log
fi
apt-get -y -qq install curl gnupg jq >apt_get.log 2>apt_get_err.log
if [ $? -ne 0 ]; then
cat apt_get.log apt_get_err.log
fi
echo "::endgroup::"
echo "::group::apt add source"
curl https://packages.stackit.cloud/keys/key.gpg | gpg --dearmor -o /usr/share/keyrings/stackit.gpg
echo "deb [signed-by=/usr/share/keyrings/stackit.gpg] https://packages.stackit.cloud/apt/cli stackit main" | tee -a /etc/apt/sources.list.d/stackit.list
echo "::endgroup::"
echo "::group::apt install stackit cli"
apt-get -y -qq update >apt_update.log 2>apt_update_err.log
if [ $? -ne 0 ]; then
cat apt_update.log apt_update_err.log
fi
apt-get -y -qq install stackit >apt_get.log 2>apt_get_err.log
if [ $? -ne 0 ]; then
cat apt_get.log apt_get_err.log
fi
echo "::endgroup::"
- name: Check stackit cli version
id: stackit_version
run: |
set -e
VERSION=$(stackit --version | grep "Version:" | cut -d " " -f 2)
echo "stackit cli version: ${VERSION}"
echo "version=${VERSION}" >> $GITHUB_OUTPUT
shell: bash
- name: Creating service_account file from json input
if: inputs.service_account_json_content != ''
shell: bash
run: |
echo "::group::create service account file"
set -e
set -o pipefail
echo "${{ inputs.service_account_json_content }}" > .svc_acc.json
echo "::endgroup::"
- name: Creating service_account file from base64 json input
if: inputs.service_account_json_content_b64 != ''
shell: bash
run: |
echo "::group::create service account file"
set -e
set -o pipefail
echo "${{ inputs.service_account_json_content_b64 }}" | base64 -d > .svc_acc.json
echo "::endgroup::"
- name: Check service account file exists
shell: bash
run: |
set -e
if [[ ! -s .svc_acc.json ]]; then
echo "ERROR: service account file missing or empty"
exit 1
fi
- name: Retrieve resources before
id: retrieve_pre
run: |
echo "::group::retrieve resources"
set -e
echo "authenticating api"
STACKIT_SERVICE_ACCOUNT_KEY_PATH="${PWD}/.svc_acc.json"
export STACKIT_SERVICE_ACCOUNT_KEY_PATH
stackit auth activate-service-account --service-account-key-path .svc_acc.json
echo "SQL Server Flex resources:"
sql_res=$(stackit --verbosity ${{ inputs.log_level }} --project-id "${{ inputs.project_id }}" beta sqlserverflex instance list --output-format json | jq -r '.[] | select(.name | startswith("${{ inputs.tf_resource_prefix }}"))')
sql_count=$(echo "$sql_res" | jq -r '.id' | wc -l)
echo "PostgreSQL Flex resources:"
pg_res=$(stackit --verbosity ${{ inputs.log_level }} --project-id "${{ inputs.project_id }}" postgresflex instance list --output-format json | jq -r '.[] | select(.name | startswith("${{ inputs.tf_resource_prefix }}"))')
pg_count=$(echo "$pg_res" | jq -r '.id' | wc -l)
echo "Number of resources found: ${sql_count} SQL Server Flex, ${pg_count} PostgreSQL Flex"
echo "count=$(( ${pg_count} + ${sql_count} ))" >> $GITHUB_OUTPUT
echo "::endgroup::"
shell: bash
- name: Delete SQL Server Flex resources
if: ${{ inputs.list_only != 'true' }}
id: del_sql
run: |
echo "::group::delete SQL Server Flex resources"
stackit --verbosity ${{ inputs.log_level }} auth activate-service-account --service-account-key-path .svc_acc.json
for s in $(stackit --verbosity ${{ inputs.log_level }} --project-id ${{ inputs.project_id }} beta sqlserverflex instance list --output-format json | jq -r '.[] | select(.name | startswith("${{ inputs.tf_resource_prefix }}")) | .id');
do
stackit --verbosity ${{ inputs.log_level }} -y --project-id ${{ inputs.project_id }} beta sqlserverflex instance delete $s || echo "status=FAILURE" >> ${GITHUB_OUTPUT};
done
echo "::endgroup::"
shell: bash
- name: Skip Delete SQL Server Flex resources
if: ${{ inputs.list_only == 'true' }}
run: |
set -e
echo "Skip deleting: list only mode"
shell: bash
- name: Delete PostgreSQL Flex resources
if: ${{ inputs.list_only != 'true' }}
id: del_pg
run: |
echo "::group::delete PostgreSQL Flex resources"
stackit auth activate-service-account --service-account-key-path .svc_acc.json
for s in $(stackit --verbosity ${{ inputs.log_level }} --project-id ${{ inputs.project_id }} postgresflex instance list --output-format json | jq -r '.[] | select(.name | startswith("${{ inputs.tf_resource_prefix }}")) | .id');
do
stackit --verbosity ${{ inputs.log_level }} -y --project-id ${{ inputs.project_id }} postgresflex instance delete "$s" --force || echo "status=FAILURE" >> ${GITHUB_OUTPUT};
done
echo "::endgroup::"
shell: bash
- name: Skip Delete PostgreSQL Flex resources
if: ${{ inputs.list_only == 'true' }}
run: |
set -e
echo "Skip deleting: list only mode"
shell: bash
- name: Retrieve resources after
id: retrieve_post
run: |
echo "::group::retrieve resources"
set -e
echo "authenticating api"
STACKIT_SERVICE_ACCOUNT_KEY_PATH="${PWD}/.svc_acc.json"
export STACKIT_SERVICE_ACCOUNT_KEY_PATH
stackit auth activate-service-account --service-account-key-path .svc_acc.json
echo "SQL Server Flex resources:"
sql_res=$(stackit --verbosity ${{ inputs.log_level }} --project-id "${{ inputs.project_id }}" beta sqlserverflex instance list --output-format json | jq -r '.[] | select(.name | startswith("${{ inputs.tf_resource_prefix }}"))')
sql_count=$(echo "$sql_res" | jq -r '.id' | wc -l)
echo "PostgreSQL Flex resources:"
pg_res=$(stackit --verbosity ${{ inputs.log_level }} --project-id "${{ inputs.project_id }}" postgresflex instance list --output-format json | jq -r '.[] | select(.name | startswith("${{ inputs.tf_resource_prefix }}"))')
pg_count=$(echo "$pg_res" | jq -r '.id' | wc -l)
echo "Number of resources found: ${sql_count} SQL Server Flex, ${pg_count} PostgreSQL Flex"
echo "count=$(( ${pg_count} + ${sql_count} ))" >> $GITHUB_OUTPUT
echo "::endgroup::"
shell: bash
- name: Set status
if: always()
id: status
run: |
status="SUCCESS"
if [[ "${{ steps.del_pg.outputs.status }}" == "FAILURE" ]]; then
status=FAILURE"
elif [[ "${{ steps.del_sql.outputs.status }}" == "FAILURE" ]]; then
status=FAILURE"
fi
echo "status=$status" >> $GITHUB_OUTPUT
shell: bash

148
.github/actions/notify/action.yaml vendored Normal file
View file

@ -0,0 +1,148 @@
name: Send notification via Google Chat
description: "Sends a notification to a Google Chat room when a pull request is opened."
inputs:
webhook_url:
description: "The URL of the Google Chat webhook."
required: true
title:
description: "The title of the notification."
required: true
subtitle:
description: "The subtitle of the notification."
default: 'no subtitle provided'
image_slug:
description: "The slug of the image to be included in the notification."
default: 'git'
event_author:
description: "The author of the event."
default: 'unknown'
event_title:
description: "The title of the event."
required: true
event_body:
description: "The body of the event."
default: 'no body provided'
event_number:
description: "The number of the event."
default: 'no number provided'
event_url:
description: "The url of the event."
default: 'none'
status:
description: "The status of the event."
default: 'UNKNOWN'
runs:
using: "composite"
steps:
- name: Install prerequisites
shell: bash
run: |
echo "::group::apt install"
set -e
apt update
apt install -y curl jq
echo "::endgroup::"
- name: Determine status color
id: status
shell: bash
run: |
case "${{ inputs.status }}" in
SUCCESS)
STATUS_COLOR="006400/228b22"
ADD='{"decoratedText": {"startIcon": {"materialIcon": {"name": "check_circle"}},"text": "<b style=\"color: green;\">SUCCESS</b>"}},'
;;
FAILURE)
STATUS_COLOR="8b0000/dc143c"
ADD='{"decoratedText": {"startIcon": {"materialIcon": {"name": "stop_circle"}},"text": "<b style=\"color: red;\">FAILURE</b>"}},'
;;
*)
STATUS_COLOR="483d8b/6495ed"
ADD=''
;;
esac
echo "color=${STATUS_COLOR}" >> "$GITHUB_OUTPUT"
echo "status_add=${ADD}" >> "$GITHUB_OUTPUT"
- name: Notify via Google Chat Webhook
shell: bash
env:
WEBHOOK: ${{ inputs.webhook_url }}
run: |
set -e
PAYLOAD=$(jq -n -r \
--arg header "${{ inputs.title }}" \
--arg subtitle "${{ inputs.subtitle }}" \
--arg imgurl "https://cdn.simpleicons.org/${{ inputs.image_slug }}/${{ steps.status.outputs.color }}" \
--arg title "${{ inputs.event_title || 'no event title given' }}" \
--arg body "${{ inputs.event_body || 'no event body given' }}" \
--arg author "${{ inputs.event_author || 'no event author given' }}" \
--arg url "${{ inputs.event_url || github.repositoryUrl || github.server_url }}" \
'{ "cardsV2": [ { "cardId": "notify-${{ github.run_id }}", "card": {
"header": {
"title": "\($header)",
"subtitle": "\($subtitle)",
"imageUrl": "\($imgurl)",
"imageType": "SQUARE"
},
"sections": [
{
"header": "\($title)",
"collapsible": false,
"widgets": [
${{ steps.status.outputs.status_add }}
{
"decoratedText": {
"startIcon": {
"knownIcon": "PERSON"
},
"text": "<b>\($author)</b>"
}
},
{
"textParagraph": {
"text": "\($body)",
"maxLines": 2
}
}
]
},
{
"widgets": [
{
"buttonList": {
"buttons": [
{
"text": "View Source Event",
"type": "FILLED",
"onClick": {
"openLink": {
"url": "\($url)"
}
}
}
]
}
}
]
}
]
}} ] }')
curl \
-X POST \
-H 'Content-Type: application/json' \
"${{ inputs.webhook_url }}&threadKey=run${{ github.run_id }}&messageReplyOption=REPLY_MESSAGE_FALLBACK_TO_NEW_THREAD" \
-d "${PAYLOAD}"

View file

@ -10,7 +10,7 @@ inputs:
go-version: go-version:
description: "go version to install" description: "go version to install"
default: '1.25' default: '1.26'
required: true required: true
runs: runs:

View file

@ -2,6 +2,7 @@ name: CI Workflow
on: on:
pull_request: pull_request:
types: [ opened, synchronize, reopened ]
branches: branches:
- alpha - alpha
- main - main
@ -27,11 +28,24 @@ jobs:
config: config:
if: ${{ github.event_name != 'schedule' }} if: ${{ github.event_name != 'schedule' }}
name: Check GoReleaser config name: Check GoReleaser config
runs-on: ubuntu-latest runs-on: stackit-docker
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v6
- name: Notify
if: always()
uses: ./.github/actions/notify
with:
webhook_url: ${{ secrets.GOOGLE_WEBHOOK_URL }}
title: "[START] CI pipeline (#${{ forgejo.run_number }})"
subtitle: "${{ forgejo.event_name }} on ${{ forgejo.ref_name }}"
event_title: "${{ forgejo.event_name }} for ${{ forgejo.repository }}"
event_author: ${{ forgejo.actor }}
event_body: "${{ forgejo.event_name }} on ${{ forgejo.ref }} for ${{ forgejo.repository }}"
event_number: ${{ forgejo.run_number }}
event_url: "https://tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/actions/runs/${{ forgejo.run_number }}"
- name: Check GoReleaser - name: Check GoReleaser
uses: goreleaser/goreleaser-action@v7 uses: goreleaser/goreleaser-action@v7
with: with:
@ -39,7 +53,7 @@ jobs:
prepare: prepare:
name: Prepare GO cache name: Prepare GO cache
runs-on: ubuntu-latest runs-on: stackit-docker
permissions: permissions:
actions: read # Required to identify workflow run. actions: read # Required to identify workflow run.
checks: write # Required to add status summary. checks: write # Required to add status summary.
@ -101,7 +115,7 @@ jobs:
needs: needs:
- config - config
- prepare - prepare
runs-on: ubuntu-latest runs-on: stackit-docker
permissions: permissions:
actions: read # Required to identify workflow run. actions: read # Required to identify workflow run.
checks: write # Required to add status summary. checks: write # Required to add status summary.
@ -184,7 +198,7 @@ jobs:
testing: testing:
name: CI run tests name: CI run tests
runs-on: ubuntu-latest runs-on: stackit-docker
needs: needs:
- config - config
- prepare - prepare
@ -218,11 +232,21 @@ jobs:
run: go mod tidy run: go mod tidy
- name: Testing - name: Testing
if: ${{ github.event_name != 'pull_request' }}
run: | run: |
unset TF_ACC
TF_ACC_SERVICE_ACCOUNT_FILE=~/.service_account.json TF_ACC_SERVICE_ACCOUNT_FILE=~/.service_account.json
export TF_ACC_SERVICE_ACCOUNT_FILE export TF_ACC_SERVICE_ACCOUNT_FILE
make test make test
- name: Testing with coverage
if: ${{ github.event_name == 'pull_request' }}
run: |
unset TF_ACC
TF_ACC_SERVICE_ACCOUNT_FILE=~/.service_account.json
export TF_ACC_SERVICE_ACCOUNT_FILE
make coverage
# - name: Acceptance Testing # - name: Acceptance Testing
# env: # env:
# TF_ACC: "1" # TF_ACC: "1"
@ -232,20 +256,20 @@ jobs:
# export TF_ACC_SERVICE_ACCOUNT_FILE # export TF_ACC_SERVICE_ACCOUNT_FILE
# make test-acceptance-tf # make test-acceptance-tf
- name: Run Test # - name: Run Acceptance Test
if: ${{ github.event_name == 'pull_request' }} # if: ${{ github.event_name == 'pull_request' }}
uses: ./.github/actions/acc_test # uses: ./.github/actions/acc_test
with: # with:
go-version: ${{ env.GO_VERSION }} # go-version: ${{ env.GO_VERSION }}
project_id: ${{ vars.TF_ACC_PROJECT_ID }} # project_id: ${{ vars.TF_ACC_PROJECT_ID }}
region: ${{ vars.TF_ACC_REGION }} # region: ${{ vars.TF_ACC_REGION }}
service_account_json_content_b64: "${{ secrets.TF_ACC_SERVICE_ACCOUNT_JSON_B64 }}" # service_account_json_content_b64: "${{ secrets.TF_ACC_SERVICE_ACCOUNT_JSON_B64 }}"
project_user_email: ${{ vars.TEST_PROJECT_USER_EMAIL }} # project_user_email: ${{ vars.TEST_PROJECT_USER_EMAIL }}
tf_acc_kek_key_id: ${{ vars.TF_ACC_KEK_KEY_ID }} # tf_acc_kek_key_id: ${{ vars.TF_ACC_KEK_KEY_ID }}
tf_acc_kek_key_ring_id: ${{ vars.TF_ACC_KEK_KEY_RING_ID }} # tf_acc_kek_key_ring_id: ${{ vars.TF_ACC_KEK_KEY_RING_ID }}
tf_acc_kek_key_version: ${{ vars.TF_ACC_KEK_KEY_VERSION }} # tf_acc_kek_key_version: ${{ vars.TF_ACC_KEK_KEY_VERSION }}
tf_acc_kek_service_account: ${{ vars.TF_ACC_KEK_SERVICE_ACCOUNT }} # tf_acc_kek_service_account: ${{ vars.TF_ACC_KEK_SERVICE_ACCOUNT }}
# service_account_json_file_path: "~/service_account.json" # # service_account_json_file_path: "~/service_account.json"
- name: Check coverage threshold - name: Check coverage threshold
shell: bash shell: bash
@ -267,7 +291,7 @@ jobs:
main: main:
if: ${{ github.event_name != 'schedule' }} if: ${{ github.event_name != 'schedule' }}
name: CI run build and linting name: CI run build and linting
runs-on: ubuntu-latest runs-on: stackit-docker
needs: needs:
- config - config
- prepare - prepare
@ -318,7 +342,7 @@ jobs:
code_coverage: code_coverage:
name: "Code coverage report" name: "Code coverage report"
if: github.event_name == 'pull_request' # Do not run when workflow is triggered by push to main branch if: github.event_name == 'pull_request' # Do not run when workflow is triggered by push to main branch
runs-on: ubuntu-latest runs-on: stackit-docker
needs: needs:
- main - main
- prepare - prepare

72
.github/workflows/clean_up.yaml vendored Normal file
View file

@ -0,0 +1,72 @@
name: TF Acceptance Test CleanUp
on:
workflow_dispatch:
inputs:
list_only:
description: "only list resources"
type: boolean
default: true
required: true
res_prefix:
description: "resource name prefix"
type: string
default: 'tf-acc-'
required: true
log_level:
description: 'Log Level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
- error
jobs:
clean:
name: Clean up
runs-on: stackit-docker
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Notify
uses: ./.github/actions/notify
with:
webhook_url: ${{ secrets.GOOGLE_WEBHOOK_URL }}
title: "[START] CLEAN UP pipeline (#${{ forgejo.run_number }})"
subtitle: "${{ forgejo.repository }}"
event_title: ${{ forgejo.event_name }}
event_author: ${{ forgejo.actor }}
event_body: "try to remove all resources with prefix <b>${{ inputs.res_prefix }}</b>"
event_number: ${{ forgejo.run_number }}
event_url: "https://tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/actions/runs/${{ forgejo.run_number }}"
- name: Clean
id: clean
uses: ./.github/actions/clean_up
with:
project_id: ${{ vars.TF_ACC_PROJECT_ID }}
region: 'eu01'
tf_resource_prefix: ${{ inputs.res_prefix }}
service_account_json_content_b64: "${{ secrets.TF_ACC_SERVICE_ACCOUNT_JSON_B64 }}"
list_only: ${{ inputs.list_only }}
log_level: ${{ inputs.log_level }}
- name: Notify
if: always()
uses: ./.github/actions/notify
with:
webhook_url: ${{ secrets.GOOGLE_WEBHOOK_URL }}
title: "[END] CLEAN UP pipeline (#${{ forgejo.run_number }})"
subtitle: "${{ forgejo.repository }}"
event_title: ${{ forgejo.event_name }}
event_author: ${{ forgejo.actor }}
event_body: "count before cleaning: ${{ steps.clean.outputs.pre_count }} <br /> count after cleaning: ${{ steps.clean.outputs.post_count }}"
event_number: ${{ forgejo.run_number }}
event_url: "https://tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/actions/runs/${{ forgejo.run_number }}"
status: ${{ steps.clean.outcome == 'success' && 'SUCCESS' || 'FAILURE' }}

25
.github/workflows/notify_pr.yaml vendored Normal file
View file

@ -0,0 +1,25 @@
name: Notify on new PR
on:
pull_request:
types:
- opened
jobs:
notify:
name: Notify via Google Chat
runs-on: stackit-docker
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Notify
uses: ./.github/actions/notify
with:
webhook_url: ${{ secrets.GOOGLE_WEBHOOK_URL }}
title: "New Pull Request"
event_title: "${{ github.event.pull_request.title }}"
event_author: "${{ github.event.pull_request.user.login }}"
event_body: "${{ github.event.pull_request.body || 'No description provided.' }}"
event_number: "${{ github.event.pull_request.number }}"
event_url: "${{ github.event.pull_request.html_url }}"

View file

@ -4,9 +4,10 @@ run-name: Publish by @${{ github.actor }}
on: on:
workflow_dispatch: workflow_dispatch:
push: push:
tags: tags:
- 'v0.*' - 'v*'
env: env:
GO_VERSION: "1.25" GO_VERSION: "1.25"
@ -16,11 +17,12 @@ env:
jobs: jobs:
config: config:
name: Check GoReleaser config name: Check GoReleaser config
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v6
with:
fetch-tags: true
- name: Check GoReleaser - name: Check GoReleaser
uses: goreleaser/goreleaser-action@v7 uses: goreleaser/goreleaser-action@v7
@ -29,13 +31,12 @@ jobs:
publish: publish:
name: "Publish provider" name: "Publish provider"
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
needs: config needs: config
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
actions: read # Required to identify workflow run. actions: read # Required to identify workflow run.
checks: write # Required to add status summary. checks: write # Required to add status summary.
contents: read # Required to checkout repository. contents: write # Required to checkout repository.
pull-requests: write # Required to add PR comment. pull-requests: write # Required to add PR comment.
steps: steps:
- name: Install needed tools - name: Install needed tools
@ -45,6 +46,20 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v6
with:
fetch-tags: true
- name: Notify
uses: ./.github/actions/notify
with:
webhook_url: ${{ secrets.GOOGLE_WEBHOOK_URL }}
title: "[START] Publish (#${{ forgejo.run_number }})"
subtitle: "${{ forgejo.event_name }} on branch ${{ forgejo.ref }}"
event_title: "run started"
event_author: ${{ forgejo.actor }}
event_body: ""
event_number: ${{ forgejo.event.id }}
event_url: "https://tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/actions/runs/${{ forgejo.run_number }}"
- name: Setup Go - name: Setup Go
uses: actions/setup-go@v6 uses: actions/setup-go@v6
@ -82,7 +97,7 @@ jobs:
gpg --import ~/private.key.pem gpg --import ~/private.key.pem
rm ~/private.key.pem rm ~/private.key.pem
- name: Run GoReleaser with SNAPSHOT - name: Run GoReleaser
if: github.event_name == 'workflow_dispatch' if: github.event_name == 'workflow_dispatch'
id: goreleaser id: goreleaser
env: env:
@ -90,7 +105,8 @@ jobs:
GPG_FINGERPRINT: ${{ secrets.GPG_FINGERPRINT }} GPG_FINGERPRINT: ${{ secrets.GPG_FINGERPRINT }}
uses: goreleaser/goreleaser-action@v7 uses: goreleaser/goreleaser-action@v7
with: with:
args: release --skip publish --clean --snapshot # args: release --skip publish --clean --snapshot
args: release --skip publish --clean
- name: Run GoReleaser - name: Run GoReleaser
if: github.event_name != 'workflow_dispatch' if: github.event_name != 'workflow_dispatch'
@ -106,9 +122,15 @@ jobs:
run: | run: |
echo "${{ secrets.PUBLIC_KEY_PEM }}" >public_key.pem echo "${{ secrets.PUBLIC_KEY_PEM }}" >public_key.pem
- name: Determine version
id: get_version
run: |
set -e
VERSION=$(jq -r .version < dist/metadata.json)
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
- name: Prepare provider directory structure - name: Prepare provider directory structure
run: | run: |
VERSION=$(jq -r .version < dist/metadata.json)
go run generator/main.go \ go run generator/main.go \
publish \ publish \
--namespace=mhenselin \ --namespace=mhenselin \
@ -117,9 +139,16 @@ jobs:
--domain=tfregistry.sysops.stackit.rocks \ --domain=tfregistry.sysops.stackit.rocks \
--gpgFingerprint="${{ secrets.GPG_FINGERPRINT }}" \ --gpgFingerprint="${{ secrets.GPG_FINGERPRINT }}" \
--gpgPubKeyFile=public_key.pem \ --gpgPubKeyFile=public_key.pem \
--version=${VERSION} --version=${{ steps.get_version.outputs.version }}
- name: Prepare documentation nav file
run: |
go run generator/main.go \
docs \
--outFile nav.md
- name: Publish provider to S3 - name: Publish provider to S3
id: publish_to_s3
run: | run: |
set -e set -e
cd release/ cd release/
@ -136,5 +165,21 @@ jobs:
run: | run: |
set -e set -e
ssh -o StrictHostKeyChecking=no ubuntu@${{ vars.DOCS_SERVER_IP }} 'rm -rf /srv/www/docs' ssh -o StrictHostKeyChecking=no ubuntu@${{ vars.DOCS_SERVER_IP }} 'rm -rf /srv/www/docs'
echo "${{ github.ref_name }}" >docs/_version.txt echo "${{ steps.get_version.outputs.version }}" >docs/_version.txt
# echo "${{ github.ref_name }}" >docs/_version.txt
scp -o StrictHostKeyChecking=no -r docs ubuntu@${{ vars.DOCS_SERVER_IP }}:/srv/www/ scp -o StrictHostKeyChecking=no -r docs ubuntu@${{ vars.DOCS_SERVER_IP }}:/srv/www/
scp -o StrictHostKeyChecking=no nav.md ubuntu@${{ vars.DOCS_SERVER_IP }}:/srv/www/
- name: Notify
if: always()
uses: ./.github/actions/notify
with:
webhook_url: ${{ secrets.GOOGLE_WEBHOOK_URL }}
title: "[END] Publish (#${{ forgejo.run_number }})"
subtitle: "${{ forgejo.event_name }} on branch ${{ forgejo.ref }}"
event_title: "released: ${{ steps.get_version.outputs.version }}"
event_author: ${{ forgejo.actor }}
event_body: ""
event_number: ${{ forgejo.event.id }}
event_url: "https://tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/actions/runs/${{ forgejo.run_number }}"
status: "${{ steps.publish_to_s3.outcome == 'success' && 'SUCCESS' || 'FAILURE' }}"

View file

@ -16,14 +16,14 @@ permissions:
jobs: jobs:
goreleaser: goreleaser:
runs-on: ubuntu-latest runs-on: stackit-docker
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v6
with: with:
# Allow goreleaser to access older tag information. # Allow goreleaser to access older tag information.
fetch-depth: 0 fetch-depth: 0
- uses: https://code.forgejo.org/actions/setup-go@v6 - uses: actions/setup-go@v6
with: with:
go-version-file: "go.mod" go-version-file: "go.mod"
cache: true cache: true

View file

@ -8,12 +8,14 @@ on:
jobs: jobs:
renovate: renovate:
name: Renovate name: Renovate
runs-on: ubuntu-latest runs-on: stackit-docker
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v6
- name: Self-hosted Renovate - name: Self-hosted Renovate
uses: renovatebot/github-action@v41.0.0 uses: renovatebot/github-action@v46.1.5
with: with:
configurationFile: .github/renovate.json configurationFile: .github/renovate.json
token: ${{ secrets.RENOVATE_TOKEN }} # token: ${{ secrets.RENOVATE_TOKEN }}
token: ${{ env.FORGEJO_TOKEN }}

View file

@ -20,7 +20,7 @@ permissions:
jobs: jobs:
stale: stale:
name: "Stale" name: "Stale"
runs-on: ubuntu-latest runs-on: stackit-docker
timeout-minutes: 10 timeout-minutes: 10
steps: steps:
- name: "Mark old PRs as stale" - name: "Mark old PRs as stale"

View file

@ -1,20 +1,71 @@
name: TF Acceptance Tests Workflow name: TF Acceptance Tests Workflow
on: on:
pull_request:
types: [opened, synchronize, reopened]
branches:
- alpha
- main
push: push:
branches: branches:
- master - master
workflow_dispatch: workflow_dispatch:
inputs:
enable_debug:
description: "enable terraform debug logs"
type: boolean
default: false
required: true
test_timeout_string:
description: "string that determines the timeout (default: '120m')"
type: string
default: '120m'
required: true
test_file:
description: "string that determines the test file to run (default all tests)"
type: choice
options:
- tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/wait/postgresflexalpha
- tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha
- tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/wait/sqlserverflexbeta
- tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexbeta
default: ''
jobs: jobs:
acc_test: acc_test:
name: Acceptance Tests name: Acceptance Tests
runs-on: ubuntu-latest runs-on: stackit-docker
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v6
- name: Run Test - name: set start time
id: start_time
continue-on-error: true
run: |
time=$(date --rfc-3339=ns)
echo "start_time=$time" >> ${GITHUB_OUTPUT}
start=$(date +%s%N)
echo "start=$start" >> ${GITHUB_OUTPUT}
- name: Notify
uses: ./.github/actions/notify
with:
webhook_url: ${{ secrets.GOOGLE_WEBHOOK_URL }}
title: "[START] Terraform Acceptance Tests (#${{ forgejo.run_number }})"
subtitle: "${{ forgejo.event_name }} on branch ${{ forgejo.ref }}"
event_title: "started: ${{ steps.start_time.outputs.start_time }}"
event_author: ${{ forgejo.actor }}
event_body: ${{ inputs.test_file }}
event_number: ${{ forgejo.run_number }}
event_url: "https://tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/actions/runs/${{ forgejo.run_number }}"
- name: Run Test (workflow dispatch)
if: ${{ forgejo.event_name == 'workflow_dispatch' }}
id: manual_run
continue-on-error: true
uses: ./.github/actions/acc_test uses: ./.github/actions/acc_test
with: with:
go-version: ${{ env.GO_VERSION }} go-version: ${{ env.GO_VERSION }}
@ -26,4 +77,51 @@ jobs:
tf_acc_kek_key_ring_id: ${{ vars.TF_ACC_KEK_KEY_RING_ID }} tf_acc_kek_key_ring_id: ${{ vars.TF_ACC_KEK_KEY_RING_ID }}
tf_acc_kek_key_version: ${{ vars.TF_ACC_KEK_KEY_VERSION }} tf_acc_kek_key_version: ${{ vars.TF_ACC_KEK_KEY_VERSION }}
tf_acc_kek_service_account: ${{ vars.TF_ACC_KEK_SERVICE_ACCOUNT }} tf_acc_kek_service_account: ${{ vars.TF_ACC_KEK_SERVICE_ACCOUNT }}
# service_account_json_file_path: "~/service_account.json" tf_debug: ${{ inputs.enable_debug }}
test_timeout_string: ${{ inputs.test_timeout_string }}
test_file: ${{ inputs.test_file }}
- name: Run Test (automatic)
if: ${{ forgejo.event_name != 'workflow_dispatch' }}
id: automatic_run
continue-on-error: true
uses: ./.github/actions/acc_test
with:
go-version: ${{ env.GO_VERSION }}
project_id: ${{ vars.TF_ACC_PROJECT_ID }}
region: 'eu01'
service_account_json_content_b64: "${{ secrets.TF_ACC_SERVICE_ACCOUNT_JSON_B64 }}"
project_user_email: ${{ vars.TEST_PROJECT_USER_EMAIL }}
tf_acc_kek_key_id: ${{ vars.TF_ACC_KEK_KEY_ID }}
tf_acc_kek_key_ring_id: ${{ vars.TF_ACC_KEK_KEY_RING_ID }}
tf_acc_kek_key_version: ${{ vars.TF_ACC_KEK_KEY_VERSION }}
tf_acc_kek_service_account: ${{ vars.TF_ACC_KEK_SERVICE_ACCOUNT }}
- name: set end time
id: end_time
continue-on-error: true
run: |
set -e
echo "auto status: ${{ steps.automatic_run.outputs.status }}"
echo "manual status: ${{ steps.manual_run.outputs.status }}"
echo "status: ${{ forgejo.event_name == 'workflow_dispatch' && steps.manual_run.outputs.status || steps.automatic_run.outputs.status }}"
echo "end_time=$(date --rfc-3339=ns)" >> ${GITHUB_OUTPUT}
end=$(date +%s%N)
echo "end=${end}" >> ${GITHUB_OUTPUT}
start=${{ steps.start_time.outputs.start }}
diff=$((end-start))
duration=$(printf "%s.%s" "${diff:0: -9}" "${diff: -9:3}")
echo "duration=${duration}" >> ${GITHUB_OUTPUT}
- name: Notify
uses: ./.github/actions/notify
with:
webhook_url: ${{ secrets.GOOGLE_WEBHOOK_URL }}
title: "[END] Terraform Acceptance Tests (#${{ forgejo.run_number }})"
subtitle: "${{ forgejo.event_name }} on branch ${{ forgejo.ref }} with status: ${{ forgejo.event_name == 'workflow_dispatch' && steps.manual_run.outputs.status || steps.automatic_run.outputs.status }}"
event_title: "run ended: ${{ steps.end_time.outputs.end_time }}, duration: ${{ steps.end_time.outputs.duration }} seconds"
event_author: ${{ forgejo.actor }}
event_body: "${{ forgejo.event_name == 'workflow_dispatch' && steps.manual_run.outputs.result || steps.automatic_run.outputs.result }}"
event_number: ${{ forgejo.event.id }}
event_url: "https://tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/actions/runs/${{ forgejo.run_number }}"
status: "${{ forgejo.event_name == 'workflow_dispatch' && steps.manual_run.outputs.status || steps.automatic_run.outputs.status }}"

View file

@ -29,12 +29,8 @@ linters:
depguard: depguard:
rules: rules:
main: main:
list-mode: lax list-mode: original
allow: allow: []
- tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview
- github.com/hashicorp/terraform-plugin-framework
- github.com/hashicorp/terraform-plugin-log
- github.com/stackitcloud/stackit-sdk-go
deny: deny:
- pkg: github.com/stretchr/testify - pkg: github.com/stretchr/testify
desc: Do not use a testing framework desc: Do not use a testing framework
@ -76,6 +72,7 @@ linters:
exclusions: exclusions:
paths: paths:
- generator/ - generator/
- internal/testutils
generated: lax generated: lax
warn-unused: true warn-unused: true
# Excluding configuration per-path, per-linter, per-text and per-source. # Excluding configuration per-path, per-linter, per-text and per-source.
@ -86,7 +83,7 @@ linters:
- gochecknoinits - gochecknoinits
formatters: formatters:
enable: enable:
#- gofmt - gofmt
- goimports - goimports
settings: settings:
goimports: goimports:

116
README.md
View file

@ -19,7 +19,7 @@ terraform {
required_providers { required_providers {
stackitprivatepreview = { stackitprivatepreview = {
source = "tfregistry.sysops.stackit.rocks/mhenselin/stackitprivatepreview" source = "tfregistry.sysops.stackit.rocks/mhenselin/stackitprivatepreview"
version = "= 0.0.5-alpha" version = ">= 0.1.0"
} }
} }
} }
@ -38,7 +38,6 @@ Check one of the examples in the [examples](examples/) folder.
To authenticate, you will need a [service account](https://docs.stackit.cloud/platform/access-and-identity/service-accounts/). Create it in the [STACKIT Portal](https://portal.stackit.cloud/) and assign the necessary permissions to it, e.g. `project.owner`. There are multiple ways to authenticate: To authenticate, you will need a [service account](https://docs.stackit.cloud/platform/access-and-identity/service-accounts/). Create it in the [STACKIT Portal](https://portal.stackit.cloud/) and assign the necessary permissions to it, e.g. `project.owner`. There are multiple ways to authenticate:
- Key flow (recommended) - Key flow (recommended)
- Token flow (is scheduled for deprecation and will be removed on December 17, 2025.)
When setting up authentication, the provider will always try to use the key flow first and search for credentials in several locations, following a specific order: When setting up authentication, the provider will always try to use the key flow first and search for credentials in several locations, following a specific order:
@ -52,7 +51,6 @@ When setting up authentication, the provider will always try to use the key flow
```json ```json
{ {
"STACKIT_SERVICE_ACCOUNT_TOKEN": "foo_token",
"STACKIT_SERVICE_ACCOUNT_KEY_PATH": "path/to/sa_key.json" "STACKIT_SERVICE_ACCOUNT_KEY_PATH": "path/to/sa_key.json"
} }
``` ```
@ -71,35 +69,41 @@ To configure the key flow, follow this steps:
1. Create a service account key: 1. Create a service account key:
- Use the [STACKIT Portal](https://portal.stackit.cloud/): go to the `Service Accounts` tab, choose a `Service Account` and go to `Service Account Keys` to create a key. For more details, see [Create a service account key](https://docs.stackit.cloud/platform/access-and-identity/service-accounts/how-tos/manage-service-account-keys/) - Use the [STACKIT Portal](https://portal.stackit.cloud/): go to the `Service Accounts` tab, choose a `Service Account` and go to `Service Account Keys` to create a key. For more details, see [Create a service account key](https://docs.stackit.cloud/platform/access-and-identity/service-accounts/how-tos/manage-service-account-keys/)
2. Save the content of the service account key by copying it and saving it in a JSON file. 2. Save the content of the service account key by copying it and saving it in a JSON file.
The expected format of the service account key is a **JSON** with the following structure: The expected format of the service account key is a **JSON** with the following structure:
```json ```json
{ {
"id": "uuid", "id": "uuid",
"publicKey": "public key", "publicKey": "public key",
"createdAt": "2023-08-24T14:15:22Z", "createdAt": "2023-08-24T14:15:22Z",
"validUntil": "2023-08-24T14:15:22Z", "validUntil": "2023-08-24T14:15:22Z",
"keyType": "USER_MANAGED", "keyType": "USER_MANAGED",
"keyOrigin": "USER_PROVIDED", "keyOrigin": "USER_PROVIDED",
"keyAlgorithm": "RSA_2048", "keyAlgorithm": "RSA_2048",
"active": true, "active": true,
"credentials": { "credentials": {
"kid": "string", "kid": "string",
"iss": "my-sa@sa.stackit.cloud", "iss": "my-sa@sa.stackit.cloud",
"sub": "uuid", "sub": "uuid",
"aud": "string", "aud": "string",
(optional) "privateKey": "private key when generated by the SA service" (optional) "privateKey": "private key when generated by the SA service"
} }
} }
``` ```
3. Configure the service account key for authentication in the provider by following one of the alternatives below: 3. Configure the service account key for authentication in the provider by following one of the alternatives below:
- setting the fields in the provider block: `service_account_key` or `service_account_key_path` - setting the fields in the provider block: `service_account_key` or `service_account_key_path`
```hcl
provider "stackitprivatepreview" {
default_region = "eu01"
service_account_key_path = "../service_account.json"
}
```
- setting the environment variable: `STACKIT_SERVICE_ACCOUNT_KEY_PATH` or `STACKIT_SERVICE_ACCOUNT_KEY` - setting the environment variable: `STACKIT_SERVICE_ACCOUNT_KEY_PATH` or `STACKIT_SERVICE_ACCOUNT_KEY`
- ensure the set the service account key in `STACKIT_SERVICE_ACCOUNT_KEY` is correctly formatted. Use e.g. - ensure the set the service account key in `STACKIT_SERVICE_ACCOUNT_KEY` is correctly formatted. Use e.g.
`$ export STACKIT_SERVICE_ACCOUNT_KEY=$(cat ./service-account-key.json)` `$ export STACKIT_SERVICE_ACCOUNT_KEY=$(cat ./service-account-key.json)`
@ -111,16 +115,6 @@ To configure the key flow, follow this steps:
> - setting the environment variable: `STACKIT_PRIVATE_KEY_PATH` or `STACKIT_PRIVATE_KEY` > - setting the environment variable: `STACKIT_PRIVATE_KEY_PATH` or `STACKIT_PRIVATE_KEY`
> - setting `STACKIT_PRIVATE_KEY_PATH` in the credentials file (see above) > - setting `STACKIT_PRIVATE_KEY_PATH` in the credentials file (see above)
### Token flow
> Is scheduled for deprecation and will be removed on December 17, 2025.
Using this flow is less secure since the token is long-lived. You can provide the token in several ways:
1. Setting the field `service_account_token` in the provider
2. Setting the environment variable `STACKIT_SERVICE_ACCOUNT_TOKEN`
3. Setting it in the credentials file (see above)
## Backend configuration ## Backend configuration
To keep track of your terraform state, you can configure an [S3 backend](https://developer.hashicorp.com/terraform/language/settings/backends/s3) using [STACKIT Object Storage](https://docs.stackit.cloud/products/storage/object-storage). To keep track of your terraform state, you can configure an [S3 backend](https://developer.hashicorp.com/terraform/language/settings/backends/s3) using [STACKIT Object Storage](https://docs.stackit.cloud/products/storage/object-storage).
@ -150,62 +144,6 @@ terraform {
Note: AWS specific checks must be skipped as they do not work on STACKIT. For details on what those validations do, see [here](https://developer.hashicorp.com/terraform/language/settings/backends/s3#configuration). Note: AWS specific checks must be skipped as they do not work on STACKIT. For details on what those validations do, see [here](https://developer.hashicorp.com/terraform/language/settings/backends/s3#configuration).
## Opting into Beta Resources
To use beta resources in the STACKIT Terraform provider, follow these steps:
1. **Provider Configuration Option**
Set the `enable_beta_resources` option in the provider configuration. This is a boolean attribute that can be either `true` or `false`.
```hcl
provider "stackit" {
default_region = "eu01"
enable_beta_resources = true
}
```
2. **Environment Variable**
Set the `STACKIT_TF_ENABLE_BETA_RESOURCES` environment variable to `"true"` or `"false"`. Other values will be ignored and will produce a warning.
```sh
export STACKIT_TF_ENABLE_BETA_RESOURCES=true
```
> **Note**: The environment variable takes precedence over the provider configuration option. This means that if the `STACKIT_TF_ENABLE_BETA_RESOURCES` environment variable is set to a valid value (`"true"` or `"false"`), it will override the `enable_beta_resources` option specified in the provider configuration.
For more details, please refer to the [beta resources configuration guide](https://registry.terraform.io/providers/stackitcloud/stackit/latest/docs/guides/opting_into_beta_resources).
## Opting into Experiments
Experiments are features that are even less mature and stable than Beta Resources. While there is some assumed stability in beta resources, will have to expect breaking changes while using experimental resources. Experimental Resources do not come with any support or warranty.
To enable experiments set the experiments field in the provider definition:
```hcl
provider "stackit" {
default_region = "eu01"
experiments = ["iam", "routing-tables", "network"]
}
```
### Available Experiments
#### `iam`
Enables IAM management features in the Terraform provider. The underlying IAM API is expected to undergo a redesign in the future, which leads to it being considered experimental.
#### `routing-tables`
This feature enables experimental routing table capabilities in the Terraform Provider, available only to designated SNAs at this time.
#### `network`
The `stackit_network` provides the fields `region` and `routing_table_id` when the experiment flag `network` is set.
The underlying API is not stable yet and could change in the future.
If you don't need these fields, don't set the experiment flag `network`, to use the stable api.
## Acceptance Tests ## Acceptance Tests
> [!WARNING] > [!WARNING]

View file

@ -28,6 +28,9 @@ data "stackitprivatepreview_postgresflexalpha_database" "example" {
- `database_id` (Number) The ID of the database. - `database_id` (Number) The ID of the database.
- `instance_id` (String) The ID of the instance. - `instance_id` (String) The ID of the instance.
- `project_id` (String) The STACKIT project ID. - `project_id` (String) The STACKIT project ID.
### Optional
- `region` (String) The region which should be addressed - `region` (String) The region which should be addressed
### Read-Only ### Read-Only

View file

@ -26,6 +26,9 @@ data "stackitprivatepreview_postgresflexalpha_instance" "example" {
- `instance_id` (String) The ID of the instance. - `instance_id` (String) The ID of the instance.
- `project_id` (String) The STACKIT project ID. - `project_id` (String) The STACKIT project ID.
### Optional
- `region` (String) The region which should be addressed - `region` (String) The region which should be addressed
### Read-Only ### Read-Only
@ -37,11 +40,18 @@ data "stackitprivatepreview_postgresflexalpha_instance" "example" {
⚠︝ **Note:** This feature is in private preview. Supplying this object is only permitted for enabled accounts. If your account does not have access, the request will be rejected. (see [below for nested schema](#nestedatt--encryption)) ⚠︝ **Note:** This feature is in private preview. Supplying this object is only permitted for enabled accounts. If your account does not have access, the request will be rejected. (see [below for nested schema](#nestedatt--encryption))
- `flavor_id` (String) The id of the instance flavor. - `flavor_id` (String) The id of the instance flavor.
- `id` (String) internal ID
- `is_deletable` (Boolean) Whether the instance can be deleted or not. - `is_deletable` (Boolean) Whether the instance can be deleted or not.
- `labels` (Map of String) Key-value pairs, 63 characters max, begin and end with an alphanumerical character,
may contain dashes (-), underscores (_), dots (.), and alphanumerics between. Key MUST be at least 1 character.
Max 64 labels
Regex for keys: ^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$
Regex for values: ^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$
The stackit- prefix is reserved and cannot be used for Keys.
- `name` (String) The name of the instance. - `name` (String) The name of the instance.
- `network` (Attributes) The access configuration of the instance (see [below for nested schema](#nestedatt--network)) - `network` (Attributes) The access configuration of the instance (see [below for nested schema](#nestedatt--network))
- `replicas` (Number) How many replicas the instance should have. - `replicas` (Number) How many replicas the instance should have.
- `retention_days` (Number) How long backups are retained. The value can only be between 32 and 365 days. - `retention_days` (Number) How long backups are retained. The value can only be between 32 and 90 days.
- `status` (String) The current status of the instance. - `status` (String) The current status of the instance.
- `storage` (Attributes) The object containing information about the storage size and class. (see [below for nested schema](#nestedatt--storage)) - `storage` (Attributes) The object containing information about the storage size and class. (see [below for nested schema](#nestedatt--storage))
- `tf_original_api_id` (String) The ID of the instance. - `tf_original_api_id` (String) The ID of the instance.

View file

@ -27,12 +27,12 @@ data "stackitprivatepreview_postgresflexalpha_user" "example" {
- `instance_id` (String) The ID of the instance. - `instance_id` (String) The ID of the instance.
- `project_id` (String) The STACKIT project ID. - `project_id` (String) The STACKIT project ID.
- `region` (String) The region which should be addressed
- `user_id` (Number) The ID of the user. - `user_id` (Number) The ID of the user.
### Optional ### Optional
- `id` (String) Terraform's internal resource ID. It is structured as \"`project_id`,`region`,`instance_id`,`user_id`\".", - `id` (String) Terraform's internal resource ID. It is structured as \"`project_id`,`region`,`instance_id`,`user_id`\".",
- `region` (String) The region which should be addressed
### Read-Only ### Read-Only

View file

@ -1,32 +0,0 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "stackitprivatepreview_sqlserverflexalpha_database Data Source - stackitprivatepreview"
subcategory: ""
description: |-
---
# stackitprivatepreview_sqlserverflexalpha_database (Data Source)
<!-- schema generated by tfplugindocs -->
## Schema
### Required
- `database_name` (String) The name of the database.
- `instance_id` (String) The ID of the instance.
- `project_id` (String) The STACKIT project ID.
- `region` (String) The region which should be addressed
### Read-Only
- `collation_name` (String) The collation of the database. This database collation should match the *collation_name* of one of the collations given by the **Get database collation list** endpoint.
- `compatibility_level` (Number) CompatibilityLevel of the Database.
- `id` (String) The terraform internal identifier.
- `name` (String) The name of the database.
- `owner` (String) The owner of the database.
- `tf_original_api_id` (Number) The id of the database.

View file

@ -1,77 +0,0 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "stackitprivatepreview_sqlserverflexalpha_instance Data Source - stackitprivatepreview"
subcategory: ""
description: |-
---
# stackitprivatepreview_sqlserverflexalpha_instance (Data Source)
## Example Usage
```terraform
data "stackitprivatepreview_sqlserverflexalpha_instance" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
instance_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
```
<!-- schema generated by tfplugindocs -->
## Schema
### Required
- `instance_id` (String) The ID of the instance.
- `project_id` (String) The STACKIT project ID.
- `region` (String) The region which should be addressed
### Read-Only
- `backup_schedule` (String) The schedule for on what time and how often the database backup will be created. The schedule is written as a cron schedule.
- `edition` (String) Edition of the MSSQL server instance
- `encryption` (Attributes) this defines which key to use for storage encryption (see [below for nested schema](#nestedatt--encryption))
- `flavor_id` (String) The id of the instance flavor.
- `is_deletable` (Boolean) Whether the instance can be deleted or not.
- `name` (String) The name of the instance.
- `network` (Attributes) The access configuration of the instance (see [below for nested schema](#nestedatt--network))
- `replicas` (Number) How many replicas the instance should have.
- `retention_days` (Number) The days for how long the backup files should be stored before cleaned up. 30 to 365
- `status` (String)
- `storage` (Attributes) The object containing information about the storage size and class. (see [below for nested schema](#nestedatt--storage))
- `tf_original_api_id` (String) The ID of the instance.
- `version` (String) The sqlserver version used for the instance.
<a id="nestedatt--encryption"></a>
### Nested Schema for `encryption`
Read-Only:
- `kek_key_id` (String) The key identifier
- `kek_key_ring_id` (String) The keyring identifier
- `kek_key_version` (String) The key version
- `service_account` (String)
<a id="nestedatt--network"></a>
### Nested Schema for `network`
Read-Only:
- `access_scope` (String) The network access scope of the instance
⚠️ **Note:** This feature is in private preview. Supplying this object is only permitted for enabled accounts. If your account does not have access, the request will be rejected.
- `acl` (List of String) List of IPV4 cidr.
- `instance_address` (String)
- `router_address` (String)
<a id="nestedatt--storage"></a>
### Nested Schema for `storage`
Read-Only:
- `class` (String) The storage class for the storage.
- `size` (Number) The storage size in Gigabytes.

View file

@ -1,62 +0,0 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "stackitprivatepreview_sqlserverflexalpha_user Data Source - stackitprivatepreview"
subcategory: ""
description: |-
---
# stackitprivatepreview_sqlserverflexalpha_user (Data Source)
## Example Usage
```terraform
data "stackitprivatepreview_sqlserverflexalpha_user" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
instance_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
user_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
```
<!-- schema generated by tfplugindocs -->
## Schema
### Required
- `instance_id` (String) The ID of the instance.
- `project_id` (String) The STACKIT project ID.
- `region` (String) The region which should be addressed
### Optional
- `page` (Number) Number of the page of items list to be returned.
- `size` (Number) Number of items to be returned on each page.
- `sort` (String) Sorting of the users to be returned on each page.
### Read-Only
- `pagination` (Attributes) (see [below for nested schema](#nestedatt--pagination))
- `users` (Attributes List) List of all users inside an instance (see [below for nested schema](#nestedatt--users))
<a id="nestedatt--pagination"></a>
### Nested Schema for `pagination`
Read-Only:
- `page` (Number)
- `size` (Number)
- `sort` (String)
- `total_pages` (Number)
- `total_rows` (Number)
<a id="nestedatt--users"></a>
### Nested Schema for `users`
Read-Only:
- `status` (String) The current status of the user.
- `tf_original_api_id` (Number) The ID of the user.
- `username` (String) The name of the user.

View file

@ -0,0 +1,54 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "stackitprivatepreview_sqlserverflexbeta_flavor Data Source - stackitprivatepreview"
subcategory: ""
description: |-
---
# stackitprivatepreview_sqlserverflexbeta_flavor (Data Source)
## Example Usage
```terraform
data "stackitprivatepreview_sqlserverflexbeta_flavor" "flavor" {
project_id = var.project_id
region = var.region
cpu = 4
ram = 16
node_type = "Single"
storage_class = "premium-perf2-stackit"
}
```
<!-- schema generated by tfplugindocs -->
## Schema
### Required
- `cpu` (Number) The cpu count of the instance.
- `node_type` (String) defines the nodeType it can be either single or HA
- `project_id` (String) The project ID of the flavor.
- `ram` (Number) The memory of the instance in Gibibyte.
- `region` (String) The region of the flavor.
- `storage_class` (String) The memory of the instance in Gibibyte.
### Read-Only
- `description` (String) The flavor description.
- `flavor_id` (String) The id of the instance flavor.
- `id` (String) The id of the instance flavor.
- `max_gb` (Number) maximum storage which can be ordered for the flavor in Gigabyte.
- `min_gb` (Number) minimum storage which is required to order in Gigabyte.
- `storage_classes` (Attributes List) maximum storage which can be ordered for the flavor in Gigabyte. (see [below for nested schema](#nestedatt--storage_classes))
<a id="nestedatt--storage_classes"></a>
### Nested Schema for `storage_classes`
Read-Only:
- `class` (String)
- `max_io_per_sec` (Number)
- `max_through_in_mb` (Number)

View file

@ -54,4 +54,4 @@ import {
### Read-Only ### Read-Only
- `id` (Number) The id of the database. - `id` (String) The id of the database.

View file

@ -13,6 +13,33 @@ description: |-
## Example Usage ## Example Usage
```terraform ```terraform
# NOTE: flavor handling will change in future
# V2 compatible flavor usage (example without encryption)
resource "stackitprivatepreview_postgresflexalpha_instance" "example-instance" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-instance"
acl = ["XXX.XXX.XXX.X/XX", "XX.XXX.XX.X/XX"]
backup_schedule = "0 0 * * *"
retention_days = 30
flavor = {
cpu = 2
ram = 4
}
replicas = 1
storage = {
performance_class = "premium-perf2-stackit"
size = 10
}
network = {
acl = ["XXX.XXX.XXX.X/XX", "XX.XXX.XX.X/XX"]
access_scope = "PUBLIC"
}
version = 17
}
# future use of flavor (implemented in V3 API)
# first determine flavor and then use the flavor_id
resource "stackitprivatepreview_postgresflexalpha_instance" "example-instance" { resource "stackitprivatepreview_postgresflexalpha_instance" "example-instance" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-instance" name = "example-instance"
@ -60,11 +87,10 @@ import {
### Required ### Required
- `backup_schedule` (String) The schedule for when the database backup will be created. Currently, ONLY daily schedules are supported (every 24 hours). The schedule is written as a cron schedule. - `backup_schedule` (String) The schedule for when the database backup will be created. Currently, ONLY daily schedules are supported (every 24 hours). The schedule is written as a cron schedule.
- `flavor_id` (String) The id of the instance flavor.
- `name` (String) The name of the instance. - `name` (String) The name of the instance.
- `network` (Attributes) The access configuration of the instance (see [below for nested schema](#nestedatt--network)) - `network` (Attributes) The access configuration of the instance (see [below for nested schema](#nestedatt--network))
- `replicas` (Number) How many replicas the instance should have. - `replicas` (Number) How many replicas the instance should have.
- `retention_days` (Number) How long backups are retained. The value can only be between 32 and 365 days. - `retention_days` (Number) How long backups are retained. The value can only be between 32 and 90 days.
- `storage` (Attributes) The object containing information about the storage size and class. (see [below for nested schema](#nestedatt--storage)) - `storage` (Attributes) The object containing information about the storage size and class. (see [below for nested schema](#nestedatt--storage))
- `version` (String) The Postgres version used for the instance. See [Versions Endpoint](/documentation/postgres-flex-service/version/v3alpha1#tag/Version) for supported version parameters. - `version` (String) The Postgres version used for the instance. See [Versions Endpoint](/documentation/postgres-flex-service/version/v3alpha1#tag/Version) for supported version parameters.
@ -73,6 +99,8 @@ import {
- `encryption` (Attributes) The configuration for instance's volume and backup storage encryption. - `encryption` (Attributes) The configuration for instance's volume and backup storage encryption.
⚠︝ **Note:** This feature is in private preview. Supplying this object is only permitted for enabled accounts. If your account does not have access, the request will be rejected. (see [below for nested schema](#nestedatt--encryption)) ⚠︝ **Note:** This feature is in private preview. Supplying this object is only permitted for enabled accounts. If your account does not have access, the request will be rejected. (see [below for nested schema](#nestedatt--encryption))
- `flavor` (Attributes, Deprecated) (see [below for nested schema](#nestedatt--flavor))
- `flavor_id` (String) The id of the instance flavor.
- `instance_id` (String) The ID of the instance. - `instance_id` (String) The ID of the instance.
- `project_id` (String) The STACKIT project ID. - `project_id` (String) The STACKIT project ID.
- `region` (String) The region which should be addressed - `region` (String) The region which should be addressed
@ -122,6 +150,20 @@ Required:
- `service_account` (String) - `service_account` (String)
<a id="nestedatt--flavor"></a>
### Nested Schema for `flavor`
Optional:
- `cpu` (Number, Deprecated)
- `ram` (Number, Deprecated)
Read-Only:
- `description` (String)
- `id` (String)
<a id="nestedatt--connection_info"></a> <a id="nestedatt--connection_info"></a>
### Nested Schema for `connection_info` ### Nested Schema for `connection_info`

View file

@ -54,6 +54,6 @@ import {
### Read-Only ### Read-Only
- `id` (Number) The ID of the user. - `id` (String) The ID of the user.
- `password` (String) The password for the user. - `password` (String) The password for the user.
- `status` (String) The current status of the user. - `status` (String) The current status of the user.

View file

@ -1,63 +0,0 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "stackitprivatepreview_sqlserverflexalpha_database Resource - stackitprivatepreview"
subcategory: ""
description: |-
---
# stackitprivatepreview_sqlserverflexalpha_database (Resource)
## Example Usage
```terraform
resource "stackitprivatepreview_sqlserverflexalpha_database" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
instance_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
collation = ""
compatibility = "160"
name = ""
owner = ""
}
# Only use the import statement, if you want to import a existing sqlserverflex database
import {
to = stackitprivatepreview_sqlserverflexalpha_database.import-example
id = "${var.project_id},${var.region},${var.sql_instance_id},${var.sql_user_id}"
}
import {
to = stackitprivatepreview_sqlserverflexalpha_database.import-example
identity = {
project_id = "project.id"
region = "region"
instance_id = "instance.id"
database_id = "database.id"
}
}
```
<!-- schema generated by tfplugindocs -->
## Schema
### Required
- `name` (String) The name of the database.
- `owner` (String) The owner of the database.
### Optional
- `collation` (String) The collation of the database. This database collation should match the *collation_name* of one of the collations given by the **Get database collation list** endpoint.
- `compatibility` (Number) CompatibilityLevel of the Database.
- `database_name` (String) The name of the database.
- `instance_id` (String) The ID of the instance.
- `project_id` (String) The STACKIT project ID.
- `region` (String) The region which should be addressed
### Read-Only
- `collation_name` (String) The collation of the database. This database collation should match the *collation_name* of one of the collations given by the **Get database collation list** endpoint.
- `compatibility_level` (Number) CompatibilityLevel of the Database.
- `id` (Number) The id of the database.

View file

@ -1,103 +0,0 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "stackitprivatepreview_sqlserverflexalpha_instance Resource - stackitprivatepreview"
subcategory: ""
description: |-
---
# stackitprivatepreview_sqlserverflexalpha_instance (Resource)
## Example Usage
```terraform
resource "stackitprivatepreview_sqlserverflexalpha_instance" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-instance"
acl = ["XXX.XXX.XXX.X/XX", "XX.XXX.XX.X/XX"]
backup_schedule = "00 00 * * *"
flavor = {
cpu = 4
ram = 16
}
storage = {
class = "class"
size = 5
}
version = 2022
}
# Only use the import statement, if you want to import an existing sqlserverflex instance
import {
to = stackitprivatepreview_sqlserverflexalpha_instance.import-example
id = "${var.project_id},${var.region},${var.sql_instance_id}"
}
```
<!-- schema generated by tfplugindocs -->
## Schema
### Required
- `backup_schedule` (String) The schedule for on what time and how often the database backup will be created. The schedule is written as a cron schedule.
- `flavor_id` (String) The id of the instance flavor.
- `name` (String) The name of the instance.
- `network` (Attributes) the network configuration of the instance. (see [below for nested schema](#nestedatt--network))
- `retention_days` (Number) The days for how long the backup files should be stored before cleaned up. 30 to 365
- `storage` (Attributes) The object containing information about the storage size and class. (see [below for nested schema](#nestedatt--storage))
- `version` (String) The sqlserver version used for the instance.
### Optional
- `encryption` (Attributes) this defines which key to use for storage encryption (see [below for nested schema](#nestedatt--encryption))
- `instance_id` (String) The ID of the instance.
- `project_id` (String) The STACKIT project ID.
- `region` (String) The region which should be addressed
### Read-Only
- `edition` (String) Edition of the MSSQL server instance
- `id` (String) The ID of the instance.
- `is_deletable` (Boolean) Whether the instance can be deleted or not.
- `replicas` (Number) How many replicas the instance should have.
- `status` (String)
<a id="nestedatt--network"></a>
### Nested Schema for `network`
Required:
- `acl` (List of String) List of IPV4 cidr.
Optional:
- `access_scope` (String) The network access scope of the instance
⚠️ **Note:** This feature is in private preview. Supplying this object is only permitted for enabled accounts. If your account does not have access, the request will be rejected.
Read-Only:
- `instance_address` (String)
- `router_address` (String)
<a id="nestedatt--storage"></a>
### Nested Schema for `storage`
Required:
- `class` (String) The storage class for the storage.
- `size` (Number) The storage size in Gigabytes.
<a id="nestedatt--encryption"></a>
### Nested Schema for `encryption`
Required:
- `kek_key_id` (String) The key identifier
- `kek_key_ring_id` (String) The keyring identifier
- `kek_key_version` (String) The key version
- `service_account` (String)

View file

@ -1,53 +0,0 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "stackitprivatepreview_sqlserverflexalpha_user Resource - stackitprivatepreview"
subcategory: ""
description: |-
---
# stackitprivatepreview_sqlserverflexalpha_user (Resource)
## Example Usage
```terraform
resource "stackitprivatepreview_sqlserverflexalpha_user" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
instance_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
username = "username"
roles = ["role"]
}
# Only use the import statement, if you want to import an existing sqlserverflex user
import {
to = stackitprivatepreview_sqlserverflexalpha_user.import-example
id = "${var.project_id},${var.region},${var.sql_instance_id},${var.sql_user_id}"
}
```
<!-- schema generated by tfplugindocs -->
## Schema
### Required
- `roles` (List of String) A list containing the user roles for the instance. A list with the valid user roles can be retrieved using the List Roles endpoint.
- `username` (String) The name of the user.
### Optional
- `default_database` (String) The default database for a user of the instance.
- `instance_id` (String) The ID of the instance.
- `project_id` (String) The STACKIT project ID.
- `region` (String) The region which should be addressed
- `user_id` (Number) The ID of the user.
### Read-Only
- `host` (String) The host of the instance in which the user belongs to.
- `id` (Number) The ID of the user.
- `password` (String) The password for the user.
- `port` (Number) The port of the instance in which the user belongs to.
- `status` (String) The current status of the user.
- `uri` (String) The connection string for the user to the instance.

View file

@ -13,6 +13,31 @@ description: |-
## Example Usage ## Example Usage
```terraform ```terraform
# NOTE: flavor handling will change in future
# V2 compatible flavor usage
resource "stackitprivatepreview_sqlserverflexbeta_instance" "instance" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-instance"
backup_schedule = "0 3 * * *"
retention_days = 31
flavor = {
cpu = 2
ram = 4
}
storage = {
class = "premium-perf2-stackit"
size = 50
}
version = 2022
network = {
acl = ["XXX.XXX.XXX.X/XX", "XX.XXX.XX.X/XX"]
access_scope = "SNA"
}
}
# future use of flavor (implemented in V3 API)
# first determine flavor and then use the flavor_id
# without encryption and SNA # without encryption and SNA
resource "stackitprivatepreview_sqlserverflexbeta_instance" "instance" { resource "stackitprivatepreview_sqlserverflexbeta_instance" "instance" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
@ -97,7 +122,6 @@ import {
### Required ### Required
- `backup_schedule` (String) The schedule for on what time and how often the database backup will be created. The schedule is written as a cron schedule. - `backup_schedule` (String) The schedule for on what time and how often the database backup will be created. The schedule is written as a cron schedule.
- `flavor_id` (String) The id of the instance flavor.
- `name` (String) The name of the instance. - `name` (String) The name of the instance.
- `network` (Attributes) the network configuration of the instance. (see [below for nested schema](#nestedatt--network)) - `network` (Attributes) the network configuration of the instance. (see [below for nested schema](#nestedatt--network))
- `retention_days` (Number) The days for how long the backup files should be stored before cleaned up. 30 to 365 - `retention_days` (Number) The days for how long the backup files should be stored before cleaned up. 30 to 365
@ -107,6 +131,8 @@ import {
### Optional ### Optional
- `encryption` (Attributes) this defines which key to use for storage encryption (see [below for nested schema](#nestedatt--encryption)) - `encryption` (Attributes) this defines which key to use for storage encryption (see [below for nested schema](#nestedatt--encryption))
- `flavor` (Attributes, Deprecated) (see [below for nested schema](#nestedatt--flavor))
- `flavor_id` (String) The id of the instance flavor.
- `instance_id` (String) The ID of the instance. - `instance_id` (String) The ID of the instance.
- `project_id` (String) The STACKIT project ID. - `project_id` (String) The STACKIT project ID.
- `region` (String) The region which should be addressed - `region` (String) The region which should be addressed
@ -156,3 +182,17 @@ Required:
- `kek_key_ring_id` (String) The keyring identifier - `kek_key_ring_id` (String) The keyring identifier
- `kek_key_version` (String) The key version - `kek_key_version` (String) The key version
- `service_account` (String) - `service_account` (String)
<a id="nestedatt--flavor"></a>
### Nested Schema for `flavor`
Optional:
- `cpu` (Number, Deprecated)
- `ram` (Number, Deprecated)
Read-Only:
- `description` (String)
- `id` (String)

View file

@ -1,3 +1,30 @@
# NOTE: flavor handling will change in future
# V2 compatible flavor usage (example without encryption)
resource "stackitprivatepreview_postgresflexalpha_instance" "example-instance" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-instance"
acl = ["XXX.XXX.XXX.X/XX", "XX.XXX.XX.X/XX"]
backup_schedule = "0 0 * * *"
retention_days = 30
flavor = {
cpu = 2
ram = 4
}
replicas = 1
storage = {
performance_class = "premium-perf2-stackit"
size = 10
}
network = {
acl = ["XXX.XXX.XXX.X/XX", "XX.XXX.XX.X/XX"]
access_scope = "PUBLIC"
}
version = 17
}
# future use of flavor (implemented in V3 API)
# first determine flavor and then use the flavor_id
resource "stackitprivatepreview_postgresflexalpha_instance" "example-instance" { resource "stackitprivatepreview_postgresflexalpha_instance" "example-instance" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-instance" name = "example-instance"

View file

@ -1,3 +1,28 @@
# NOTE: flavor handling will change in future
# V2 compatible flavor usage
resource "stackitprivatepreview_sqlserverflexbeta_instance" "instance" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-instance"
backup_schedule = "0 3 * * *"
retention_days = 31
flavor = {
cpu = 2
ram = 4
}
storage = {
class = "premium-perf2-stackit"
size = 50
}
version = 2022
network = {
acl = ["XXX.XXX.XXX.X/XX", "XX.XXX.XX.X/XX"]
access_scope = "SNA"
}
}
# future use of flavor (implemented in V3 API)
# first determine flavor and then use the flavor_id
# without encryption and SNA # without encryption and SNA
resource "stackitprivatepreview_sqlserverflexbeta_instance" "instance" { resource "stackitprivatepreview_sqlserverflexbeta_instance" "instance" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"

View file

@ -8,10 +8,11 @@ import (
"go/token" "go/token"
"log/slog" "log/slog"
"os" "os"
"os/exec"
"path" "path"
"regexp" "regexp"
"strings" "strings"
"tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/generator/cmd/tools"
) )
type Builder struct { type Builder struct {
@ -276,20 +277,14 @@ func handleLine(line string) (string, error) {
} }
func (b *Builder) determineRoot() error { func (b *Builder) determineRoot() error {
cmd := exec.Command("git", "rev-parse", "--show-toplevel") root, err := tools.GetGitRoot()
out, err := cmd.Output()
if err != nil { if err != nil {
return err return err
} }
lines := strings.Split(string(out), "\n") b.rootDir = root
if lines[0] == "" {
return fmt.Errorf("unable to determine root directory from git")
}
b.rootDir = lines[0]
if b.Verbose { if b.Verbose {
slog.Info(" ... using root", "dir", b.rootDir) slog.Info(" ... using root", "dir", b.rootDir)
} }
return nil return nil
} }

247
generator/cmd/docCmd.go Normal file
View file

@ -0,0 +1,247 @@
package cmd
import (
"fmt"
"log/slog"
"os"
"path"
"regexp"
"sort"
"strings"
"text/template"
"github.com/spf13/cobra"
"tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/generator/cmd/tools"
)
var outFile string
var docsCmd = &cobra.Command{
Use: "docs",
Short: "handle documentation",
Long: `...`,
RunE: func(_ *cobra.Command, _ []string) error {
// filePathStr := "stackit/internal/services/postgresflexalpha/database/datasources_gen/database_data_source_gen.go"
//
// src, err := os.ReadFile(filePathStr)
// if err != nil {
// return err
//}
//
// i := interp.New(
// interp.Options{
// GoPath: "/home/henselinm/.asdf/installs/golang/1.25.6/packages",
// BuildTags: nil,
// Stdin: nil,
// Stdout: nil,
// Stderr: nil,
// Args: nil,
// Env: nil,
// SourcecodeFilesystem: nil,
// Unrestricted: false,
// },
//)
// err = i.Use(i.Symbols("github.com/hashicorp/terraform-plugin-framework-validators"))
// if err != nil {
// return err
//}
// err = i.Use(stdlib.Symbols)
// if err != nil {
// return err
//}
// _, err = i.Eval(string(src))
// if err != nil {
// return err
//}
//
// v, err := i.Eval("DatabaseDataSourceSchema")
// if err != nil {
// return err
//}
//
// bar := v.Interface().(func(string) string)
//
// r := bar("Kung")
// println(r)
//
// evalPath, err := i.EvalPath(filePathStr)
// if err != nil {
// return err
//}
//
// fmt.Printf("%+v\n", evalPath)
// _, err = i.Eval(`import "fmt"`)
// if err != nil {
// return err
//}
// _, err = i.Eval(`func Hallo() { fmt.Println("Hi!") }`)
// if err != nil {
// return err
//}
// v = i.Symbols("Hallo")
// fmt.Println(v)
return workDocs()
},
}
type NavDocs struct {
PageTitle string
Description string
NavigationTitle string
ProviderTitle string
IndexFound bool
Services []Service
}
type Service struct {
ServiceTitle string
DataSources []ResItem
Resources []ResItem
}
type ResItem struct {
ItemName string
ItemLink string
}
func workDocs() error {
slog.Info("creating docs navigation")
root, err := tools.GetGitRoot()
if err != nil {
slog.Error("ERROR", "err", err)
return err
}
nav := NavDocs{
PageTitle: "STACKIT terraform provider PRIVATE-PREVIEW",
Description: "",
NavigationTitle: "Navigation",
ProviderTitle: "Provider",
IndexFound: false,
}
startPath := path.Join(root, "docs")
docs, err := os.ReadDir(startPath)
if err != nil {
return err
}
services := make(map[string]Service)
dataSources := make(map[string][]ResItem)
resources := make(map[string][]ResItem)
for _, entry := range docs {
if !entry.IsDir() {
if entry.Name() == "index.md" {
slog.Debug(" found provider index file")
nav.IndexFound = true
continue
}
slog.Debug(" found am ignored file", "fileName", entry.Name())
continue
}
if entry.Name() != "data-sources" && entry.Name() != "resources" {
slog.Error("unable to handle entry, skipping", "entry", entry.Name())
continue
}
elements, err := os.ReadDir(path.Join(startPath, entry.Name()))
if err != nil {
return err
}
for _, res := range elements {
if res.IsDir() {
slog.Warn("found unexpected directory", "dir", res.Name())
continue
}
re := regexp.MustCompile(`([a-z]+)_([a-z]+).md`)
matches := re.FindAllStringSubmatch(res.Name(), -1)
if matches == nil {
slog.Error("unable to identify resource", "item", res.Name())
continue
}
services[matches[0][1]] = Service{
ServiceTitle: matches[0][1],
}
switch entry.Name() {
case "data-sources":
dataSources[matches[0][1]] = append(dataSources[matches[0][1]], ResItem{
ItemName: matches[0][2],
ItemLink: fmt.Sprintf("/docs/docs/%s/%s", entry.Name(), matches[0][0]),
})
case "resources":
resources[matches[0][1]] = append(resources[matches[0][1]], ResItem{
ItemName: matches[0][2],
ItemLink: fmt.Sprintf("/docs/docs/%s/%s", entry.Name(), matches[0][0]),
})
default:
return fmt.Errorf("this should never have happened")
}
}
}
keys := make([]string, 0, len(services))
for k := range services {
keys = append(keys, k)
}
sort.Strings(keys)
for _, name := range keys {
item := services[name]
item.DataSources = dataSources[name]
item.Resources = resources[name]
nav.Services = append(nav.Services, item)
}
fn := template.FuncMap{
"ucfirst": ucfirst,
}
tmpl, err := template.
New("nav.md.gompl").
Funcs(fn).
ParseFiles(path.Join(root, "generator", "cmd", "docs", "templates", "nav.md.gompl"))
if err != nil {
return err
}
var f *os.File
f, err = os.Create(outFile)
if err != nil {
return err
}
err = tmpl.Execute(f, nav)
if err != nil {
return err
}
err = f.Close()
if err != nil {
return err
}
slog.Info("finished")
return nil
}
func NewDocsCmd() *cobra.Command {
return docsCmd
}
func ucfirst(s string) string {
if s == "" {
return ""
}
return strings.ToUpper(s[:1]) + s[1:]
}
func init() { // nolint: gochecknoinits
docsCmd.Flags().StringVarP(&outFile, "outFile", "o", "nav.md", "nav.md")
}

View file

@ -0,0 +1,27 @@
---
page_title: {{ .PageTitle }}
description: {{ .Description }}
---
## {{ .NavigationTitle }}
### {{ .ProviderTitle }}
{{ if .IndexFound }}
[Provider](/docs/docs/index.md)
{{ end }}
{{- range $index, $service := .Services }}
### {{ $service.ServiceTitle }}
<details>
#### data sources
{{- range $service.DataSources }}
- [{{ .ItemName }}]({{ .ItemLink }})
{{- end }}
#### resources
{{- range $service.Resources }}
- [{{ .ItemName }}]({{ .ItemLink }})
{{- end }}
</details>
{{ end }}

View file

@ -6,7 +6,7 @@ import (
func NewRootCmd() *cobra.Command { func NewRootCmd() *cobra.Command {
return &cobra.Command{ return &cobra.Command{
Use: "build-tools", Use: "generator",
Short: "...", Short: "...",
Long: "...", Long: "...",
SilenceErrors: true, // Error is beautified in a custom way before being printed SilenceErrors: true, // Error is beautified in a custom way before being printed

View file

@ -0,0 +1,20 @@
package tools
import (
"fmt"
"os/exec"
"strings"
)
func GetGitRoot() (string, error) {
cmd := exec.Command("git", "rev-parse", "--show-toplevel")
out, err := cmd.Output()
if err != nil {
return "", err
}
lines := strings.Split(string(out), "\n")
if lines[0] == "" {
return "", fmt.Errorf("unable to determine root directory from git")
}
return lines[0], nil
}

View file

@ -31,6 +31,7 @@ func main() {
cmd.NewPublishCmd(), cmd.NewPublishCmd(),
cmd.NewGetFieldsCmd(), cmd.NewGetFieldsCmd(),
cmd.NewExamplesCmd(), cmd.NewExamplesCmd(),
cmd.NewDocsCmd(),
) )
err := rootCmd.Execute() err := rootCmd.Execute()

253
go.mod
View file

@ -1,26 +1,25 @@
module tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview module tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview
go 1.25.6 go 1.26.2
require ( require (
github.com/SladkyCitron/slogcolor v1.8.0 github.com/SladkyCitron/slogcolor v1.9.0
github.com/golang-jwt/jwt/v5 v5.3.1
github.com/google/go-cmp v0.7.0 github.com/google/go-cmp v0.7.0
github.com/google/uuid v1.6.0 github.com/google/uuid v1.6.0
github.com/hashicorp/terraform-plugin-framework v1.18.0 github.com/hashicorp/terraform-plugin-framework v1.19.0
github.com/hashicorp/terraform-plugin-framework-validators v0.19.0 github.com/hashicorp/terraform-plugin-framework-validators v0.19.0
github.com/hashicorp/terraform-plugin-go v0.30.0 github.com/hashicorp/terraform-plugin-go v0.31.0
github.com/hashicorp/terraform-plugin-log v0.10.0 github.com/hashicorp/terraform-plugin-log v0.10.0
github.com/hashicorp/terraform-plugin-testing v1.14.0 github.com/hashicorp/terraform-plugin-testing v1.16.0
github.com/iancoleman/strcase v0.3.0 github.com/iancoleman/strcase v0.3.0
github.com/ivanpirog/coloredcobra v1.0.1 github.com/ivanpirog/coloredcobra v1.0.1
github.com/jarcoal/httpmock v1.4.1 github.com/jarcoal/httpmock v1.4.1
github.com/joho/godotenv v1.5.1 github.com/joho/godotenv v1.5.1
github.com/ldez/go-git-cmd-wrapper/v2 v2.9.1 github.com/ldez/go-git-cmd-wrapper/v2 v2.9.1
github.com/spf13/cobra v1.10.2 github.com/spf13/cobra v1.10.2
github.com/stackitcloud/stackit-sdk-go/core v0.22.0 github.com/stackitcloud/stackit-sdk-go/core v0.26.0
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v1.4.0 github.com/stackitcloud/stackit-sdk-go/services/postgresflex v1.8.0
github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex v1.5.0 github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex v1.10.0
github.com/teambition/rrule-go v1.8.2 github.com/teambition/rrule-go v1.8.2
gopkg.in/yaml.v3 v3.0.1 gopkg.in/yaml.v3 v3.0.1
) )
@ -28,261 +27,77 @@ require (
require github.com/hashicorp/go-retryablehttp v0.7.8 // indirect require github.com/hashicorp/go-retryablehttp v0.7.8 // indirect
require ( require (
4d63.com/gocheckcompilerdirectives v1.3.0 // indirect
4d63.com/gochecknoglobals v0.2.2 // indirect
codeberg.org/chavacava/garif v0.2.0 // indirect
codeberg.org/polyfloyd/go-errorlint v1.9.0 // indirect
dario.cat/mergo v1.0.1 // indirect dario.cat/mergo v1.0.1 // indirect
dev.gaijin.team/go/exhaustruct/v4 v4.0.0 // indirect github.com/BurntSushi/toml v1.2.1 // indirect
dev.gaijin.team/go/golib v0.6.0 // indirect
github.com/4meepo/tagalign v1.4.3 // indirect
github.com/Abirdcfly/dupword v0.1.7 // indirect
github.com/AdminBenni/iota-mixing v1.0.0 // indirect
github.com/AlwxSin/noinlineerr v1.0.5 // indirect
github.com/Antonboom/errname v1.1.1 // indirect
github.com/Antonboom/nilnil v1.1.1 // indirect
github.com/Antonboom/testifylint v1.6.4 // indirect
github.com/BurntSushi/toml v1.6.0 // indirect
github.com/Djarvur/go-err113 v0.1.1 // indirect
github.com/Kunde21/markdownfmt/v3 v3.1.0 // indirect github.com/Kunde21/markdownfmt/v3 v3.1.0 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.4.0 // indirect github.com/Masterminds/semver/v3 v3.2.0 // indirect
github.com/Masterminds/sprig/v3 v3.2.3 // indirect github.com/Masterminds/sprig/v3 v3.2.3 // indirect
github.com/MirrexOne/unqueryvet v1.5.4 // indirect github.com/ProtonMail/go-crypto v1.4.1 // indirect
github.com/OpenPeeDeeP/depguard/v2 v2.2.1 // indirect
github.com/ProtonMail/go-crypto v1.4.0 // indirect
github.com/agext/levenshtein v1.2.3 // indirect github.com/agext/levenshtein v1.2.3 // indirect
github.com/alecthomas/chroma/v2 v2.23.1 // indirect
github.com/alecthomas/go-check-sumtype v0.3.1 // indirect
github.com/alexkohler/nakedret/v2 v2.0.6 // indirect
github.com/alexkohler/prealloc v1.1.0 // indirect
github.com/alfatraining/structtag v1.0.0 // indirect
github.com/alingse/asasalint v0.0.11 // indirect
github.com/alingse/nilnesserr v0.2.0 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
github.com/armon/go-radix v1.0.0 // indirect github.com/armon/go-radix v1.0.0 // indirect
github.com/ashanbrown/forbidigo/v2 v2.3.0 // indirect
github.com/ashanbrown/makezero/v2 v2.1.0 // indirect
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bgentry/speakeasy v0.1.0 // indirect github.com/bgentry/speakeasy v0.1.0 // indirect
github.com/bkielbasa/cyclop v1.2.3 // indirect github.com/bmatcuk/doublestar/v4 v4.10.0 // indirect
github.com/blizzy78/varnamelen v0.8.0 // indirect
github.com/bmatcuk/doublestar/v4 v4.9.1 // indirect
github.com/bombsimon/wsl/v4 v4.7.0 // indirect
github.com/bombsimon/wsl/v5 v5.6.0 // indirect
github.com/breml/bidichk v0.3.3 // indirect
github.com/breml/errchkjson v0.4.1 // indirect
github.com/butuzov/ireturn v0.4.0 // indirect
github.com/butuzov/mirror v1.3.0 // indirect
github.com/catenacyber/perfsprint v0.10.1 // indirect
github.com/ccojocar/zxcvbn-go v1.0.4 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/charithe/durationcheck v0.0.11 // indirect
github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc // indirect
github.com/charmbracelet/lipgloss v1.1.0 // indirect
github.com/charmbracelet/x/ansi v0.10.1 // indirect
github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd // indirect
github.com/charmbracelet/x/term v0.2.1 // indirect
github.com/ckaznocha/intrange v0.3.1 // indirect
github.com/cloudflare/circl v1.6.3 // indirect github.com/cloudflare/circl v1.6.3 // indirect
github.com/curioswitch/go-reassign v0.3.0 // indirect github.com/fatih/color v1.19.0 // indirect
github.com/daixiang0/gci v0.13.7 // indirect github.com/golang-jwt/jwt/v5 v5.3.1 // indirect
github.com/dave/dst v0.27.3 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/denis-tingaikin/go-header v0.5.0 // indirect
github.com/dlclark/regexp2 v1.11.5 // indirect
github.com/ettle/strcase v0.2.0 // indirect
github.com/fatih/color v1.18.0 // indirect
github.com/fatih/structtag v1.2.0 // indirect
github.com/firefart/nonamedreturns v1.0.6 // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/fzipp/gocyclo v0.6.0 // indirect
github.com/ghostiam/protogetter v0.3.20 // indirect
github.com/go-critic/go-critic v0.14.3 // indirect
github.com/go-toolsmith/astcast v1.1.0 // indirect
github.com/go-toolsmith/astcopy v1.1.0 // indirect
github.com/go-toolsmith/astequal v1.2.0 // indirect
github.com/go-toolsmith/astfmt v1.1.0 // indirect
github.com/go-toolsmith/astp v1.1.0 // indirect
github.com/go-toolsmith/strparse v1.1.0 // indirect
github.com/go-toolsmith/typep v1.1.0 // indirect
github.com/go-viper/mapstructure/v2 v2.5.0 // indirect
github.com/go-xmlfmt/xmlfmt v1.1.3 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/godoc-lint/godoc-lint v0.11.2 // indirect
github.com/gofrs/flock v0.13.0 // indirect
github.com/golang/protobuf v1.5.4 // indirect github.com/golang/protobuf v1.5.4 // indirect
github.com/golangci/asciicheck v0.5.0 // indirect
github.com/golangci/dupl v0.0.0-20250308024227-f665c8d69b32 // indirect
github.com/golangci/go-printf-func-name v0.1.1 // indirect
github.com/golangci/gofmt v0.0.0-20250106114630-d62b90e6713d // indirect
github.com/golangci/golangci-lint/v2 v2.11.2 // indirect
github.com/golangci/golines v0.15.0 // indirect
github.com/golangci/misspell v0.8.0 // indirect
github.com/golangci/plugin-module-register v0.1.2 // indirect
github.com/golangci/revgrep v0.8.0 // indirect
github.com/golangci/swaggoswag v0.0.0-20250504205917-77f2aca3143e // indirect
github.com/golangci/unconvert v0.0.0-20250410112200-a129a6e6413e // indirect
github.com/gordonklaus/ineffassign v0.2.0 // indirect
github.com/gostaticanalysis/analysisutil v0.7.1 // indirect
github.com/gostaticanalysis/comment v1.5.0 // indirect
github.com/gostaticanalysis/forcetypeassert v0.2.0 // indirect
github.com/gostaticanalysis/nilerr v0.1.2 // indirect
github.com/hashicorp/cli v1.1.7 // indirect github.com/hashicorp/cli v1.1.7 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-checkpoint v0.5.0 // indirect github.com/hashicorp/go-checkpoint v0.5.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-cty v1.5.0 // indirect github.com/hashicorp/go-cty v1.5.0 // indirect
github.com/hashicorp/go-hclog v1.6.3 // indirect github.com/hashicorp/go-hclog v1.6.3 // indirect
github.com/hashicorp/go-immutable-radix/v2 v2.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-plugin v1.7.0 // indirect github.com/hashicorp/go-plugin v1.8.0 // indirect
github.com/hashicorp/go-uuid v1.0.3 // indirect github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/hashicorp/go-version v1.8.0 // indirect github.com/hashicorp/go-version v1.9.0 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect github.com/hashicorp/hc-install v0.9.5 // indirect
github.com/hashicorp/hc-install v0.9.3 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/hcl/v2 v2.24.0 // indirect github.com/hashicorp/hcl/v2 v2.24.0 // indirect
github.com/hashicorp/logutils v1.0.0 // indirect github.com/hashicorp/logutils v1.0.0 // indirect
github.com/hashicorp/terraform-exec v0.25.0 // indirect github.com/hashicorp/terraform-exec v0.25.2 // indirect
github.com/hashicorp/terraform-json v0.27.2 // indirect github.com/hashicorp/terraform-json v0.27.3-0.20260213134036-298b8f6b673a // indirect
github.com/hashicorp/terraform-plugin-docs v0.24.0 // indirect github.com/hashicorp/terraform-plugin-docs v0.25.0 // indirect
github.com/hashicorp/terraform-plugin-sdk/v2 v2.39.0 // indirect github.com/hashicorp/terraform-plugin-sdk/v2 v2.40.1 // indirect
github.com/hashicorp/terraform-registry-address v0.4.0 // indirect github.com/hashicorp/terraform-registry-address v0.4.0 // indirect
github.com/hashicorp/terraform-svchost v0.2.1 // indirect github.com/hashicorp/terraform-svchost v0.2.1 // indirect
github.com/hashicorp/yamux v0.1.2 // indirect github.com/hashicorp/yamux v0.1.2 // indirect
github.com/hexops/gotextdiff v1.0.3 // indirect
github.com/huandu/xstrings v1.3.3 // indirect github.com/huandu/xstrings v1.3.3 // indirect
github.com/imdario/mergo v0.3.15 // indirect github.com/imdario/mergo v0.3.15 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jgautheron/goconst v1.8.2 // indirect
github.com/jingyugao/rowserrcheck v1.1.1 // indirect
github.com/jjti/go-spancheck v0.6.5 // indirect
github.com/julz/importas v0.2.0 // indirect
github.com/karamaru-alpha/copyloopvar v1.2.2 // indirect
github.com/kisielk/errcheck v1.10.0 // indirect
github.com/kkHAIKE/contextcheck v1.1.6 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/kulti/thelper v0.7.1 // indirect
github.com/kunwardeep/paralleltest v1.0.15 // indirect
github.com/lasiar/canonicalheader v1.1.2 // indirect
github.com/ldez/exptostd v0.4.5 // indirect
github.com/ldez/gomoddirectives v0.8.0 // indirect
github.com/ldez/grignotin v0.10.1 // indirect
github.com/ldez/structtags v0.6.1 // indirect
github.com/ldez/tagliatelle v0.7.2 // indirect
github.com/ldez/usetesting v0.5.0 // indirect
github.com/leonklingele/grouper v1.1.2 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/macabu/inamedparam v0.2.0 // indirect
github.com/magiconair/properties v1.8.6 // indirect
github.com/manuelarte/embeddedstructfieldcheck v0.4.0 // indirect
github.com/manuelarte/funcorder v0.5.0 // indirect
github.com/maratori/testableexamples v1.0.1 // indirect
github.com/maratori/testpackage v1.1.2 // indirect
github.com/matoous/godox v1.1.0 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-isatty v0.0.22 // indirect
github.com/mattn/go-runewidth v0.0.16 // indirect github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/mgechev/revive v1.15.0 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/moricho/tparallel v0.3.2 // indirect
github.com/muesli/termenv v0.16.0 // indirect
github.com/nakabonne/nestif v0.3.1 // indirect
github.com/nishanths/exhaustive v0.12.0 // indirect
github.com/nishanths/predeclared v0.2.2 // indirect
github.com/nunnatsa/ginkgolinter v0.23.0 // indirect
github.com/oklog/run v1.2.0 // indirect github.com/oklog/run v1.2.0 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/posener/complete v1.2.3 // indirect github.com/posener/complete v1.2.3 // indirect
github.com/prometheus/client_golang v1.12.1 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.32.1 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/quasilyte/go-ruleguard v0.4.5 // indirect
github.com/quasilyte/go-ruleguard/dsl v0.3.23 // indirect
github.com/quasilyte/gogrep v0.5.0 // indirect
github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 // indirect
github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 // indirect
github.com/raeperd/recvcheck v0.2.0 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/rogpeppe/go-internal v1.14.1 // indirect
github.com/ryancurrah/gomodguard v1.4.1 // indirect
github.com/ryanrolds/sqlclosecheck v0.5.1 // indirect
github.com/sanposhiho/wastedassign/v2 v2.1.0 // indirect
github.com/santhosh-tekuri/jsonschema/v6 v6.0.2 // indirect
github.com/sashamelentyev/interfacebloat v1.1.0 // indirect
github.com/sashamelentyev/usestdlibvars v1.29.0 // indirect
github.com/securego/gosec/v2 v2.24.7 // indirect
github.com/shopspring/decimal v1.3.1 // indirect github.com/shopspring/decimal v1.3.1 // indirect
github.com/sirupsen/logrus v1.9.4 // indirect
github.com/sivchari/containedctx v1.0.3 // indirect
github.com/sonatard/noctx v0.5.0 // indirect
github.com/sourcegraph/go-diff v0.7.0 // indirect
github.com/spf13/afero v1.15.0 // indirect
github.com/spf13/cast v1.5.0 // indirect github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.10 // indirect github.com/spf13/pflag v1.0.10 // indirect
github.com/spf13/viper v1.12.0 // indirect
github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect
github.com/stbenjam/no-sprintf-host-port v0.3.1 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/stretchr/testify v1.11.1 // indirect github.com/stretchr/testify v1.11.1 // indirect
github.com/subosito/gotenv v1.4.1 // indirect
github.com/tetafro/godot v1.5.4 // indirect
github.com/timakin/bodyclose v0.0.0-20241222091800-1db5c5ca4d67 // indirect
github.com/timonwong/loggercheck v0.11.0 // indirect
github.com/tomarrell/wrapcheck/v2 v2.12.0 // indirect
github.com/tommy-muehle/go-mnd/v2 v2.5.1 // indirect
github.com/ultraware/funlen v0.2.0 // indirect
github.com/ultraware/whitespace v0.2.0 // indirect
github.com/uudashr/gocognit v1.2.1 // indirect
github.com/uudashr/iface v1.4.1 // indirect
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/xen0n/gosmopolitan v1.3.0 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
github.com/yagipy/maintidx v1.0.0 // indirect
github.com/yeya24/promlinter v0.3.0 // indirect
github.com/ykadowak/zerologlint v0.1.5 // indirect
github.com/yuin/goldmark v1.7.7 // indirect github.com/yuin/goldmark v1.7.7 // indirect
github.com/yuin/goldmark-meta v1.1.0 // indirect github.com/yuin/goldmark-meta v1.1.0 // indirect
github.com/zclconf/go-cty v1.18.0 // indirect github.com/zclconf/go-cty v1.18.1 // indirect
gitlab.com/bosi/decorder v0.4.2 // indirect
go-simpler.org/musttag v0.14.0 // indirect
go-simpler.org/sloglint v0.11.1 // indirect
go.abhg.dev/goldmark/frontmatter v0.2.0 // indirect go.abhg.dev/goldmark/frontmatter v0.2.0 // indirect
go.augendre.info/arangolint v0.4.0 // indirect golang.org/x/crypto v0.50.0 // indirect
go.augendre.info/fatcontext v0.9.0 // indirect golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect
go.uber.org/multierr v1.10.0 // indirect golang.org/x/mod v0.35.0 // indirect
go.uber.org/zap v1.27.0 // indirect golang.org/x/net v0.53.0 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect golang.org/x/sync v0.20.0 // indirect
golang.org/x/crypto v0.48.0 // indirect golang.org/x/sys v0.43.0 // indirect
golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b // indirect golang.org/x/text v0.36.0 // indirect
golang.org/x/exp/typeparams v0.0.0-20260209203927-2842357ff358 // indirect golang.org/x/tools v0.44.0 // indirect
golang.org/x/mod v0.33.0 // indirect
golang.org/x/net v0.51.0 // indirect
golang.org/x/sync v0.19.0 // indirect
golang.org/x/sys v0.41.0 // indirect
golang.org/x/text v0.34.0 // indirect
golang.org/x/tools v0.42.0 // indirect
google.golang.org/appengine v1.6.8 // indirect google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260226221140-a57be14db171 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20260504160031-60b97b32f348 // indirect
google.golang.org/grpc v1.79.2 // indirect google.golang.org/grpc v1.81.0 // indirect
google.golang.org/protobuf v1.36.11 // indirect google.golang.org/protobuf v1.36.11 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect
honnef.co/go/tools v0.7.0 // indirect
mvdan.cc/gofumpt v0.9.2 // indirect
mvdan.cc/unparam v0.0.0-20251027182757-5beb8c8f8f15 // indirect
) )

997
go.sum

File diff suppressed because it is too large Load diff

97
golang-ci.yaml.bak Normal file
View file

@ -0,0 +1,97 @@
version: "2"
run:
concurrency: 4
output:
formats:
text:
print-linter-name: true
print-issued-lines: true
colors: true
path: stdout
linters:
enable:
- bodyclose
- depguard
- errorlint
- forcetypeassert
- gochecknoinits
- gocritic
- gosec
- misspell
- nakedret
- revive
- sqlclosecheck
- wastedassign
disable:
- noctx
- unparam
settings:
depguard:
rules:
main:
list-mode: lax
allow:
- tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview
- github.com/hashicorp/terraform-plugin-framework
- github.com/hashicorp/terraform-plugin-log
- github.com/stackitcloud/stackit-sdk-go
deny:
- pkg: github.com/stretchr/testify
desc: Do not use a testing framework
gocritic:
disabled-checks:
- wrapperFunc
- typeDefFirst
- ifElseChain
- dupImport
- hugeParam
enabled-tags:
- performance
- style
- experimental
gosec:
excludes:
- G104
- G102
- G304
- G307
misspell:
locale: US
nakedret:
max-func-lines: 0
revive:
severity: error
rules:
- name: errorf
- name: context-as-argument
- name: error-return
- name: increment-decrement
- name: indent-error-flow
- name: superfluous-else
- name: unused-parameter
- name: unreachable-code
- name: atomic
- name: empty-lines
- name: early-return
exclusions:
paths:
- stackit-sdk-generator/
- generated/
- pkg_gen/
generated: lax
warn-unused: true
# Excluding configuration per-path, per-linter, per-text and per-source.
rules:
# Exclude some linters from running on tests files.
- path: _test\.go
linters:
- gochecknoinits
formatters:
enable:
- gofmt
- goimports
settings:
goimports:
local-prefixes:
- tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview

View file

@ -53,7 +53,7 @@ func CreateTemporaryHome(createValidCredentialsFile bool, t *testing.T) string {
// Define content, default = invalid token // Define content, default = invalid token
token := "foo_token" token := "foo_token"
//if createValidCredentialsFile { // if createValidCredentialsFile {
// token = GetTestProjectServiceAccountJson("") // token = GetTestProjectServiceAccountJson("")
//} //}
if _, err = file.WriteString(token); err != nil { if _, err = file.WriteString(token); err != nil {

View file

@ -99,7 +99,7 @@ func ResourceNameWithDateTime(name string) string {
return fmt.Sprintf("tf-acc-%s-%s", name, dateTimeTrimmed) return fmt.Sprintf("tf-acc-%s-%s", name, dateTimeTrimmed)
} }
//func GetTestProjectServiceAccountJson(path string) string { // func GetTestProjectServiceAccountJson(path string) string {
// var err error // var err error
// json, ok := os.LookupEnv("TF_ACC_SERVICE_ACCOUNT_JSON_CONTENT") // json, ok := os.LookupEnv("TF_ACC_SERVICE_ACCOUNT_JSON_CONTENT")
// if !ok || json == "" { // if !ok || json == "" {
@ -153,7 +153,7 @@ func ResourceNameWithDateTime(name string) string {
// return credentials.TF_ACC_TEST_PROJECT_SERVICE_ACCOUNT_TOKEN, nil // return credentials.TF_ACC_TEST_PROJECT_SERVICE_ACCOUNT_TOKEN, nil
//} //}
//func readTestServiceAccountJsonFromFile(path string) (string, error) { // func readTestServiceAccountJsonFromFile(path string) (string, error) {
// if path == "" { // if path == "" {
// customPath, ok := os.LookupEnv("TF_ACC_SERVICE_ACCOUNT_FILE") // customPath, ok := os.LookupEnv("TF_ACC_SERVICE_ACCOUNT_FILE")
// if !ok || customPath == "" { // if !ok || customPath == "" {

7
sample/.gitignore vendored Normal file
View file

@ -0,0 +1,7 @@
*.json
*.bak
*.tfstate
*.tfstate.backup
terraform
variables.tf
*.tfrc

View file

@ -0,0 +1,38 @@
resource "stackit_kms_keyring" "mshalpha-keyring" {
project_id = var.project_id
display_name = "msh-alpha-tests"
description = "This is a test keyring for private endpoints"
}
resource "stackit_kms_key" "mshalpha-key01" {
project_id = var.project_id
keyring_id = stackit_kms_keyring.mshalpha-keyring.keyring_id
display_name = "mshalpha-key01"
protection = "software"
algorithm = "aes_256_gcm"
purpose = "symmetric_encrypt_decrypt"
access_scope = "SNA"
}
output "keyid" {
value = stackit_kms_key.mshalpha-key01.key_id
}
# (because stackit_kms_key.key001 is not in configuration)
resource "stackit_kms_key" "key001" {
access_scope = "SNA"
algorithm = "aes_256_gcm"
display_name = "msh-key-sna01"
keyring_id = stackit_kms_keyring.keyring001.keyring_id
project_id = var.project_id
protection = "software"
purpose = "symmetric_encrypt_decrypt"
}
# stackit_kms_keyring.keyring001 will be destroyed
# (because stackit_kms_keyring.keyring001 is not in configuration)
resource "stackit_kms_keyring" "keyring001" {
description = "This is a test keyring for private endpoints"
display_name = "msh-keyring-sna01"
project_id = var.project_id
}

View file

@ -0,0 +1,96 @@
data "stackitprivatepreview_postgresflexalpha_flavor" "pgsql_flavor" {
project_id = var.project_id
region = "eu01"
cpu = 2
ram = 4
node_type = "Single"
storage_class = "premium-perf2-stackit"
}
resource "stackitprivatepreview_postgresflexalpha_instance" "msh-alpha-sna-enc" {
project_id = var.project_id
name = "msh-alpha-sna-enc"
backup_schedule = "0 0 * * *"
retention_days = 45
flavor_id = data.stackitprivatepreview_postgresflexalpha_flavor.pgsql_flavor.flavor_id
replicas = 1
storage = {
performance_class = "premium-perf2-stackit"
size = 10
}
encryption = {
kek_key_id = stackit_kms_key.mshalpha-key01.key_id
kek_key_ring_id = stackit_kms_keyring.mshalpha-keyring.keyring_id
kek_key_version = 1
service_account = var.sa_email
}
network = {
acl = ["0.0.0.0/0", "193.148.160.0/19", "170.85.2.177/32"]
access_scope = "SNA"
}
version = 17
}
resource "stackitprivatepreview_postgresflexalpha_instance" "msh-alpha-nosna-noenc" {
project_id = var.project_id
name = "msh-alpha-nosna-enc"
backup_schedule = "0 0 * * *"
retention_days = 45
flavor_id = data.stackitprivatepreview_postgresflexalpha_flavor.pgsql_flavor.flavor_id
replicas = 1
storage = {
performance_class = "premium-perf2-stackit"
size = 10
}
network = {
acl = ["0.0.0.0/0", "193.148.160.0/19", "170.85.2.177/32"]
access_scope = "PUBLIC"
}
version = 16
}
resource "stackitprivatepreview_postgresflexalpha_user" "ptlsdbadminuser" {
project_id = var.project_id
instance_id = stackitprivatepreview_postgresflexalpha_instance.msh-alpha-sna-enc.instance_id
name = var.db_admin_username
roles = ["createdb", "login"]
# roles = ["createdb", "login", "createrole"]
}
resource "stackitprivatepreview_postgresflexalpha_user" "ptlsdbuser" {
project_id = var.project_id
instance_id = stackitprivatepreview_postgresflexalpha_instance.msh-alpha-sna-enc.instance_id
name = var.db_username
roles = ["login"]
# roles = ["createdb", "login", "createrole"]
}
resource "stackitprivatepreview_postgresflexalpha_database" "example" {
count = 5
depends_on = [stackitprivatepreview_postgresflexalpha_user.ptlsdbadminuser]
project_id = var.project_id
instance_id = stackitprivatepreview_postgresflexalpha_instance.msh-alpha-sna-enc.instance_id
name = "${var.db_name}${count.index}"
owner = var.db_admin_username
}
# data "stackitprivatepreview_postgresflexalpha_instance" "datapsql" {
# project_id = var.project_id
# instance_id = var.instance_id
# region = "eu01"
# }
# output "psql_instance_id" {
# value = data.stackitprivatepreview_postgresflexalpha_instance.datapsql.instance_id
# }
output "psql_user_password" {
value = stackitprivatepreview_postgresflexalpha_user.ptlsdbuser.password
sensitive = true
}
# output "psql_user_conn" {
# value = stackitprivatepreview_postgresflexalpha_user.ptlsdbuser.connection_string
# sensitive = true
# }

View file

@ -0,0 +1,24 @@
terraform {
required_providers {
stackit = {
source = "registry.terraform.io/stackitcloud/stackit"
version = "~> 0.70"
}
stackitprivatepreview = {
source = "tfregistry.sysops.stackit.rocks/mhenselin/stackitprivatepreview"
version = ">=0.1.0"
}
}
}
provider "stackit" {
default_region = "eu01"
enable_beta_resources = true
service_account_key_path = "../service_account.json"
}
provider "stackitprivatepreview" {
default_region = "eu01"
service_account_key_path = "../service_account.json"
}

View file

@ -0,0 +1,10 @@
provider_installation {
dev_overrides {
"registry.terraform.io/mhenselin/stackitprivatepreview" = "<CURRENT PROJECT PATH>/bin/"
}
# For all other providers, install them directly from their origin provider
# registries as normal. If you omit this, Terraform will _only_ use
# the dev_overrides block, and so no other providers will be available.
direct {}
}

57
sample/kms/kms.tf Normal file
View file

@ -0,0 +1,57 @@
resource "stackit_kms_keyring" "keyring001" {
project_id = var.project_id
display_name = "msh-keyring-sna01"
description = "This is a test keyring for private endpoints"
}
resource "stackit_kms_key" "key001" {
project_id = var.project_id
keyring_id = stackit_kms_keyring.keyring001.keyring_id
display_name = "msh-key-sna01"
protection = "software"
algorithm = "aes_256_gcm"
purpose = "symmetric_encrypt_decrypt"
access_scope = "SNA"
}
# data "stackitprivatepreview_sqlserverflexalpha_instance" "test" {
# project_id = var.project_id
# instance_id = var.instance_id
# region = "eu01"
# }
output "key_ring_id" {
value = stackit_kms_keyring.keyring001.id
}
resource "stackit_kms_keyring" "keyring001yy" {
project_id = var.project_id
display_name = "msh-kr-sna01"
description = "This is a test keyring for private endpoints"
}
resource "stackit_kms_key" "key001yy" {
project_id = var.project_id
keyring_id = stackit_kms_keyring.keyring001yy.keyring_id
display_name = "msh-k-001"
protection = "software"
algorithm = "aes_256_gcm"
purpose = "symmetric_encrypt_decrypt"
access_scope = "SNA"
}
# data "stackitprivatepreview_sqlserverflexalpha_instance" "test" {
# project_id = var.project_id
# instance_id = var.instance_id
# region = "eu01"
# }
output "key_ring_idxx" {
value = stackit_kms_keyring.keyring001yy.id
}
output "key_id" {
value = stackit_kms_key.key001yy.id
}

25
sample/kms/providers.tf Normal file
View file

@ -0,0 +1,25 @@
terraform {
required_providers {
stackit = {
source = "registry.terraform.io/stackitcloud/stackit"
version = "~> 0.70"
}
# stackitprivatepreview = {
# source = "tfregistry.sysops.stackit.rocks/mhenselin/stackitprivatepreview"
# version = "= 0.0.2-alpha"
# }
}
}
provider "stackit" {
default_region = "eu01"
enable_beta_resources = true
service_account_key_path = "../service_account.json"
}
# provider "stackitprivatepreview" {
# default_region = "eu01"
# enable_beta_resources = true
# service_account_key_path = "../service_account.json"
# }

View file

@ -0,0 +1,4 @@
#
# output "postgres_flavor" {
# value = data.stackitprivatepreview_postgresflexalpha_flavor.pgsql_flavor.flavor_id
# }

View file

@ -0,0 +1,45 @@
data "stackitprivatepreview_postgresflexalpha_flavor" "pgsql_flavor" {
project_id = var.project_id
region = "eu01"
cpu = 2
ram = 4
node_type = "Single"
storage_class = "premium-perf2-stackit"
}
resource "stackitprivatepreview_postgresflexalpha_instance" "import_for_deletion" {
project_id = var.project_id
name = "mshpetest2"
backup_schedule = "0 0 * * *"
retention_days = 45
flavor_id = data.stackitprivatepreview_postgresflexalpha_flavor.pgsql_flavor.flavor_id
replicas = 1
storage = {
# class = "premium-perf2-stackit"
performance_class = "premium-perf2-stackit"
size = 10
}
encryption = {
# key_id = stackit_kms_key.key.key_id
# keyring_id = stackit_kms_keyring.keyring.keyring_id
kek_key_id = var.key_id
kek_key_ring_id = var.keyring_id
kek_key_version = var.key_version
service_account = var.sa_email
}
network = {
acl = ["0.0.0.0/0", "193.148.160.0/19", "170.85.2.177/32"]
access_scope = "PUBLIC"
}
version = 14
}
import {
to = stackitprivatepreview_postgresflexalpha_instance.import_for_deletion
identity = {
project_id = var.project_id
region = "eu01"
instance_id = "d52b5d4c-be3f-4c14-a107-330dab99fd2e"
}
}

View file

@ -0,0 +1,25 @@
terraform {
required_providers {
# stackit = {
# source = "registry.terraform.io/stackitcloud/stackit"
# version = "~> 0.70"
# }
stackitprivatepreview = {
source = "tfregistry.sysops.stackit.rocks/mhenselin/stackitprivatepreview"
version = "> 0.0"
}
}
}
# provider "stackit" {
# default_region = "eu01"
# enable_beta_resources = true
# service_account_key_path = "./service_account.json"
# }
provider "stackitprivatepreview" {
default_region = "eu01"
enable_beta_resources = true
service_account_key_path = "../service_account.json"
}

View file

@ -0,0 +1,11 @@
variable "project_id" {
default = "<PROJECT ID UUID>"
}
variable "sa_email" {
default = "<SERVICE ACCOUNT EMAIL>"
}
variable "db_username" {
default = "<DB USERNAME>"
}

View file

View file

@ -0,0 +1,17 @@
data "stackitprivatepreview_postgresflexalpha_flavor" "pgsql_flavor" {
project_id = var.project_id
region = "eu01"
cpu = 2
ram = 4
node_type = "Single"
storage_class = "premium-perf2-stackit"
}
data "stackitprivatepreview_postgresflexalpha_flavor" "pgsql_flavor2"{
project_id = var.project_id
region = "eu01"
cpu = 2
ram = 4
node_type = "Single"
storage_class = "premium-perf2-stackit"
}

View file

@ -0,0 +1,25 @@
terraform {
required_providers {
# stackit = {
# source = "registry.terraform.io/stackitcloud/stackit"
# version = "~> 0.70"
# }
stackitprivatepreview = {
source = "tfregistry.sysops.stackit.rocks/mhenselin/stackitprivatepreview"
version = "> 0.0"
}
}
}
# provider "stackit" {
# default_region = "eu01"
# enable_beta_resources = true
# service_account_key_path = "./service_account.json"
# }
provider "stackitprivatepreview" {
default_region = "eu01"
enable_beta_resources = true
service_account_key_path = "/home/henselinm/Development/PTLS/terraform-provider-stackit-MSH/sample/pg_instance/service_account.json"
}

View file

@ -0,0 +1,11 @@
variable "project_id" {
default = "<PROJECT ID UUID>"
}
variable "sa_email" {
default = "<SERVICE ACCOUNT EMAIL>"
}
variable "db_username" {
default = "<DB USERNAME>"
}

View file

@ -0,0 +1,4 @@
output "postgres_flavor" {
value = data.stackitprivatepreview_postgresflexalpha_flavor.pgsql_flavor.flavor_id
}

View file

@ -0,0 +1,125 @@
data "stackitprivatepreview_postgresflexalpha_flavor" "pgsql_flavor" {
project_id = var.project_id
region = "eu01"
cpu = 2
ram = 4
node_type = "Single"
storage_class = "premium-perf2-stackit"
}
resource "stackitprivatepreview_postgresflexalpha_instance" "msh-sna-pe-example" {
project_id = var.project_id
name = "mshpetest2"
backup_schedule = "0 0 * * *"
retention_days = 45
# flavor_id = data.stackitprivatepreview_postgresflexalpha_flavor.pgsql_flavor.flavor_id
flavor = {
cpu = 2
ram = 4
}
replicas = 1
storage = {
# class = "premium-perf2-stackit"
performance_class = "premium-perf2-stackit"
size = 10
}
encryption = {
# key_id = stackit_kms_key.key.key_id
# keyring_id = stackit_kms_keyring.keyring.keyring_id
kek_key_id = var.key_id
kek_key_ring_id = var.keyring_id
kek_key_version = var.key_version
service_account = var.sa_email
}
network = {
acl = ["0.0.0.0/0", "193.148.160.0/19", "170.85.2.177/32"]
access_scope = "PUBLIC"
}
version = 17
}
resource "stackitprivatepreview_postgresflexalpha_instance" "msh-sna-pe-example2" {
project_id = var.project_id
name = "mshpetest2-1"
backup_schedule = "0 0 * * *"
retention_days = 45
flavor_id = data.stackitprivatepreview_postgresflexalpha_flavor.pgsql_flavor.flavor_id
replicas = 1
storage = {
# class = "premium-perf2-stackit"
performance_class = "premium-perf2-stackit"
size = 10
}
encryption = {
# key_id = stackit_kms_key.key.key_id
# keyring_id = stackit_kms_keyring.keyring.keyring_id
kek_key_id = var.key_id
kek_key_ring_id = var.keyring_id
kek_key_version = var.key_version
service_account = var.sa_email
}
network = {
acl = ["0.0.0.0/0", "193.148.160.0/19", "170.85.2.177/32"]
access_scope = "SNA"
}
version = 16
}
resource "stackitprivatepreview_postgresflexalpha_user" "ptlsdbadminuser" {
project_id = var.project_id
instance_id = stackitprivatepreview_postgresflexalpha_instance.msh-sna-pe-example.instance_id
name = var.db_admin_username
roles = ["createdb", "login"]
# roles = ["createdb", "login", "login"]
# roles = ["createdb", "login", "createrole"]
}
resource "stackitprivatepreview_postgresflexalpha_user" "ptlsdbadminuser2" {
project_id = var.project_id
instance_id = stackitprivatepreview_postgresflexalpha_instance.msh-sna-pe-example2.instance_id
name = var.db_admin_username
roles = ["createdb", "login"]
# roles = ["createdb", "login", "createrole"]
}
resource "stackitprivatepreview_postgresflexalpha_user" "ptlsdbuser" {
project_id = var.project_id
instance_id = stackitprivatepreview_postgresflexalpha_instance.msh-sna-pe-example.instance_id
name = var.db_name
roles = ["login"]
# roles = ["createdb", "login", "createrole"]
}
resource "stackitprivatepreview_postgresflexalpha_database" "example" {
count = 5
depends_on = [stackitprivatepreview_postgresflexalpha_user.ptlsdbadminuser]
project_id = var.project_id
instance_id = stackitprivatepreview_postgresflexalpha_instance.msh-sna-pe-example.instance_id
name = "${var.db_name}${count.index}"
owner = var.db_admin_username
}
# data "stackitprivatepreview_postgresflexalpha_instance" "datapsql" {
# project_id = var.project_id
# instance_id = var.instance_id
# region = "eu01"
# }
# output "psql_instance_id" {
# value = data.stackitprivatepreview_postgresflexalpha_instance.datapsql.instance_id
# }
output "psql_user_password" {
value = stackitprivatepreview_postgresflexalpha_user.ptlsdbuser.password
sensitive = true
}
# output "psql_user_conn" {
# value = stackitprivatepreview_postgresflexalpha_user.ptlsdbuser.connection.host
# sensitive = true
# }
output "determined_flavor_id" {
value = stackitprivatepreview_postgresflexalpha_instance.msh-sna-pe-example.flavor_id
}

View file

@ -0,0 +1,25 @@
terraform {
required_providers {
# stackit = {
# source = "registry.terraform.io/stackitcloud/stackit"
# version = "~> 0.70"
# }
stackitprivatepreview = {
source = "tfregistry.sysops.stackit.rocks/mhenselin/stackitprivatepreview"
version = "> 0.0"
}
}
}
# provider "stackit" {
# default_region = "eu01"
# enable_beta_resources = true
# service_account_key_path = "./service_account.json"
# }
provider "stackitprivatepreview" {
default_region = "eu01"
enable_beta_resources = true
service_account_key_path = "../service_account.json"
}

View file

@ -0,0 +1,11 @@
variable "project_id" {
default = "<PROJECT ID UUID>"
}
variable "sa_email" {
default = "<SERVICE ACCOUNT EMAIL>"
}
variable "db_username" {
default = "<DB USERNAME>"
}

View file

@ -0,0 +1,13 @@
data "stackitprivatepreview_sqlserverflexbeta_flavor" "sqlserver_flavor" {
project_id = var.project_id
region = "eu01"
cpu = 4
ram = 16
node_type = "Single"
storage_class = "premium-perf2-stackit"
}
output "sqlserver_flavor" {
value = data.stackitprivatepreview_sqlserverflexbeta_flavor.sqlserver_flavor.flavor_id
}

View file

@ -0,0 +1,25 @@
terraform {
required_providers {
# stackit = {
# source = "registry.terraform.io/stackitcloud/stackit"
# version = "~> 0.70"
# }
stackitprivatepreview = {
source = "tfregistry.sysops.stackit.rocks/mhenselin/stackitprivatepreview"
version = "> 0.0"
}
}
}
# provider "stackit" {
# default_region = "eu01"
# enable_beta_resources = true
# service_account_key_path = "../service_account.json"
# }
provider "stackitprivatepreview" {
default_region = "eu01"
enable_beta_resources = true
service_account_key_path = "../service_account.json"
}

View file

@ -0,0 +1,63 @@
# resource "stackit_kms_keyring" "keyring" {
# project_id = var.project_id
# display_name = "msh-keyring01"
# description = "This is a test keyring for private endpoints"
# }
#
# resource "stackit_kms_key" "key" {
# project_id = var.project_id
# keyring_id = stackit_kms_keyring.keyring.keyring_id
# display_name = "msh-key01"
# protection = "software"
# algorithm = "aes_256_gcm"
# purpose = "symmetric_encrypt_decrypt"
# access_scope = "SNA"
# }
#
# output "keyid" {
# value = stackit_kms_key.key.key_id
# }
resource "stackitprivatepreview_sqlserverflexbeta_instance" "msh-beta-sna-001" {
project_id = var.project_id
name = "msh-beta-sna-001"
backup_schedule = "0 3 * * *"
retention_days = 31
flavor_id = data.stackitprivatepreview_sqlserverflexbeta_flavor.sqlserver_flavor.flavor_id
storage = {
class = "premium-perf2-stackit"
size = 10
}
version = 2022
encryption = {
#key_id = stackit_kms_key.key.key_id
#keyring_id = stackit_kms_keyring.keyring.keyring_id
#key_version = 1
# key with scope public
# kek_key_id = "fe039bcf-8d7b-431a-801d-9e81371a6b7b"
kek_key_id = "c6878f92-ce55-4b79-8236-ba9d001d7967" # msh-k-001
# key_id = var.key_id
# kek_key_ring_id = var.keyring_id
kek_key_ring_id = "0dea3f5f-9947-4dda-a9d3-18418832cefe" # msh-kr-sna01
kek_key_version = var.key_version
service_account = var.sa_email
}
network = {
acl = ["0.0.0.0/0", "193.148.160.0/19"]
access_scope = "SNA"
}
}
resource "stackitprivatepreview_sqlserverflexbeta_user" "betauser" {
project_id = var.project_id
instance_id = stackitprivatepreview_sqlserverflexbeta_instance.msh-beta-sna-001.instance_id
username = "betauser"
roles = ["##STACKIT_DatabaseManager##", "##STACKIT_LoginManager##"]
}
resource "stackitprivatepreview_sqlserverflexbeta_database" "betadb" {
project_id = var.project_id
instance_id = stackitprivatepreview_sqlserverflexbeta_instance.msh-beta-sna-001.instance_id
name = "mshtest002"
owner = stackitprivatepreview_sqlserverflexbeta_user.betauser.username
}

View file

@ -0,0 +1,11 @@
variable "project_id" {
default = "<PROJECT ID UUID>"
}
variable "sa_email" {
default = "<SERVICE ACCOUNT EMAIL>"
}
variable "db_username" {
default = "<DB USERNAME>"
}

View file

@ -0,0 +1,13 @@
#
# data "stackitprivatepreview_sqlserverflexalpha_flavor" "sqlserver_flavor" {
# project_id = var.project_id
# region = "eu01"
# cpu = 4
# ram = 16
# node_type = "Single"
# storage_class = "premium-perf2-stackit"
# }
#
# output "sqlserver_flavor" {
# value = data.stackitprivatepreview_sqlserverflexalpha_flavor.sqlserver_flavor.flavor_id
# }

View file

@ -0,0 +1,9 @@
data "stackitprivatepreview_postgresflexalpha_flavor" "pgsql_flavor" {
project_id = var.project_id
region = "eu01"
cpu = 2
ram = 4
node_type = "Single"
storage_class = "premium-perf2-stackit"
}

View file

@ -0,0 +1,25 @@
terraform {
required_providers {
# stackit = {
# source = "registry.terraform.io/stackitcloud/stackit"
# version = "~> 0.70"
# }
stackitprivatepreview = {
source = "tfregistry.sysops.stackit.rocks/mhenselin/stackitprivatepreview"
version = "> 0.0"
}
}
}
# provider "stackit" {
# default_region = "eu01"
# enable_beta_resources = true
# service_account_key_path = "../service_account.json"
# }
provider "stackitprivatepreview" {
default_region = "eu01"
enable_beta_resources = true
service_account_key_path = "../service_account.json"
}

View file

@ -0,0 +1,116 @@
data "stackitprivatepreview_sqlserverflexbeta_flavor" "sqlserver_flavor" {
project_id = var.project_id
region = "eu01"
cpu = 4
ram = 16
node_type = "Single"
storage_class = "premium-perf2-stackit"
}
data "stackitprivatepreview_sqlserverflexbeta_flavor" "sqlserver_flavor_2" {
project_id = var.project_id
region = "eu01"
cpu = 4
ram = 32
node_type = "Replica"
storage_class = "premium-perf2-stackit"
}
resource "stackitprivatepreview_sqlserverflexbeta_instance" "msh-beta-nosna-001" {
project_id = var.project_id
name = "msh-beta-nosna-001-renamed"
backup_schedule = "0 3 * * *"
retention_days = 31
flavor_id = data.stackitprivatepreview_sqlserverflexbeta_flavor.sqlserver_flavor.flavor_id
storage = {
class = "premium-perf2-stackit"
size = 50
}
version = 2022
network = {
acl = ["0.0.0.0/0", "193.148.160.0/19"]
access_scope = "PUBLIC"
}
}
resource "stackitprivatepreview_sqlserverflexbeta_instance" "msh-beta-sna-001" {
project_id = var.project_id
name = "msh-beta-sna-001"
backup_schedule = "0 3 * * *"
retention_days = 31
flavor_id = data.stackitprivatepreview_sqlserverflexbeta_flavor.sqlserver_flavor.flavor_id
storage = {
class = "premium-perf2-stackit"
size = 5
}
version = 2022
encryption = {
#key_id = stackit_kms_key.key.key_id
#keyring_id = stackit_kms_keyring.keyring.keyring_id
#key_version = 1
# key with scope public
kek_key_id = "fe039bcf-8d7b-431a-801d-9e81371a6b7b"
# key_id = var.key_id
kek_key_ring_id = var.keyring_id
kek_key_version = var.key_version
service_account = var.sa_email
}
network = {
acl = ["0.0.0.0/0", "193.148.160.0/19"]
access_scope = "SNA"
}
}
resource "stackitprivatepreview_sqlserverflexbeta_user" "exampleuseruno" {
project_id = var.project_id
instance_id = stackitprivatepreview_sqlserverflexbeta_instance.msh-beta-nosna-001.instance_id
username = "exampleuserdue"
roles = ["##STACKIT_ProcessManager##", "##STACKIT_LoginManager##", "##STACKIT_ServerManager##"]
}
resource "stackitprivatepreview_sqlserverflexbeta_user" "exampleuser" {
project_id = var.project_id
instance_id = stackitprivatepreview_sqlserverflexbeta_instance.msh-beta-nosna-001.instance_id
username = "exampleuser"
roles = ["##STACKIT_LoginManager##"]
}
resource "stackitprivatepreview_sqlserverflexbeta_database" "mshtest002" {
project_id = var.project_id
instance_id = stackitprivatepreview_sqlserverflexbeta_instance.msh-beta-nosna-001.instance_id
name = "mshtest002"
# owner = "dbuser"
owner = stackitprivatepreview_sqlserverflexbeta_user.exampleuseruno.username
}
# data "stackitprivatepreview_sqlserverflexbeta_database" "example" {
# project_id = var.project_id
# region = "eu01"
# instance_id = "b3b63d0c-35bf-4804-84ea-5abec2a8ae58"
# database_name = "mshtest001"
# }
# output "dbdetails" {
# value = data.stackitprivatepreview_sqlserverflexbeta_database.example
# }
#
# resource "stackitprivatepreview_sqlserverflexbeta_database" "mshtest" {
# project_id = var.project_id
# instance_id = "b3b63d0c-35bf-4804-84ea-5abec2a8ae58"
# name = "mshtest"
# owner = "dbuser"
# }
#
# import {
# to = stackitprivatepreview_sqlserverflexbeta_database.mshtest
# identity = {
# project_id = var.project_id
# region = "eu01"
# instance_id = "b3b63d0c-35bf-4804-84ea-5abec2a8ae58"
# database_name = "mshtest"
# }
# }

View file

@ -0,0 +1,11 @@
variable "project_id" {
default = "<PROJECT ID UUID>"
}
variable "sa_email" {
default = "<SERVICE ACCOUNT EMAIL>"
}
variable "db_username" {
default = "<DB USERNAME>"
}

52
sample/tf.sh Executable file
View file

@ -0,0 +1,52 @@
#!/usr/bin/env bash
# ./tf.sh apply > >(tee -a stdout.log) 2> >(tee -a stderr.log >&2)
usage() {
echo "$0 usage:" && grep "[[:space:]].)\ #" "$0" | sed 's/#//' | sed -r 's/([a-z])\)/-\1/';
exit 0;
}
[ $# -eq 0 ] && usage
CONFIG_FOLDER=$(dirname "$0")
# BINARY=terraform
BINARY=tofu
ADD=""
while getopts ":b:hdirt" arg; do
case $arg in
b) # Set binary (default is terraform).
BINARY=${OPTARG}
shift 2
;;
d) # Set log level to DEBUG.
TF_LOG=DEBUG
export TF_LOG
shift
;;
i) # Set log level to INFO.
TF_LOG=INFO
export TF_LOG
shift
;;
r) # Set log level to INFO.
ADD="-refresh-only"
shift
;;
t) # Set log level to TRACE.
TF_LOG=TRACE
export TF_LOG
shift
;;
h | *) # Display help.
usage
;;
esac
done
TERRAFORM_CONFIG=${CONFIG_FOLDER}/config.tfrc
export TERRAFORM_CONFIG
${BINARY} "$@" ${ADD}

View file

@ -2,7 +2,7 @@ provider:
name: stackitprivatepreview name: stackitprivatepreview
data_sources: data_sources:
collation: collations:
read: read:
path: /v3beta1/projects/{projectId}/regions/{region}/instances/{instanceId}/collations path: /v3beta1/projects/{projectId}/regions/{region}/instances/{instanceId}/collations
method: GET method: GET

View file

@ -3,7 +3,7 @@ provider:
name: stackitprivatepreview name: stackitprivatepreview
data_sources: data_sources:
version: versions:
read: read:
path: /v3beta1/projects/{projectId}/regions/{region}/versions path: /v3beta1/projects/{projectId}/regions/{region}/versions
method: GET method: GET

View file

@ -45,7 +45,7 @@ func DatabaseDataSourceSchema(ctx context.Context) schema.Schema {
MarkdownDescription: "The STACKIT project ID.", MarkdownDescription: "The STACKIT project ID.",
}, },
"region": schema.StringAttribute{ "region": schema.StringAttribute{
Required: true, Optional: true,
Description: "The region which should be addressed", Description: "The region which should be addressed",
MarkdownDescription: "The region which should be addressed", MarkdownDescription: "The region which should be addressed",
Validators: []validator.String{ Validators: []validator.String{

View file

@ -64,17 +64,21 @@ func mapResourceFields(source *v3alpha1api.GetDatabaseResponse, model *resourceM
return fmt.Errorf("model input is nil") return fmt.Errorf("model input is nil")
} }
var databaseId int64 var databaseID int64
if model.Id.ValueInt64() != 0 { if model.DatabaseId.ValueInt64() != 0 {
databaseId = model.Id.ValueInt64() if source.Id != 0 {
if model.DatabaseId.ValueInt64() != int64(source.Id) {
return fmt.Errorf("retrieved ID does not match known ID")
}
}
databaseID = model.DatabaseId.ValueInt64()
} else if source.Id != 0 { } else if source.Id != 0 {
databaseId = int64(source.Id) databaseID = int64(source.Id)
} else { } else {
return fmt.Errorf("database id not present") return fmt.Errorf("database id not present")
} }
model.Id = types.Int64Value(databaseId) model.DatabaseId = types.Int64Value(databaseID)
model.DatabaseId = types.Int64Value(databaseId)
model.Name = types.StringValue(source.GetName()) model.Name = types.StringValue(source.GetName())
model.Owner = types.StringValue(cleanString(source.Owner)) model.Owner = types.StringValue(cleanString(source.Owner))
return nil return nil

View file

@ -160,7 +160,7 @@ func TestMapResourceFields(t *testing.T) {
}, },
expected: expected{ expected: expected{
model: &resourceModel{ model: &resourceModel{
Id: types.Int64Value(1), Id: types.StringNull(),
Name: types.StringValue("my-db"), Name: types.StringValue("my-db"),
Owner: types.StringValue("my-owner"), Owner: types.StringValue("my-owner"),
DatabaseId: types.Int64Value(1), DatabaseId: types.Int64Value(1),

View file

@ -11,9 +11,9 @@ import (
"github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/path"
"github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource"
"github.com/hashicorp/terraform-plugin-framework/resource/identityschema"
"github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-framework/types"
"github.com/hashicorp/terraform-plugin-log/tflog" "github.com/hashicorp/terraform-plugin-log/tflog"
"github.com/stackitcloud/stackit-sdk-go/core/oapierror"
"github.com/stackitcloud/stackit-sdk-go/services/postgresflex/v3alpha1api" "github.com/stackitcloud/stackit-sdk-go/services/postgresflex/v3alpha1api"
"tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/conversion" "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/conversion"
@ -30,11 +30,6 @@ var (
_ resource.ResourceWithConfigure = &databaseResource{} _ resource.ResourceWithConfigure = &databaseResource{}
_ resource.ResourceWithImportState = &databaseResource{} _ resource.ResourceWithImportState = &databaseResource{}
_ resource.ResourceWithModifyPlan = &databaseResource{} _ resource.ResourceWithModifyPlan = &databaseResource{}
_ resource.ResourceWithIdentity = &databaseResource{}
// Error message constants
extractErrorSummary = "extracting failed"
extractErrorMessage = "Extracting identity data: %v"
) )
// NewDatabaseResource is a helper function to simplify the provider implementation. // NewDatabaseResource is a helper function to simplify the provider implementation.
@ -45,14 +40,6 @@ func NewDatabaseResource() resource.Resource {
// resourceModel describes the resource data model. // resourceModel describes the resource data model.
type resourceModel = postgresflexalphaResGen.DatabaseModel type resourceModel = postgresflexalphaResGen.DatabaseModel
// DatabaseResourceIdentityModel describes the resource's identity attributes.
type DatabaseResourceIdentityModel struct {
ProjectID types.String `tfsdk:"project_id"`
Region types.String `tfsdk:"region"`
InstanceID types.String `tfsdk:"instance_id"`
DatabaseID types.Int64 `tfsdk:"database_id"`
}
// databaseResource is the resource implementation. // databaseResource is the resource implementation.
type databaseResource struct { type databaseResource struct {
client *v3alpha1api.APIClient client *v3alpha1api.APIClient
@ -138,30 +125,6 @@ func (r *databaseResource) Schema(ctx context.Context, _ resource.SchemaRequest,
resp.Schema = s resp.Schema = s
} }
// IdentitySchema defines the schema for the resource's identity attributes.
func (r *databaseResource) IdentitySchema(
_ context.Context,
_ resource.IdentitySchemaRequest,
response *resource.IdentitySchemaResponse,
) {
response.IdentitySchema = identityschema.Schema{
Attributes: map[string]identityschema.Attribute{
"project_id": identityschema.StringAttribute{
RequiredForImport: true,
},
"region": identityschema.StringAttribute{
RequiredForImport: true,
},
"instance_id": identityschema.StringAttribute{
RequiredForImport: true,
},
"database_id": identityschema.Int64Attribute{
RequiredForImport: true,
},
},
}
}
// Create creates the resource and sets the initial Terraform state. // Create creates the resource and sets the initial Terraform state.
func (r *databaseResource) Create( func (r *databaseResource) Create(
ctx context.Context, ctx context.Context,
@ -178,12 +141,12 @@ func (r *databaseResource) Create(
ctx = core.InitProviderContext(ctx) ctx = core.InitProviderContext(ctx)
projectId := model.ProjectId.ValueString() projectID := model.ProjectId.ValueString()
region := model.Region.ValueString() region := model.Region.ValueString()
instanceId := model.InstanceId.ValueString() instanceID := model.InstanceId.ValueString()
ctx = tflog.SetField(ctx, "project_id", projectId) ctx = tflog.SetField(ctx, "project_id", projectID)
ctx = tflog.SetField(ctx, "instance_id", instanceId) ctx = tflog.SetField(ctx, "instance_id", instanceID)
ctx = tflog.SetField(ctx, "region", region) ctx = tflog.SetField(ctx, "region", region)
// Generate API request body from model // Generate API request body from model
@ -200,9 +163,9 @@ func (r *databaseResource) Create(
// Create new database // Create new database
databaseResp, err := r.client.DefaultAPI.CreateDatabaseRequest( databaseResp, err := r.client.DefaultAPI.CreateDatabaseRequest(
ctx, ctx,
projectId, projectID,
region, region,
instanceId, instanceID,
).CreateDatabaseRequestPayload(*payload).Execute() ).CreateDatabaseRequestPayload(*payload).Execute()
if err != nil { if err != nil {
core.LogAndAddError(ctx, &resp.Diagnostics, funcErrorSummary, fmt.Sprintf("Calling API: %v", err)) core.LogAndAddError(ctx, &resp.Diagnostics, funcErrorSummary, fmt.Sprintf("Calling API: %v", err))
@ -219,25 +182,35 @@ func (r *databaseResource) Create(
) )
return return
} }
databaseId := int64(*dbID) databaseID := int64(*dbID)
ctx = tflog.SetField(ctx, "database_id", databaseId) databaseIDString := strconv.Itoa(int(*dbID))
ctx = tflog.SetField(ctx, "database_id", databaseID)
ctx = core.LogResponse(ctx) ctx = core.LogResponse(ctx)
// Save identity into Terraform state model.DatabaseId = types.Int64Value(databaseID)
identity := DatabaseResourceIdentityModel{ model.Id = utils.BuildInternalTerraformId(projectID, region, instanceID, databaseIDString)
ProjectID: types.StringValue(projectId),
Region: types.StringValue(region),
InstanceID: types.StringValue(instanceId),
DatabaseID: types.Int64Value(databaseId),
}
resp.Diagnostics.Append(resp.Identity.Set(ctx, identity)...)
if resp.Diagnostics.HasError() {
return
}
database, err := postgresflexalphaWait.GetDatabaseByIdWaitHandler(ctx, r.client.DefaultAPI, projectId, instanceId, region, databaseId). // Set data returned by API in id
SetTimeout(15 * time.Minute). resp.Diagnostics.Append(
SetSleepBeforeWait(15 * time.Second). resp.State.SetAttribute(
ctx,
path.Root("database_id"),
databaseID,
)...,
)
// Set data returned by API in id
resp.Diagnostics.Append(
resp.State.SetAttribute(
ctx,
path.Root("id"),
model.Id,
)...,
)
database, err := postgresflexalphaWait.GetDatabaseByIdWaitHandler(ctx, r.client.DefaultAPI, projectID, instanceID, region, databaseID).
SetTimeout(30 * time.Minute).
SetSleepBeforeWait(10 * time.Second).
WaitWithContext(ctx) WaitWithContext(ctx)
if err != nil { if err != nil {
core.LogAndAddError( core.LogAndAddError(
@ -284,19 +257,30 @@ func (r *databaseResource) Read(
ctx = core.InitProviderContext(ctx) ctx = core.InitProviderContext(ctx)
projectId := model.ProjectId.ValueString() projectID := model.ProjectId.ValueString()
instanceId := model.InstanceId.ValueString() instanceID := model.InstanceId.ValueString()
region := model.Region.ValueString() region := model.Region.ValueString()
databaseId := model.DatabaseId.ValueInt64() databaseID := model.DatabaseId.ValueInt64()
ctx = tflog.SetField(ctx, "project_id", projectId) databaseIDString := strconv.Itoa(int(databaseID))
ctx = tflog.SetField(ctx, "instance_id", instanceId)
ctx = tflog.SetField(ctx, "project_id", projectID)
ctx = tflog.SetField(ctx, "instance_id", instanceID)
ctx = tflog.SetField(ctx, "region", region) ctx = tflog.SetField(ctx, "region", region)
ctx = tflog.SetField(ctx, "database_id", databaseId) ctx = tflog.SetField(ctx, "database_id", databaseID)
databaseResp, err := postgresflexalphaWait.GetDatabaseByIdWaitHandler(ctx, r.client.DefaultAPI, projectId, instanceId, region, databaseId). // Set data returned by API in id
SetTimeout(15 * time.Minute). resp.Diagnostics.Append(
SetSleepBeforeWait(15 * time.Second). resp.State.SetAttribute(
ctx,
path.Root("id"),
utils.BuildInternalTerraformId(projectID, region, instanceID, databaseIDString),
)...,
)
databaseResp, err := postgresflexalphaWait.GetDatabaseByIdWaitHandler(ctx, r.client.DefaultAPI, projectID, instanceID, region, databaseID).
SetTimeout(30 * time.Minute).
SetSleepBeforeWait(10 * time.Second).
WaitWithContext(ctx) WaitWithContext(ctx)
if err != nil { if err != nil {
core.LogAndAddError( core.LogAndAddError(
@ -322,18 +306,6 @@ func (r *databaseResource) Read(
return return
} }
// Save identity into Terraform state
identity := DatabaseResourceIdentityModel{
ProjectID: types.StringValue(projectId),
Region: types.StringValue(region),
InstanceID: types.StringValue(instanceId),
DatabaseID: types.Int64Value(int64(databaseResp.GetId())),
}
resp.Diagnostics.Append(resp.Identity.Set(ctx, identity)...)
if resp.Diagnostics.HasError() {
return
}
// Set refreshed state // Set refreshed state
diags = resp.State.Set(ctx, model) diags = resp.State.Set(ctx, model)
resp.Diagnostics.Append(diags...) resp.Diagnostics.Append(diags...)
@ -414,8 +386,8 @@ func (r *databaseResource) Update(
ctx = core.LogResponse(ctx) ctx = core.LogResponse(ctx)
databaseResp, err := postgresflexalphaWait.GetDatabaseByIdWaitHandler(ctx, r.client.DefaultAPI, projectId, instanceId, region, databaseId). databaseResp, err := postgresflexalphaWait.GetDatabaseByIdWaitHandler(ctx, r.client.DefaultAPI, projectId, instanceId, region, databaseId).
SetTimeout(15 * time.Minute). SetTimeout(30 * time.Minute).
SetSleepBeforeWait(15 * time.Second). SetSleepBeforeWait(10 * time.Second).
WaitWithContext(ctx) WaitWithContext(ctx)
if err != nil { if err != nil {
core.LogAndAddError(ctx, &resp.Diagnostics, "error updating database", err.Error()) core.LogAndAddError(ctx, &resp.Diagnostics, "error updating database", err.Error())
@ -436,18 +408,6 @@ func (r *databaseResource) Update(
return return
} }
// Save identity into Terraform state
identity := DatabaseResourceIdentityModel{
ProjectID: types.StringValue(projectId),
Region: types.StringValue(region),
InstanceID: types.StringValue(instanceId),
DatabaseID: types.Int64Value(databaseId),
}
resp.Diagnostics.Append(resp.Identity.Set(ctx, identity)...)
if resp.Diagnostics.HasError() {
return
}
// Set state to fully populated data // Set state to fully populated data
resp.Diagnostics.Append(resp.State.Set(ctx, &model)...) resp.Diagnostics.Append(resp.State.Set(ctx, &model)...)
if resp.Diagnostics.HasError() { if resp.Diagnostics.HasError() {
@ -469,38 +429,33 @@ func (r *databaseResource) Delete(
return return
} }
// Read identity data
var identityData DatabaseResourceIdentityModel
resp.Diagnostics.Append(req.Identity.Get(ctx, &identityData)...)
if resp.Diagnostics.HasError() {
return
}
ctx = core.InitProviderContext(ctx) ctx = core.InitProviderContext(ctx)
projectId, region, instanceId, databaseId64, errExt := r.extractIdentityData(model, identityData) projectID := model.ProjectId.ValueString()
if errExt != nil { instanceID := model.InstanceId.ValueString()
core.LogAndAddError( region := model.Region.ValueString()
ctx, databaseID64 := model.DatabaseId.ValueInt64()
&resp.Diagnostics,
extractErrorSummary,
fmt.Sprintf(extractErrorMessage, errExt),
)
}
if databaseId64 > math.MaxInt32 { if databaseID64 > math.MaxInt32 {
core.LogAndAddError(ctx, &resp.Diagnostics, "Error in type conversion", "int value too large (databaseId)") core.LogAndAddError(ctx, &resp.Diagnostics, "Error in type conversion", "int value too large (databaseId)")
return return
} }
databaseId := int32(databaseId64) // nolint:gosec // check is performed above databaseID := int32(databaseID64) // nolint:gosec // check is performed above
ctx = tflog.SetField(ctx, "project_id", projectId) ctx = tflog.SetField(ctx, "project_id", projectID)
ctx = tflog.SetField(ctx, "instance_id", instanceId) ctx = tflog.SetField(ctx, "instance_id", instanceID)
ctx = tflog.SetField(ctx, "region", region) ctx = tflog.SetField(ctx, "region", region)
ctx = tflog.SetField(ctx, "database_id", databaseId) ctx = tflog.SetField(ctx, "database_id", databaseID)
// Delete existing record set // Delete existing record set
err := r.client.DefaultAPI.DeleteDatabaseRequest(ctx, projectId, region, instanceId, databaseId).Execute() err := r.client.DefaultAPI.DeleteDatabaseRequest(ctx, projectID, region, instanceID, databaseID).Execute()
if err != nil { if err != nil {
oapiErr, ok := err.(*oapierror.GenericOpenAPIError) // nolint:errorlint //complaining that error.As should be used to catch wrapped errors, but this error should not be wrapped
if ok {
if oapiErr.StatusCode == 404 {
resp.State.RemoveResource(ctx)
return
}
}
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting database", fmt.Sprintf("Calling API: %v", err)) core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting database", fmt.Sprintf("Calling API: %v", err))
} }
@ -517,109 +472,44 @@ func (r *databaseResource) ImportState(
resp *resource.ImportStateResponse, resp *resource.ImportStateResponse,
) { ) {
ctx = core.InitProviderContext(ctx) ctx = core.InitProviderContext(ctx)
idParts := strings.Split(req.ID, core.Separator)
if req.ID != "" { if len(idParts) != 4 || idParts[0] == "" || idParts[1] == "" || idParts[2] == "" || idParts[3] == "" {
idParts := strings.Split(req.ID, core.Separator) core.LogAndAddError(
ctx, &resp.Diagnostics,
"Error importing database",
fmt.Sprintf(
"Expected import identifier with format [project_id],[region],[instance_id],[database_id], got %q",
req.ID,
),
)
return
}
if len(idParts) != 4 || idParts[0] == "" || idParts[1] == "" || idParts[2] == "" || idParts[3] == "" { databaseID, err := strconv.ParseInt(idParts[3], 10, 64)
core.LogAndAddError( if err != nil {
ctx, &resp.Diagnostics, core.LogAndAddError(
"Error importing database",
fmt.Sprintf(
"Expected import identifier with format [project_id],[region],[instance_id],[database_id], got %q",
req.ID,
),
)
return
}
databaseId, err := strconv.ParseInt(idParts[3], 10, 64)
if err != nil {
core.LogAndAddError(
ctx,
&resp.Diagnostics,
"Error importing database",
fmt.Sprintf("Invalid database_id format: %q. It must be a valid integer.", idParts[3]),
)
return
}
resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("project_id"), idParts[0])...)
resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("region"), idParts[1])...)
resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("instance_id"), idParts[2])...)
resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("database_id"), databaseId)...)
core.LogAndAddWarning(
ctx, ctx,
&resp.Diagnostics, &resp.Diagnostics,
"Postgresflex database imported with empty password", "Error importing database",
"The database password is not imported as it is only available upon creation of a new database. The password field will be empty.", fmt.Sprintf("Invalid database_id format: %q. It must be a valid integer.", idParts[3]),
) )
tflog.Info(ctx, "Postgres Flex database state imported")
return return
} }
// If no ID is provided, attempt to read identity attributes from the import configuration tfIDString := utils.BuildInternalTerraformId(idParts...).ValueString()
var identityData DatabaseResourceIdentityModel resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("id"), tfIDString)...)
resp.Diagnostics.Append(req.Identity.Get(ctx, &identityData)...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("project_id"), idParts[0])...)
if resp.Diagnostics.HasError() { resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("region"), idParts[1])...)
return resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("instance_id"), idParts[2])...)
} resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("database_id"), databaseID)...)
projectId := identityData.ProjectID.ValueString() core.LogAndAddWarning(
region := identityData.Region.ValueString() ctx,
instanceId := identityData.InstanceID.ValueString() &resp.Diagnostics,
databaseId := identityData.DatabaseID.ValueInt64() "Postgresflex database imported with empty password",
"The database password is not imported as it is only available upon creation of a new database. The password field will be empty.",
resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("project_id"), projectId)...) )
resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("region"), region)...)
resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("instance_id"), instanceId)...)
resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("database_id"), databaseId)...)
tflog.Info(ctx, "Postgres Flex database state imported") tflog.Info(ctx, "Postgres Flex database state imported")
} }
// extractIdentityData extracts essential identifiers from the resource model, falling back to the identity model.
func (r *databaseResource) extractIdentityData(
model resourceModel,
identity DatabaseResourceIdentityModel,
) (projectId, region, instanceId string, databaseId int64, err error) {
if !model.DatabaseId.IsNull() && !model.DatabaseId.IsUnknown() {
databaseId = model.DatabaseId.ValueInt64()
} else {
if identity.DatabaseID.IsNull() || identity.DatabaseID.IsUnknown() {
return "", "", "", 0, fmt.Errorf("database_id not found in config")
}
databaseId = identity.DatabaseID.ValueInt64()
}
if !model.ProjectId.IsNull() && !model.ProjectId.IsUnknown() {
projectId = model.ProjectId.ValueString()
} else {
if identity.ProjectID.IsNull() || identity.ProjectID.IsUnknown() {
return "", "", "", 0, fmt.Errorf("project_id not found in config")
}
projectId = identity.ProjectID.ValueString()
}
if !model.Region.IsNull() && !model.Region.IsUnknown() {
region = r.providerData.GetRegionWithOverride(model.Region)
} else {
if identity.Region.IsNull() || identity.Region.IsUnknown() {
return "", "", "", 0, fmt.Errorf("region not found in config")
}
region = r.providerData.GetRegionWithOverride(identity.Region)
}
if !model.InstanceId.IsNull() && !model.InstanceId.IsUnknown() {
instanceId = model.InstanceId.ValueString()
} else {
if identity.InstanceID.IsNull() || identity.InstanceID.IsUnknown() {
return "", "", "", 0, fmt.Errorf("instance_id not found in config")
}
instanceId = identity.InstanceID.ValueString()
}
return projectId, region, instanceId, databaseId, nil
}

View file

@ -20,7 +20,7 @@ func DatabaseResourceSchema(ctx context.Context) schema.Schema {
Description: "The ID of the database.", Description: "The ID of the database.",
MarkdownDescription: "The ID of the database.", MarkdownDescription: "The ID of the database.",
}, },
"id": schema.Int64Attribute{ "id": schema.StringAttribute{
Computed: true, Computed: true,
Description: "The id of the database.", Description: "The id of the database.",
MarkdownDescription: "The id of the database.", MarkdownDescription: "The id of the database.",
@ -65,7 +65,7 @@ func DatabaseResourceSchema(ctx context.Context) schema.Schema {
type DatabaseModel struct { type DatabaseModel struct {
DatabaseId types.Int64 `tfsdk:"database_id"` DatabaseId types.Int64 `tfsdk:"database_id"`
Id types.Int64 `tfsdk:"id"` Id types.String `tfsdk:"id"`
InstanceId types.String `tfsdk:"instance_id"` InstanceId types.String `tfsdk:"instance_id"`
Name types.String `tfsdk:"name"` Name types.String `tfsdk:"name"`
Owner types.String `tfsdk:"owner"` Owner types.String `tfsdk:"owner"`

View file

@ -11,7 +11,7 @@ import (
"github.com/stackitcloud/stackit-sdk-go/services/postgresflex/v3alpha1api" "github.com/stackitcloud/stackit-sdk-go/services/postgresflex/v3alpha1api"
"tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/conversion" "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/conversion"
postgresflexalphaGen "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/flavors/datasources_gen" postgresflexalphaGen "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/flavor/datasources_gen"
postgresflexUtils "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/utils" postgresflexUtils "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/utils"
"tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/utils" "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/utils"
@ -220,14 +220,24 @@ func (r *flavorDataSource) Read(ctx context.Context, req datasource.ReadRequest,
} else { } else {
var scList []attr.Value var scList []attr.Value
for _, sc := range f.StorageClasses { for _, sc := range f.StorageClasses {
mIop := types.Int32Null()
if val, ok := sc.GetMaxIoPerSecOk(); ok {
mIop = types.Int32Value(*val)
}
mThrough := types.Int32Null()
if val, ok := sc.GetMaxThroughInMbOk(); ok {
mThrough = types.Int32Value(*val)
}
scList = append( scList = append(
scList, scList,
postgresflexalphaGen.NewStorageClassesValueMust( postgresflexalphaGen.NewStorageClassesValueMust(
postgresflexalphaGen.StorageClassesValue{}.AttributeTypes(ctx), postgresflexalphaGen.StorageClassesValue{}.AttributeTypes(ctx),
map[string]attr.Value{ map[string]attr.Value{
"class": types.StringValue(sc.Class), "class": types.StringValue(sc.Class),
"max_io_per_sec": types.Int32Value(sc.MaxIoPerSec), "max_io_per_sec": mIop,
"max_through_in_mb": types.Int32Value(sc.MaxThroughInMb), "max_through_in_mb": mThrough,
}, },
), ),
) )

View file

@ -1,4 +1,4 @@
package postgresflexalpha package postgresflexalphaflavors
import ( import (
"context" "context"

View file

@ -0,0 +1,65 @@
package postgresflexalphaflavors
import (
"context"
"fmt"
"github.com/stackitcloud/stackit-sdk-go/services/postgresflex/v3alpha1api"
)
type flavorsClientReader interface {
GetFlavorsRequest(
ctx context.Context,
projectId, region string,
) v3alpha1api.ApiGetFlavorsRequestRequest
}
func getAllFlavors(ctx context.Context, client flavorsClientReader, projectId, region string) (
[]v3alpha1api.ListFlavors,
error,
) {
getAllFilter := func(_ v3alpha1api.ListFlavors) bool { return true }
flavorList, err := getFlavorsByFilter(ctx, client, projectId, region, getAllFilter)
if err != nil {
return nil, err
}
return flavorList, nil
}
// getFlavorsByFilter is a helper function to retrieve flavors using a filtern function.
// Hint: The API does not have a GetFlavors endpoint, only ListFlavors
func getFlavorsByFilter(
ctx context.Context,
client flavorsClientReader,
projectId, region string,
filter func(db v3alpha1api.ListFlavors) bool,
) ([]v3alpha1api.ListFlavors, error) {
if projectId == "" || region == "" {
return nil, fmt.Errorf("listing postgresflex flavors: projectId and region are required")
}
const pageSize = 25
var result = make([]v3alpha1api.ListFlavors, 0)
for page := int32(1); ; page++ {
res, err := client.GetFlavorsRequest(ctx, projectId, region).
Page(page).Size(pageSize).Sort(v3alpha1api.FLAVORSORT_ID_ASC).Execute()
if err != nil {
return nil, fmt.Errorf("requesting flavors list (page %d): %w", page, err)
}
// If the API returns no flavors, we have reached the end of the list.
if len(res.Flavors) == 0 {
break
}
for _, flavor := range res.Flavors {
if filter(flavor) {
result = append(result, flavor)
}
}
}
return result, nil
}

View file

@ -0,0 +1,135 @@
package postgresflexalphaflavors
/*
import (
"context"
"testing"
postgresflex "github.com/stackitcloud/stackit-sdk-go/services/postgresflex/v3alpha1api"
)
type mockRequest struct {
executeFunc func() (*postgresflex.GetFlavorsResponse, error)
}
func (m *mockRequest) Page(_ int32) postgresflex.ApiGetFlavorsRequestRequest { return m }
func (m *mockRequest) Size(_ int32) postgresflex.ApiGetFlavorsRequestRequest { return m }
func (m *mockRequest) Sort(_ postgresflex.FlavorSort) postgresflex.ApiGetFlavorsRequestRequest {
return m
}
func (m *mockRequest) Execute() (*postgresflex.GetFlavorsResponse, error) {
return m.executeFunc()
}
type mockFlavorsClient struct {
executeRequest func() postgresflex.ApiGetFlavorsRequestRequest
}
func (m *mockFlavorsClient) GetFlavorsRequest(_ context.Context, _, _ string) postgresflex.ApiGetFlavorsRequestRequest {
return m.executeRequest()
}
var mockResp = func(page int32) (*postgresflex.GetFlavorsResponse, error) {
if page == 1 {
return &postgresflex.GetFlavorsResponse{
Flavors: []postgresflex.ListFlavors{
{Id: "flavor-1", Description: "first"},
{Id: "flavor-2", Description: "second"},
},
}, nil
}
if page == 2 {
return &postgresflex.GetFlavorsResponse{
Flavors: []postgresflex.ListFlavors{
{Id: "flavor-3", Description: "three"},
},
}, nil
}
return &postgresflex.GetFlavorsResponse{
Flavors: []postgresflex.ListFlavors{},
}, nil
}
func TestGetFlavorsByFilter(t *testing.T) {
tests := []struct {
description string
projectId string
region string
mockErr error
filter func(postgresflex.ListFlavors) bool
wantCount int
wantErr bool
}{
{
description: "Success - Get all flavors (2 pages)",
projectId: "pid", region: "reg",
filter: func(_ postgresflex.ListFlavors) bool { return true },
wantCount: 3,
wantErr: false,
},
{
description: "Success - Filter flavors by description",
projectId: "pid", region: "reg",
filter: func(f postgresflex.ListFlavors) bool { return f.Description == "first" },
wantCount: 1,
wantErr: false,
},
{
description: "Error - Missing parameters",
projectId: "", region: "reg",
wantErr: true,
},
}
for _, tt := range tests {
t.Run(
tt.description, func(t *testing.T) {
var currentPage int32
client := &mockFlavorsClient{
executeRequest: func() postgresflex.ApiGetFlavorsRequestRequest {
return mockRequest{
executeFunc: func() (*postgresflex.GetFlavorsResponse, error) {
currentPage++
return mockResp(currentPage)
},
}
},
}
actual, err := getFlavorsByFilter(context.Background(), client, tt.projectId, tt.region, tt.filter)
if (err != nil) != tt.wantErr {
t.Errorf("getFlavorsByFilter() error = %v, wantErr %v", err, tt.wantErr)
return
}
if !tt.wantErr && len(actual) != tt.wantCount {
t.Errorf("getFlavorsByFilter() got %d flavors, want %d", len(actual), tt.wantCount)
}
},
)
}
}
func TestGetAllFlavors(t *testing.T) {
var currentPage int32
client := &mockFlavorsClient{
executeRequest: func() postgresflex.ApiGetFlavorsRequestRequest {
return mockRequest{
executeFunc: func() (*postgresflex.GetFlavorsResponse, error) {
currentPage++
return mockResp(currentPage)
},
}
},
}
res, err := getAllFlavors(context.Background(), client, "pid", "reg")
if err != nil {
t.Errorf("getAllFlavors() unexpected error: %v", err)
}
if len(res) != 3 {
t.Errorf("getAllFlavors() expected 3 flavor, got %d", len(res))
}
}
*/

View file

@ -5,6 +5,7 @@ import (
"fmt" "fmt"
"net/http" "net/http"
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
"github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-framework/types"
"github.com/stackitcloud/stackit-sdk-go/services/postgresflex/v3alpha1api" "github.com/stackitcloud/stackit-sdk-go/services/postgresflex/v3alpha1api"
@ -72,7 +73,13 @@ func (r *instanceDataSource) Configure(
// Schema defines the schema for the data source. // Schema defines the schema for the data source.
func (r *instanceDataSource) Schema(ctx context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) { func (r *instanceDataSource) Schema(ctx context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
resp.Schema = postgresflexalpha2.InstanceDataSourceSchema(ctx) sch := postgresflexalpha2.InstanceDataSourceSchema(ctx)
sch.Attributes["id"] = schema.StringAttribute{
Computed: true,
Description: "internal ID",
MarkdownDescription: "internal ID",
}
resp.Schema = sch
} }
// Read refreshes the Terraform state with the latest data. // Read refreshes the Terraform state with the latest data.
@ -90,22 +97,22 @@ func (r *instanceDataSource) Read(
ctx = core.InitProviderContext(ctx) ctx = core.InitProviderContext(ctx)
projectId := model.ProjectId.ValueString() projectID := model.ProjectId.ValueString()
instanceId := model.InstanceId.ValueString() instanceID := model.InstanceId.ValueString()
region := r.providerData.GetRegionWithOverride(model.Region) region := r.providerData.GetRegionWithOverride(model.Region)
ctx = tflog.SetField(ctx, "project_id", projectId) ctx = tflog.SetField(ctx, "project_id", projectID)
ctx = tflog.SetField(ctx, "instance_id", instanceId) ctx = tflog.SetField(ctx, "instance_id", instanceID)
ctx = tflog.SetField(ctx, "region", region) ctx = tflog.SetField(ctx, "region", region)
instanceResp, err := r.client.DefaultAPI.GetInstanceRequest(ctx, projectId, region, instanceId).Execute() instanceResp, err := r.client.DefaultAPI.GetInstanceRequest(ctx, projectID, region, instanceID).Execute()
if err != nil { if err != nil {
utils.LogError( utils.LogError(
ctx, ctx,
&resp.Diagnostics, &resp.Diagnostics,
err, err,
"Reading instance", "Reading instance",
fmt.Sprintf("Instance with ID %q does not exist in project %q.", instanceId, projectId), fmt.Sprintf("Instance with ID %q does not exist in project %q.", instanceID, projectID),
map[int]string{ map[int]string{
http.StatusForbidden: fmt.Sprintf("Project with ID %q not found or forbidden access", projectId), http.StatusForbidden: fmt.Sprintf("Project with ID %q not found or forbidden access", projectID),
}, },
) )
resp.State.RemoveResource(ctx) resp.State.RemoveResource(ctx)

View file

@ -115,6 +115,12 @@ func InstanceDataSourceSchema(ctx context.Context) schema.Schema {
Description: "Whether the instance can be deleted or not.", Description: "Whether the instance can be deleted or not.",
MarkdownDescription: "Whether the instance can be deleted or not.", MarkdownDescription: "Whether the instance can be deleted or not.",
}, },
"labels": schema.MapAttribute{
ElementType: types.StringType,
Computed: true,
Description: "Key-value pairs, 63 characters max, begin and end with an alphanumerical character,\nmay contain dashes (-), underscores (_), dots (.), and alphanumerics between. Key MUST be at least 1 character.\nMax 64 labels\nRegex for keys: ^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$\nRegex for values: ^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$\nThe stackit- prefix is reserved and cannot be used for Keys.\n",
MarkdownDescription: "Key-value pairs, 63 characters max, begin and end with an alphanumerical character,\nmay contain dashes (-), underscores (_), dots (.), and alphanumerics between. Key MUST be at least 1 character.\nMax 64 labels\nRegex for keys: ^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$\nRegex for values: ^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$\nThe stackit- prefix is reserved and cannot be used for Keys.\n",
},
"name": schema.StringAttribute{ "name": schema.StringAttribute{
Computed: true, Computed: true,
Description: "The name of the instance.", Description: "The name of the instance.",
@ -155,7 +161,7 @@ func InstanceDataSourceSchema(ctx context.Context) schema.Schema {
MarkdownDescription: "The STACKIT project ID.", MarkdownDescription: "The STACKIT project ID.",
}, },
"region": schema.StringAttribute{ "region": schema.StringAttribute{
Required: true, Optional: true,
Description: "The region which should be addressed", Description: "The region which should be addressed",
MarkdownDescription: "The region which should be addressed", MarkdownDescription: "The region which should be addressed",
Validators: []validator.String{ Validators: []validator.String{
@ -171,8 +177,8 @@ func InstanceDataSourceSchema(ctx context.Context) schema.Schema {
}, },
"retention_days": schema.Int64Attribute{ "retention_days": schema.Int64Attribute{
Computed: true, Computed: true,
Description: "How long backups are retained. The value can only be between 32 and 365 days.", Description: "How long backups are retained. The value can only be between 32 and 90 days.",
MarkdownDescription: "How long backups are retained. The value can only be between 32 and 365 days.", MarkdownDescription: "How long backups are retained. The value can only be between 32 and 90 days.",
}, },
"status": schema.StringAttribute{ "status": schema.StringAttribute{
Computed: true, Computed: true,
@ -219,6 +225,7 @@ type InstanceModel struct {
Id types.String `tfsdk:"tf_original_api_id"` Id types.String `tfsdk:"tf_original_api_id"`
InstanceId types.String `tfsdk:"instance_id"` InstanceId types.String `tfsdk:"instance_id"`
IsDeletable types.Bool `tfsdk:"is_deletable"` IsDeletable types.Bool `tfsdk:"is_deletable"`
Labels types.Map `tfsdk:"labels"`
Name types.String `tfsdk:"name"` Name types.String `tfsdk:"name"`
Network NetworkValue `tfsdk:"network"` Network NetworkValue `tfsdk:"network"`
ProjectId types.String `tfsdk:"project_id"` ProjectId types.String `tfsdk:"project_id"`

View file

@ -0,0 +1,65 @@
package postgresflexalpha
import (
"context"
"fmt"
"github.com/stackitcloud/stackit-sdk-go/services/postgresflex/v3alpha1api"
)
type flavorsClientReader interface {
GetFlavorsRequest(
ctx context.Context,
projectId, region string,
) v3alpha1api.ApiGetFlavorsRequestRequest
}
func getAllFlavors(ctx context.Context, client flavorsClientReader, projectId, region string) (
[]v3alpha1api.ListFlavors,
error,
) {
getAllFilter := func(_ v3alpha1api.ListFlavors) bool { return true }
flavorList, err := getFlavorsByFilter(ctx, client, projectId, region, getAllFilter)
if err != nil {
return nil, err
}
return flavorList, nil
}
// getFlavorsByFilter is a helper function to retrieve flavors using a filtern function.
// Hint: The API does not have a GetFlavors endpoint, only ListFlavors
func getFlavorsByFilter(
ctx context.Context,
client flavorsClientReader,
projectId, region string,
filter func(db v3alpha1api.ListFlavors) bool,
) ([]v3alpha1api.ListFlavors, error) {
if projectId == "" || region == "" {
return nil, fmt.Errorf("listing postgresflex flavors: projectId and region are required")
}
const pageSize = 25
var result = make([]v3alpha1api.ListFlavors, 0)
for page := int32(1); ; page++ {
res, err := client.GetFlavorsRequest(ctx, projectId, region).
Page(page).Size(pageSize).Sort(v3alpha1api.FLAVORSORT_ID_ASC).Execute()
if err != nil {
return nil, fmt.Errorf("requesting flavors list (page %d): %w", page, err)
}
// If the API returns no flavors, we have reached the end of the list.
if len(res.Flavors) == 0 {
break
}
for _, flavor := range res.Flavors {
if filter(flavor) {
result = append(result, flavor)
}
}
}
return result, nil
}

View file

@ -0,0 +1,135 @@
package postgresflexalpha
/*
import (
"context"
"testing"
postgresflex "github.com/stackitcloud/stackit-sdk-go/services/postgresflex/v3alpha1api"
)
type mockRequest struct {
executeFunc func() (*postgresflex.GetFlavorsResponse, error)
}
func (m *mockRequest) Page(_ int32) postgresflex.ApiGetFlavorsRequestRequest { return m }
func (m *mockRequest) Size(_ int32) postgresflex.ApiGetFlavorsRequestRequest { return m }
func (m *mockRequest) Sort(_ postgresflex.FlavorSort) postgresflex.ApiGetFlavorsRequestRequest {
return m
}
func (m *mockRequest) Execute() (*postgresflex.GetFlavorsResponse, error) {
return m.executeFunc()
}
type mockFlavorsClient struct {
executeRequest func() postgresflex.ApiGetFlavorsRequestRequest
}
func (m *mockFlavorsClient) GetFlavorsRequest(_ context.Context, _, _ string) postgresflex.ApiGetFlavorsRequestRequest {
return m.executeRequest()
}
var mockResp = func(page int32) (*postgresflex.GetFlavorsResponse, error) {
if page == 1 {
return &postgresflex.GetFlavorsResponse{
Flavors: []postgresflex.ListFlavors{
{Id: "flavor-1", Description: "first"},
{Id: "flavor-2", Description: "second"},
},
}, nil
}
if page == 2 {
return &postgresflex.GetFlavorsResponse{
Flavors: []postgresflex.ListFlavors{
{Id: "flavor-3", Description: "three"},
},
}, nil
}
return &postgresflex.GetFlavorsResponse{
Flavors: []postgresflex.ListFlavors{},
}, nil
}
func TestGetFlavorsByFilter(t *testing.T) {
tests := []struct {
description string
projectId string
region string
mockErr error
filter func(postgresflex.ListFlavors) bool
wantCount int
wantErr bool
}{
{
description: "Success - Get all flavors (2 pages)",
projectId: "pid", region: "reg",
filter: func(_ postgresflex.ListFlavors) bool { return true },
wantCount: 3,
wantErr: false,
},
{
description: "Success - Filter flavors by description",
projectId: "pid", region: "reg",
filter: func(f postgresflex.ListFlavors) bool { return f.Description == "first" },
wantCount: 1,
wantErr: false,
},
{
description: "Error - Missing parameters",
projectId: "", region: "reg",
wantErr: true,
},
}
for _, tt := range tests {
t.Run(
tt.description, func(t *testing.T) {
var currentPage int32
client := &mockFlavorsClient{
executeRequest: func() postgresflex.ApiGetFlavorsRequestRequest {
return mockRequest{
executeFunc: func() (*postgresflex.GetFlavorsResponse, error) {
currentPage++
return mockResp(currentPage)
},
}
},
}
actual, err := getFlavorsByFilter(context.Background(), client, tt.projectId, tt.region, tt.filter)
if (err != nil) != tt.wantErr {
t.Errorf("getFlavorsByFilter() error = %v, wantErr %v", err, tt.wantErr)
return
}
if !tt.wantErr && len(actual) != tt.wantCount {
t.Errorf("getFlavorsByFilter() got %d flavors, want %d", len(actual), tt.wantCount)
}
},
)
}
}
func TestGetAllFlavors(t *testing.T) {
var currentPage int32
client := &mockFlavorsClient{
executeRequest: func() postgresflex.ApiGetFlavorsRequestRequest {
return mockRequest{
executeFunc: func() (*postgresflex.GetFlavorsResponse, error) {
currentPage++
return mockResp(currentPage)
},
}
},
}
res, err := getAllFlavors(context.Background(), client, "pid", "reg")
if err != nil {
t.Errorf("getAllFlavors() unexpected error: %v", err)
}
if len(res) != 3 {
t.Errorf("getAllFlavors() expected 3 flavor, got %d", len(res))
}
}
*/

View file

@ -16,7 +16,7 @@ import (
func mapGetInstanceResponseToModel( func mapGetInstanceResponseToModel(
ctx context.Context, ctx context.Context,
m *postgresflexalpharesource.InstanceModel, m *LocalInstanceModel,
resp *postgresflex.GetInstanceResponse, resp *postgresflex.GetInstanceResponse,
) error { ) error {
m.BackupSchedule = types.StringValue(resp.GetBackupSchedule()) m.BackupSchedule = types.StringValue(resp.GetBackupSchedule())
@ -55,23 +55,23 @@ func mapGetInstanceResponseToModel(
} }
m.FlavorId = types.StringValue(resp.GetFlavorId()) m.FlavorId = types.StringValue(resp.GetFlavorId())
if m.Id.IsNull() || m.Id.IsUnknown() { m.Id = utils.BuildInternalTerraformId(
m.Id = utils.BuildInternalTerraformId( m.ProjectId.ValueString(),
m.ProjectId.ValueString(), m.Region.ValueString(),
m.Region.ValueString(), resp.Id,
m.InstanceId.ValueString(), )
)
}
m.InstanceId = types.StringValue(resp.Id) m.InstanceId = types.StringValue(resp.Id)
m.IsDeletable = types.BoolValue(resp.GetIsDeletable()) m.IsDeletable = types.BoolValue(resp.GetIsDeletable())
netAcl, diags := types.ListValueFrom(ctx, types.StringType, resp.Network.GetAcl()) netACL, diags := types.ListValueFrom(ctx, types.StringType, resp.Network.GetAcl())
if diags.HasError() { if diags.HasError() {
return fmt.Errorf("failed converting network acl from response") return fmt.Errorf("failed converting network acl from response")
} }
m.Acl = netAcl m.Acl = netACL
// m.Labels = resp.GetLabels()
netInstAdd := types.StringValue("") netInstAdd := types.StringValue("")
if instAdd, ok := resp.Network.GetInstanceAddressOk(); ok { if instAdd, ok := resp.Network.GetInstanceAddressOk(); ok {
@ -87,7 +87,7 @@ func mapGetInstanceResponseToModel(
postgresflexalpharesource.NetworkValue{}.AttributeTypes(ctx), postgresflexalpharesource.NetworkValue{}.AttributeTypes(ctx),
map[string]attr.Value{ map[string]attr.Value{
"access_scope": basetypes.NewStringValue(string(resp.Network.GetAccessScope())), "access_scope": basetypes.NewStringValue(string(resp.Network.GetAccessScope())),
"acl": netAcl, "acl": netACL,
"instance_address": netInstAdd, "instance_address": netInstAdd,
"router_address": netRtrAdd, "router_address": netRtrAdd,
}, },
@ -130,7 +130,8 @@ func mapGetDataInstanceResponseToModel(
handleConnectionInfo(ctx, m, resp) handleConnectionInfo(ctx, m, resp)
m.FlavorId = types.StringValue(resp.GetFlavorId()) m.FlavorId = types.StringValue(resp.GetFlavorId())
m.Id = utils.BuildInternalTerraformId(m.ProjectId.ValueString(), m.Region.ValueString(), m.InstanceId.ValueString()) m.Id = types.StringValue(resp.Id)
m.TerraformID = utils.BuildInternalTerraformId(m.ProjectId.ValueString(), m.Region.ValueString(), m.InstanceId.ValueString())
m.InstanceId = types.StringValue(resp.Id) m.InstanceId = types.StringValue(resp.Id)
m.IsDeletable = types.BoolValue(resp.GetIsDeletable()) m.IsDeletable = types.BoolValue(resp.GetIsDeletable())
m.Name = types.StringValue(resp.GetName()) m.Name = types.StringValue(resp.GetName())
@ -212,14 +213,14 @@ func handleNetwork(ctx context.Context, m *dataSourceModel, resp *postgresflex.G
} }
func handleEncryption(m *dataSourceModel, resp *postgresflex.GetInstanceResponse) { func handleEncryption(m *dataSourceModel, resp *postgresflex.GetInstanceResponse) {
keyId := "" keyID := ""
if keyIdVal, ok := resp.Encryption.GetKekKeyIdOk(); ok { if keyIDVal, ok := resp.Encryption.GetKekKeyIdOk(); ok {
keyId = *keyIdVal keyID = *keyIDVal
} }
keyRingId := "" keyRingID := ""
if keyRingIdVal, ok := resp.Encryption.GetKekKeyRingIdOk(); ok { if keyRingIDVal, ok := resp.Encryption.GetKekKeyRingIdOk(); ok {
keyRingId = *keyRingIdVal keyRingID = *keyRingIDVal
} }
keyVersion := "" keyVersion := ""
@ -233,8 +234,8 @@ func handleEncryption(m *dataSourceModel, resp *postgresflex.GetInstanceResponse
} }
m.Encryption = postgresflexalphadatasource.EncryptionValue{ m.Encryption = postgresflexalphadatasource.EncryptionValue{
KekKeyId: types.StringValue(keyId), KekKeyId: types.StringValue(keyID),
KekKeyRingId: types.StringValue(keyRingId), KekKeyRingId: types.StringValue(keyRingID),
KekKeyVersion: types.StringValue(keyVersion), KekKeyVersion: types.StringValue(keyVersion),
ServiceAccount: types.StringValue(svcAcc), ServiceAccount: types.StringValue(svcAcc),
} }

View file

@ -8,7 +8,6 @@ import (
postgresflex "github.com/stackitcloud/stackit-sdk-go/services/postgresflex/v3alpha1api" postgresflex "github.com/stackitcloud/stackit-sdk-go/services/postgresflex/v3alpha1api"
postgresflexalpharesource "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/instance/resources_gen"
utils2 "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/utils" utils2 "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/utils"
) )
@ -171,7 +170,7 @@ func Test_mapGetInstanceResponseToModel(t *testing.T) {
t.Skipf("please implement") t.Skipf("please implement")
type args struct { type args struct {
ctx context.Context ctx context.Context
m *postgresflexalpharesource.InstanceModel m *LocalInstanceModel
resp *postgresflex.GetInstanceResponse resp *postgresflex.GetInstanceResponse
} }
tests := []struct { tests := []struct {

View file

@ -7,16 +7,18 @@ import (
"math" "math"
"net/http" "net/http"
"strings" "strings"
"time"
"github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/path"
"github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource"
"github.com/hashicorp/terraform-plugin-framework/resource/identityschema" "github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-framework/types"
"github.com/hashicorp/terraform-plugin-framework/types/basetypes"
"github.com/hashicorp/terraform-plugin-log/tflog" "github.com/hashicorp/terraform-plugin-log/tflog"
"github.com/stackitcloud/stackit-sdk-go/core/oapierror" "github.com/stackitcloud/stackit-sdk-go/core/oapierror"
coreUtils "github.com/stackitcloud/stackit-sdk-go/core/utils" coreUtils "github.com/stackitcloud/stackit-sdk-go/core/utils"
"github.com/stackitcloud/stackit-sdk-go/services/postgresflex/v3alpha1api" "github.com/stackitcloud/stackit-sdk-go/services/postgresflex/v3alpha1api"
"tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/conversion" "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/conversion"
"tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/core" "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/core"
postgresflexalpha "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/instance/resources_gen" postgresflexalpha "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/instance/resources_gen"
@ -32,7 +34,6 @@ var (
_ resource.ResourceWithImportState = &instanceResource{} _ resource.ResourceWithImportState = &instanceResource{}
_ resource.ResourceWithModifyPlan = &instanceResource{} _ resource.ResourceWithModifyPlan = &instanceResource{}
_ resource.ResourceWithValidateConfig = &instanceResource{} _ resource.ResourceWithValidateConfig = &instanceResource{}
_ resource.ResourceWithIdentity = &instanceResource{}
) )
// NewInstanceResource is a helper function to simplify the provider implementation. // NewInstanceResource is a helper function to simplify the provider implementation.
@ -40,27 +41,31 @@ func NewInstanceResource() resource.Resource {
return &instanceResource{} return &instanceResource{}
} }
// resourceModel describes the resource data model.
type resourceModel = postgresflexalpha.InstanceModel
type InstanceResourceIdentityModel struct {
ProjectID types.String `tfsdk:"project_id"`
Region types.String `tfsdk:"region"`
InstanceID types.String `tfsdk:"instance_id"`
}
// instanceResource is the resource implementation. // instanceResource is the resource implementation.
type instanceResource struct { type instanceResource struct {
client *v3alpha1api.APIClient client *v3alpha1api.APIClient
providerData core.ProviderData providerData core.ProviderData
} }
type LocalInstanceModel struct {
postgresflexalpha.InstanceModel
Flavor types.Object `tfsdk:"flavor"`
}
// Struct corresponding to Model.Flavor
type flavorModel struct {
Id types.String `tfsdk:"id"`
Description types.String `tfsdk:"description"`
CPU types.Int64 `tfsdk:"cpu"`
RAM types.Int64 `tfsdk:"ram"`
}
func (r *instanceResource) ValidateConfig( func (r *instanceResource) ValidateConfig(
ctx context.Context, ctx context.Context,
req resource.ValidateConfigRequest, req resource.ValidateConfigRequest,
resp *resource.ValidateConfigResponse, resp *resource.ValidateConfigResponse,
) { ) {
var data resourceModel var data LocalInstanceModel
resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) resp.Diagnostics.Append(req.Config.Get(ctx, &data)...)
if resp.Diagnostics.HasError() { if resp.Diagnostics.HasError() {
@ -75,6 +80,23 @@ func (r *instanceResource) ValidateConfig(
"The resource may return unexpected results.", "The resource may return unexpected results.",
) )
} }
if data.FlavorId.IsNull() {
if data.Flavor.IsUnknown() || data.Flavor.IsNull() {
resp.Diagnostics.AddAttributeError(
path.Root("flavor"),
"Missing Attribute Configuration",
"Expected flavor to be configured. "+
"The resource may return unexpected results.",
)
}
resp.Diagnostics.AddAttributeWarning(
path.Root("flavor"),
"Attribute Configuration Deprecation",
"Using flavor is deprecated, "+
"please use flavor_id instead.",
)
}
} }
// ModifyPlan implements resource.ResourceWithModifyPlan. // ModifyPlan implements resource.ResourceWithModifyPlan.
@ -84,7 +106,7 @@ func (r *instanceResource) ModifyPlan(
req resource.ModifyPlanRequest, req resource.ModifyPlanRequest,
resp *resource.ModifyPlanResponse, resp *resource.ModifyPlanResponse,
) { // nolint:gocritic // function signature required by Terraform ) { // nolint:gocritic // function signature required by Terraform
var configModel resourceModel var configModel LocalInstanceModel
// skip initial empty configuration to avoid follow-up errors // skip initial empty configuration to avoid follow-up errors
if req.Config.Raw.IsNull() { if req.Config.Raw.IsNull() {
return return
@ -94,7 +116,7 @@ func (r *instanceResource) ModifyPlan(
return return
} }
var planModel resourceModel var planModel LocalInstanceModel
resp.Diagnostics.Append(req.Plan.Get(ctx, &planModel)...) resp.Diagnostics.Append(req.Plan.Get(ctx, &planModel)...)
if resp.Diagnostics.HasError() { if resp.Diagnostics.HasError() {
return return
@ -144,40 +166,53 @@ func (r *instanceResource) Configure(
var modifiersFileByte []byte var modifiersFileByte []byte
// Schema defines the schema for the resource. // Schema defines the schema for the resource.
func (r *instanceResource) Schema(ctx context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) { func (r *instanceResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
schema := postgresflexalpha.InstanceResourceSchema(ctx) schemaVar := postgresflexalpha.InstanceResourceSchema(ctx)
schemaVar.Attributes["flavor"] = schema.SingleNestedAttribute{
Optional: true,
DeprecationMessage: "Please use flavor_id instead.",
Attributes: map[string]schema.Attribute{
"id": schema.StringAttribute{
Computed: true,
PlanModifiers: []planmodifier.String{
UseStateForUnknownIfFlavorUnchanged(req),
},
},
"description": schema.StringAttribute{
Computed: true,
PlanModifiers: []planmodifier.String{
UseStateForUnknownIfFlavorUnchanged(req),
},
},
"cpu": schema.Int64Attribute{
DeprecationMessage: "Please use flavor_id instead.",
Optional: true,
},
"ram": schema.Int64Attribute{
DeprecationMessage: "Please use flavor_id instead.",
Optional: true,
},
},
}
schemaVar.Attributes["flavor_id"] = schema.StringAttribute{
Optional: true,
Description: "The id of the instance flavor.",
MarkdownDescription: "The id of the instance flavor.",
}
fields, err := utils.ReadModifiersConfig(modifiersFileByte) fields, err := utils.ReadModifiersConfig(modifiersFileByte)
if err != nil { if err != nil {
resp.Diagnostics.AddError("error during read modifiers config file", err.Error()) resp.Diagnostics.AddError("error during read modifiers config file", err.Error())
return return
} }
err = utils.AddPlanModifiersToResourceSchema(fields, &schema) err = utils.AddPlanModifiersToResourceSchema(fields, &schemaVar)
if err != nil { if err != nil {
resp.Diagnostics.AddError("error adding plan modifiers", err.Error()) resp.Diagnostics.AddError("error adding plan modifiers", err.Error())
return return
} }
resp.Schema = schema resp.Schema = schemaVar
}
func (r *instanceResource) IdentitySchema(
_ context.Context,
_ resource.IdentitySchemaRequest,
resp *resource.IdentitySchemaResponse,
) {
resp.IdentitySchema = identityschema.Schema{
Attributes: map[string]identityschema.Attribute{
"project_id": identityschema.StringAttribute{
RequiredForImport: true, // must be set during import by the practitioner
},
"region": identityschema.StringAttribute{
RequiredForImport: true, // can be defaulted by the provider configuration
},
"instance_id": identityschema.StringAttribute{
RequiredForImport: true, // can be defaulted by the provider configuration
},
},
}
} }
// Create creates the resource and sets the initial Terraform state. // Create creates the resource and sets the initial Terraform state.
@ -186,7 +221,7 @@ func (r *instanceResource) Create(
req resource.CreateRequest, req resource.CreateRequest,
resp *resource.CreateResponse, resp *resource.CreateResponse,
) { // nolint:gocritic // function signature required by Terraform ) { // nolint:gocritic // function signature required by Terraform
var model resourceModel var model LocalInstanceModel
diags := req.Plan.Get(ctx, &model) diags := req.Plan.Get(ctx, &model)
resp.Diagnostics.Append(diags...) resp.Diagnostics.Append(diags...)
@ -201,15 +236,82 @@ func (r *instanceResource) Create(
ctx = tflog.SetField(ctx, "project_id", projectID) ctx = tflog.SetField(ctx, "project_id", projectID)
ctx = tflog.SetField(ctx, "region", region) ctx = tflog.SetField(ctx, "region", region)
var netAcl []string var netACL []string
diag := model.Network.Acl.ElementsAs(ctx, &netAcl, false) diag := model.Network.Acl.ElementsAs(ctx, &netACL, false)
resp.Diagnostics.Append(diags...) resp.Diagnostics.Append(diags...)
if diag.HasError() { if diag.HasError() {
return return
} }
// determine flavor ID
var flModel = &flavorModel{}
if !(model.Flavor.IsNull() || model.Flavor.IsUnknown()) {
diags = model.Flavor.As(ctx, flModel, basetypes.ObjectAsOptions{})
resp.Diagnostics.Append(diags...)
if resp.Diagnostics.HasError() {
return
}
flavors, err := getAllFlavors(ctx, r.client.DefaultAPI, projectID, region)
if err != nil {
core.LogAndAddError(ctx, &resp.Diagnostics, "Error reading flavors", fmt.Sprintf("getAllFlavors: %v", err))
return
}
tflog.Debug(ctx, fmt.Sprintf("loaded flavors: %d", len(flavors)))
var foundFlavors []v3alpha1api.ListFlavors
for _, flavor := range flavors {
if flModel.CPU.ValueInt64() != int64(flavor.Cpu) {
// tflog.Debug(ctx, fmt.Sprintf("flavor - cpu did not match (%d - %d)", flModel.CPU.ValueInt64(), flavor.Cpu))
continue
}
if flModel.RAM.ValueInt64() != int64(flavor.Memory) {
// tflog.Debug(ctx, fmt.Sprintf("flavor - ram did not match (%d - %d)", flModel.RAM.ValueInt64(), flavor.Memory))
continue
}
tmpNodeType := "Single"
if model.Replicas.ValueInt64() > 1 {
tmpNodeType = "Replica"
}
if strings.ToLower(tmpNodeType) != strings.ToLower(flavor.NodeType) {
//tflog.Debug(
// ctx,
// fmt.Sprintf(
// "flavor - nodeType did not match ('%s' - '%s')",
// strings.ToLower(tmpNodeType),
// strings.ToLower(flavor.NodeType),
// ),
//)
continue
}
tflog.Debug(ctx, fmt.Sprintf("found flavor %s, checking storage classes", flavor.Id))
for _, sc := range flavor.StorageClasses {
if model.Storage.PerformanceClass.ValueString() != sc.Class {
continue
}
tflog.Debug(ctx, fmt.Sprintf("found storage class '%s' for flavor '%s', checking storage classes", sc.Class, flavor.Id))
foundFlavors = append(foundFlavors, flavor)
}
}
if len(foundFlavors) == 0 {
resp.Diagnostics.AddError("get flavor", "could not find requested flavor")
return
}
if len(foundFlavors) > 1 {
resp.Diagnostics.AddError("get flavor", "found too many matching flavors")
return
}
f := foundFlavors[0]
flModel.Description = types.StringValue(f.Description)
flModel.Id = utils.BuildInternalTerraformId(model.ProjectId.ValueString(), region, f.Id)
model.FlavorId = types.StringValue(f.Id)
//flModel. .MaxGb = types.Int32Value(f.MaxGB)
//flModel.MinGb = types.Int32Value(f.MinGB)
}
replVal := model.Replicas.ValueInt64() // nolint:gosec // check is performed above replVal := model.Replicas.ValueInt64() // nolint:gosec // check is performed above
payload := modelToCreateInstancePayload(netAcl, model, replVal) payload := modelToCreateInstancePayload(netACL, model, replVal)
// Create new instance // Create new instance
createResp, err := r.client.DefaultAPI.CreateInstanceRequest( createResp, err := r.client.DefaultAPI.CreateInstanceRequest(
@ -229,18 +331,18 @@ func (r *instanceResource) Create(
return return
} }
// Set data returned by API in identity // Set data returned by API in id
identity := InstanceResourceIdentityModel{ resp.Diagnostics.Append(
ProjectID: types.StringValue(projectID), resp.State.SetAttribute(
Region: types.StringValue(region), ctx,
InstanceID: types.StringPointerValue(instanceID), path.Root("id"),
} utils.BuildInternalTerraformId(projectID, region, *instanceID),
resp.Diagnostics.Append(resp.Identity.Set(ctx, identity)...) )...,
if resp.Diagnostics.HasError() { )
return
}
waitResp, err := wait.CreateInstanceWaitHandler(ctx, r.client.DefaultAPI, projectID, region, *instanceID). waitResp, err := wait.CreateInstanceWaitHandler(ctx, r.client.DefaultAPI, projectID, region, *instanceID).
SetTimeout(90 * time.Minute).
SetSleepBeforeWait(10 * time.Second).
WaitWithContext(ctx) WaitWithContext(ctx)
if err != nil { if err != nil {
core.LogAndAddError( core.LogAndAddError(
@ -274,7 +376,7 @@ func (r *instanceResource) Create(
func modelToCreateInstancePayload( func modelToCreateInstancePayload(
netACL []string, netACL []string,
model postgresflexalpha.InstanceModel, model LocalInstanceModel,
replVal int64, replVal int64,
) v3alpha1api.CreateInstanceRequestPayload { ) v3alpha1api.CreateInstanceRequestPayload {
var enc *v3alpha1api.InstanceEncryption var enc *v3alpha1api.InstanceEncryption
@ -314,7 +416,7 @@ func (r *instanceResource) Read(
) { // nolint:gocritic // function signature required by Terraform ) { // nolint:gocritic // function signature required by Terraform
functionErrorSummary := "read instance failed" functionErrorSummary := "read instance failed"
var model resourceModel var model LocalInstanceModel
diags := req.State.Get(ctx, &model) diags := req.State.Get(ctx, &model)
resp.Diagnostics.Append(diags...) resp.Diagnostics.Append(diags...)
if resp.Diagnostics.HasError() { if resp.Diagnostics.HasError() {
@ -323,9 +425,9 @@ func (r *instanceResource) Read(
ctx = core.InitProviderContext(ctx) ctx = core.InitProviderContext(ctx)
var projectId string var projectID string
if !model.ProjectId.IsNull() && !model.ProjectId.IsUnknown() { if !model.ProjectId.IsNull() && !model.ProjectId.IsUnknown() {
projectId = model.ProjectId.ValueString() projectID = model.ProjectId.ValueString()
} }
var region string var region string
@ -333,16 +435,16 @@ func (r *instanceResource) Read(
region = r.providerData.GetRegionWithOverride(model.Region) region = r.providerData.GetRegionWithOverride(model.Region)
} }
var instanceId string var instanceID string
if !model.InstanceId.IsNull() && !model.InstanceId.IsUnknown() { if !model.InstanceId.IsNull() && !model.InstanceId.IsUnknown() {
instanceId = model.InstanceId.ValueString() instanceID = model.InstanceId.ValueString()
} }
ctx = tflog.SetField(ctx, "project_id", projectId) ctx = tflog.SetField(ctx, "project_id", projectID)
ctx = tflog.SetField(ctx, "instance_id", instanceId) ctx = tflog.SetField(ctx, "instance_id", instanceID)
ctx = tflog.SetField(ctx, "region", region) ctx = tflog.SetField(ctx, "region", region)
instanceResp, err := r.client.DefaultAPI.GetInstanceRequest(ctx, projectId, region, instanceId).Execute() instanceResp, err := r.client.DefaultAPI.GetInstanceRequest(ctx, projectID, region, instanceID).Execute()
if err != nil { if err != nil {
oapiErr, ok := err.(*oapierror.GenericOpenAPIError) //nolint:errorlint //complaining that error.As should be used to catch wrapped errors, but this error should not be wrapped oapiErr, ok := err.(*oapierror.GenericOpenAPIError) //nolint:errorlint //complaining that error.As should be used to catch wrapped errors, but this error should not be wrapped
if ok && oapiErr.StatusCode == http.StatusNotFound { if ok && oapiErr.StatusCode == http.StatusNotFound {
@ -361,7 +463,7 @@ func (r *instanceResource) Read(
return return
} }
if !model.InstanceId.IsUnknown() && !model.InstanceId.IsNull() { if !model.InstanceId.IsUnknown() && !model.InstanceId.IsNull() {
if *respInstanceID != instanceId { if *respInstanceID != instanceID {
core.LogAndAddError( core.LogAndAddError(
ctx, ctx,
&resp.Diagnostics, &resp.Diagnostics,
@ -372,6 +474,10 @@ func (r *instanceResource) Read(
} }
} }
if model.Id.IsUnknown() || model.Id.IsNull() {
model.Id = utils.BuildInternalTerraformId(projectID, region, instanceID)
}
err = mapGetInstanceResponseToModel(ctx, &model, instanceResp) err = mapGetInstanceResponseToModel(ctx, &model, instanceResp)
if err != nil { if err != nil {
core.LogAndAddError( core.LogAndAddError(
@ -389,17 +495,6 @@ func (r *instanceResource) Read(
return return
} }
// Set data returned by API in identity
identity := InstanceResourceIdentityModel{
ProjectID: types.StringValue(projectId),
Region: types.StringValue(region),
InstanceID: types.StringValue(instanceId),
}
resp.Diagnostics.Append(resp.Identity.Set(ctx, identity)...)
if resp.Diagnostics.HasError() {
return
}
tflog.Info(ctx, "Postgres Flex instance read") tflog.Info(ctx, "Postgres Flex instance read")
} }
@ -409,7 +504,7 @@ func (r *instanceResource) Update(
req resource.UpdateRequest, req resource.UpdateRequest,
resp *resource.UpdateResponse, resp *resource.UpdateResponse,
) { // nolint:gocritic // function signature required by Terraform ) { // nolint:gocritic // function signature required by Terraform
var model resourceModel var model LocalInstanceModel
diags := req.Plan.Get(ctx, &model) diags := req.Plan.Get(ctx, &model)
resp.Diagnostics.Append(diags...) resp.Diagnostics.Append(diags...)
@ -419,15 +514,8 @@ func (r *instanceResource) Update(
ctx = core.InitProviderContext(ctx) ctx = core.InitProviderContext(ctx)
// Read identity data projectID := model.ProjectId.ValueString()
var identityData InstanceResourceIdentityModel instanceID := model.InstanceId.ValueString()
resp.Diagnostics.Append(req.Identity.Get(ctx, &identityData)...)
if resp.Diagnostics.HasError() {
return
}
projectID := identityData.ProjectID.ValueString()
instanceID := identityData.InstanceID.ValueString()
region := model.Region.ValueString() region := model.Region.ValueString()
ctx = tflog.SetField(ctx, "project_id", projectID) ctx = tflog.SetField(ctx, "project_id", projectID)
ctx = tflog.SetField(ctx, "instance_id", instanceID) ctx = tflog.SetField(ctx, "instance_id", instanceID)
@ -490,7 +578,10 @@ func (r *instanceResource) Update(
projectID, projectID,
region, region,
instanceID, instanceID,
).WaitWithContext(ctx) ).
SetTimeout(90 * time.Minute).
SetSleepBeforeWait(10 * time.Second).
WaitWithContext(ctx)
if err != nil { if err != nil {
core.LogAndAddError( core.LogAndAddError(
ctx, ctx,
@ -526,7 +617,7 @@ func (r *instanceResource) Delete(
req resource.DeleteRequest, req resource.DeleteRequest,
resp *resource.DeleteResponse, resp *resource.DeleteResponse,
) { // nolint:gocritic // function signature required by Terraform ) { // nolint:gocritic // function signature required by Terraform
var model resourceModel var model LocalInstanceModel
diags := req.State.Get(ctx, &model) diags := req.State.Get(ctx, &model)
resp.Diagnostics.Append(diags...) resp.Diagnostics.Append(diags...)
@ -536,15 +627,15 @@ func (r *instanceResource) Delete(
ctx = core.InitProviderContext(ctx) ctx = core.InitProviderContext(ctx)
projectId := model.ProjectId.ValueString() projectID := model.ProjectId.ValueString()
instanceId := model.InstanceId.ValueString() instanceID := model.InstanceId.ValueString()
region := model.Region.ValueString() region := model.Region.ValueString()
ctx = tflog.SetField(ctx, "project_id", projectId) ctx = tflog.SetField(ctx, "project_id", projectID)
ctx = tflog.SetField(ctx, "instance_id", instanceId) ctx = tflog.SetField(ctx, "instance_id", instanceID)
ctx = tflog.SetField(ctx, "region", region) ctx = tflog.SetField(ctx, "region", region)
// Delete existing instance // Delete existing instance
err := r.client.DefaultAPI.DeleteInstanceRequest(ctx, projectId, region, instanceId).Execute() err := r.client.DefaultAPI.DeleteInstanceRequest(ctx, projectID, region, instanceID).Execute()
if err != nil { if err != nil {
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting instance", fmt.Sprintf("Calling API: %v", err)) core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting instance", fmt.Sprintf("Calling API: %v", err))
return return
@ -552,7 +643,7 @@ func (r *instanceResource) Delete(
ctx = core.LogResponse(ctx) ctx = core.LogResponse(ctx)
_, err = r.client.DefaultAPI.GetInstanceRequest(ctx, projectId, region, instanceId).Execute() _, err = r.client.DefaultAPI.GetInstanceRequest(ctx, projectID, region, instanceID).Execute()
if err != nil { if err != nil {
oapiErr, ok := err.(*oapierror.GenericOpenAPIError) //nolint:errorlint //complaining that error.As should be used to catch wrapped errors, but this error should not be wrapped oapiErr, ok := err.(*oapierror.GenericOpenAPIError) //nolint:errorlint //complaining that error.As should be used to catch wrapped errors, but this error should not be wrapped
if ok && oapiErr.StatusCode != http.StatusNotFound { if ok && oapiErr.StatusCode != http.StatusNotFound {
@ -574,41 +665,30 @@ func (r *instanceResource) ImportState(
) { ) {
ctx = core.InitProviderContext(ctx) ctx = core.InitProviderContext(ctx)
if req.ID != "" { idParts := strings.Split(req.ID, core.Separator)
idParts := strings.Split(req.ID, core.Separator)
if len(idParts) != 3 || idParts[0] == "" || idParts[1] == "" || idParts[2] == "" { if len(idParts) != 3 || idParts[0] == "" || idParts[1] == "" || idParts[2] == "" {
core.LogAndAddError( core.LogAndAddError(
ctx, &resp.Diagnostics, ctx, &resp.Diagnostics,
"Error importing instance", "Error importing instance",
fmt.Sprintf( fmt.Sprintf(
"Expected import identifier with format [project_id],[region],[instance_id] Got: %q", "Expected import identifier with format [project_id],[region],[instance_id] Got: %q",
req.ID, req.ID,
), ),
) )
return
}
resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("project_id"), idParts[0])...)
resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("region"), idParts[1])...)
resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("instance_id"), idParts[2])...)
return return
} }
// If no ID is provided, attempt to read identity attributes from the import configuration resp.Diagnostics.Append(
var identityData InstanceResourceIdentityModel resp.State.SetAttribute(
resp.Diagnostics.Append(req.Identity.Get(ctx, &identityData)...) ctx,
if resp.Diagnostics.HasError() { path.Root("id"),
return utils.BuildInternalTerraformId(idParts...),
} )...,
)
projectId := identityData.ProjectID.ValueString() resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("project_id"), idParts[0])...)
region := identityData.Region.ValueString() resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("region"), idParts[1])...)
instanceId := identityData.InstanceID.ValueString() resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("instance_id"), idParts[2])...)
resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("project_id"), projectId)...)
resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("region"), region)...)
resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("instance_id"), instanceId)...)
tflog.Info(ctx, "Postgres Flex instance state imported") tflog.Info(ctx, "Postgres Flex instance state imported")
} }

View file

@ -119,6 +119,13 @@ func InstanceResourceSchema(ctx context.Context) schema.Schema {
Description: "Whether the instance can be deleted or not.", Description: "Whether the instance can be deleted or not.",
MarkdownDescription: "Whether the instance can be deleted or not.", MarkdownDescription: "Whether the instance can be deleted or not.",
}, },
//"labels": schema.MapAttribute{
// ElementType: types.StringType,
// Optional: true,
// Computed: true,
// Description: "Key-value pairs, 63 characters max, begin and end with an alphanumerical character,\nmay contain dashes (-), underscores (_), dots (.), and alphanumerics between. Key MUST be at least 1 character.\nMax 64 labels\nRegex for keys: ^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$\nRegex for values: ^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$\nThe stackit- prefix is reserved and cannot be used for Keys.\n",
// MarkdownDescription: "Key-value pairs, 63 characters max, begin and end with an alphanumerical character,\nmay contain dashes (-), underscores (_), dots (.), and alphanumerics between. Key MUST be at least 1 character.\nMax 64 labels\nRegex for keys: ^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$\nRegex for values: ^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$\nThe stackit- prefix is reserved and cannot be used for Keys.\n",
//},
"name": schema.StringAttribute{ "name": schema.StringAttribute{
Required: true, Required: true,
Description: "The name of the instance.", Description: "The name of the instance.",
@ -191,8 +198,8 @@ func InstanceResourceSchema(ctx context.Context) schema.Schema {
}, },
"retention_days": schema.Int64Attribute{ "retention_days": schema.Int64Attribute{
Required: true, Required: true,
Description: "How long backups are retained. The value can only be between 32 and 365 days.", Description: "How long backups are retained. The value can only be between 32 and 90 days.",
MarkdownDescription: "How long backups are retained. The value can only be between 32 and 365 days.", MarkdownDescription: "How long backups are retained. The value can only be between 32 and 90 days.",
}, },
"status": schema.StringAttribute{ "status": schema.StringAttribute{
Computed: true, Computed: true,
@ -239,15 +246,16 @@ type InstanceModel struct {
Id types.String `tfsdk:"id"` Id types.String `tfsdk:"id"`
InstanceId types.String `tfsdk:"instance_id"` InstanceId types.String `tfsdk:"instance_id"`
IsDeletable types.Bool `tfsdk:"is_deletable"` IsDeletable types.Bool `tfsdk:"is_deletable"`
Name types.String `tfsdk:"name"` //Labels types.Map `tfsdk:"labels"`
Network NetworkValue `tfsdk:"network"` Name types.String `tfsdk:"name"`
ProjectId types.String `tfsdk:"project_id"` Network NetworkValue `tfsdk:"network"`
Region types.String `tfsdk:"region"` ProjectId types.String `tfsdk:"project_id"`
Replicas types.Int64 `tfsdk:"replicas"` Region types.String `tfsdk:"region"`
RetentionDays types.Int64 `tfsdk:"retention_days"` Replicas types.Int64 `tfsdk:"replicas"`
Status types.String `tfsdk:"status"` RetentionDays types.Int64 `tfsdk:"retention_days"`
Storage StorageValue `tfsdk:"storage"` Status types.String `tfsdk:"status"`
Version types.String `tfsdk:"version"` Storage StorageValue `tfsdk:"storage"`
Version types.String `tfsdk:"version"`
} }
var _ basetypes.ObjectTypable = ConnectionInfoType{} var _ basetypes.ObjectTypable = ConnectionInfoType{}

View file

@ -0,0 +1,85 @@
package postgresflexalpha
import (
"context"
"github.com/hashicorp/terraform-plugin-framework/resource"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/types/basetypes"
)
type useStateForUnknownIfFlavorUnchangedModifier struct {
Req resource.SchemaRequest
}
// UseStateForUnknownIfFlavorUnchanged returns a plan modifier similar to UseStateForUnknown
// if the RAM and CPU values are not changed in the plan. Otherwise, the plan modifier does nothing.
func UseStateForUnknownIfFlavorUnchanged(req resource.SchemaRequest) planmodifier.String {
return useStateForUnknownIfFlavorUnchangedModifier{
Req: req,
}
}
func (m useStateForUnknownIfFlavorUnchangedModifier) Description(context.Context) string {
return "UseStateForUnknownIfFlavorUnchanged returns a plan modifier similar to UseStateForUnknown if the RAM and CPU values are not changed in the plan. Otherwise, the plan modifier does nothing."
}
func (m useStateForUnknownIfFlavorUnchangedModifier) MarkdownDescription(ctx context.Context) string {
return m.Description(ctx)
}
func (m useStateForUnknownIfFlavorUnchangedModifier) PlanModifyString(ctx context.Context, req planmodifier.StringRequest, resp *planmodifier.StringResponse) { // nolint:gocritic // function signature required by Terraform
// Do nothing if there is no state value.
if req.StateValue.IsNull() {
return
}
// Do nothing if there is a known planned value.
if !req.PlanValue.IsUnknown() {
return
}
// Do nothing if there is an unknown configuration value, otherwise interpolation gets messed up.
if req.ConfigValue.IsUnknown() {
return
}
// The above checks are taken from the UseStateForUnknown plan modifier implementation
// (https://github.com/hashicorp/terraform-plugin-framework/blob/main/resource/schema/stringplanmodifier/use_state_for_unknown.go#L38)
var stateModel LocalInstanceModel
diags := req.State.Get(ctx, &stateModel)
resp.Diagnostics.Append(diags...)
if resp.Diagnostics.HasError() {
return
}
var stateFlavor = &flavorModel{}
if !(stateModel.Flavor.IsNull() || stateModel.Flavor.IsUnknown()) {
diags = stateModel.Flavor.As(ctx, stateFlavor, basetypes.ObjectAsOptions{})
resp.Diagnostics.Append(diags...)
if resp.Diagnostics.HasError() {
return
}
}
var planModel LocalInstanceModel
diags = req.Plan.Get(ctx, &planModel)
resp.Diagnostics.Append(diags...)
if resp.Diagnostics.HasError() {
return
}
var planFlavor = &flavorModel{}
if !(planModel.Flavor.IsNull() || planModel.Flavor.IsUnknown()) {
diags = planModel.Flavor.As(ctx, planFlavor, basetypes.ObjectAsOptions{})
resp.Diagnostics.Append(diags...)
if resp.Diagnostics.HasError() {
return
}
}
if planFlavor.CPU == stateFlavor.CPU && planFlavor.RAM == stateFlavor.RAM {
resp.PlanValue = req.StateValue
}
}

View file

@ -23,16 +23,21 @@ resource "stackitprivatepreview_postgresflexalpha_instance" "{{ .TfName }}" {
} }
{{ end }} {{ end }}
network = { network = {
acl = ["{{ .ACLString }}"] acl = [{{ range $i, $v := .ACLStrings }}{{if $i}},{{end}}"{{$v}}"{{end}}]
access_scope = "{{ .AccessScope }}" access_scope = "{{ .AccessScope }}"
} }
version = {{ .Version }} {{ if .Version }}
version = "{{ .Version }}"
{{ end }}
} }
{{ if .Users }} {{ if .Users }}
{{ $tfName := .TfName }} {{ $tfName := .TfName }}
{{ range $user := .Users }} {{ range $user := .Users }}
resource "stackitprivatepreview_postgresflexalpha_user" "{{ $user.Name }}" { resource "stackitprivatepreview_postgresflexalpha_user" "{{ $user.Name }}" {
depends_on = [
stackitprivatepreview_postgresflexalpha_instance.{{ $tfName }}
]
project_id = "{{ $user.ProjectID }}" project_id = "{{ $user.ProjectID }}"
instance_id = stackitprivatepreview_postgresflexalpha_instance.{{ $tfName }}.instance_id instance_id = stackitprivatepreview_postgresflexalpha_instance.{{ $tfName }}.instance_id
name = "{{ $user.Name }}" name = "{{ $user.Name }}"
@ -45,6 +50,10 @@ resource "stackitprivatepreview_postgresflexalpha_user" "{{ $user.Name }}" {
{{ $tfName := .TfName }} {{ $tfName := .TfName }}
{{ range $db := .Databases }} {{ range $db := .Databases }}
resource "stackitprivatepreview_postgresflexalpha_database" "{{ $db.Name }}" { resource "stackitprivatepreview_postgresflexalpha_database" "{{ $db.Name }}" {
depends_on = [
stackitprivatepreview_postgresflexalpha_instance.{{ $tfName }},
stackitprivatepreview_postgresflexalpha_user.{{ $db.Owner }}
]
project_id = "{{ $db.ProjectID }}" project_id = "{{ $db.ProjectID }}"
instance_id = stackitprivatepreview_postgresflexalpha_instance.{{ $tfName }}.instance_id instance_id = stackitprivatepreview_postgresflexalpha_instance.{{ $tfName }}.instance_id
name = "{{ $db.Name }}" name = "{{ $db.Name }}"
@ -52,3 +61,32 @@ resource "stackitprivatepreview_postgresflexalpha_database" "{{ $db.Name }}" {
} }
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ if .DataSourceTest }}
data "stackitprivatepreview_postgresflexalpha_instance" "{{ .TfName }}" {
project_id = stackitprivatepreview_postgresflexalpha_instance.{{ .TfName }}.project_id
instance_id = stackitprivatepreview_postgresflexalpha_instance.{{ .TfName }}.instance_id
}
{{ if .Users }}
{{ $tfName := .TfName }}
{{ range $user := .Users }}
data "stackitprivatepreview_postgresflexalpha_user" "{{ $user.Name }}" {
project_id = stackitprivatepreview_postgresflexalpha_instance.{{ $tfName }}.project_id
instance_id = stackitprivatepreview_postgresflexalpha_instance.{{ $tfName }}.instance_id
user_id = stackitprivatepreview_postgresflexalpha_user.{{ $user.Name }}.user_id
}
{{ end }}
{{ end }}
{{ if .Databases }}
{{ $tfName := .TfName }}
{{ range $db := .Databases }}
data "stackitprivatepreview_postgresflexalpha_database" "{{ $db.Name }}" {
project_id = stackitprivatepreview_postgresflexalpha_instance.{{ $tfName }}.project_id
instance_id = stackitprivatepreview_postgresflexalpha_instance.{{ $tfName }}.instance_id
database_id = stackitprivatepreview_postgresflexalpha_database.{{ $db.Name }}.database_id
}
{{ end }}
{{ end }}
{{ end }}

View file

@ -0,0 +1,101 @@
provider "stackitprivatepreview" {
default_region = "{{ .Region }}"
service_account_key_path = "{{ .ServiceAccountFilePath }}"
}
data "stackitprivatepreview_postgresflexalpha_flavor" "flavor" {
project_id = "{{ .ProjectID }}"
region = "{{ .Region }}"
cpu = 4
ram = 16
node_type = "Single"
storage_class = "premium-perf2-stackit"
}
resource "stackitprivatepreview_postgresflexalpha_instance" "{{ .TfName }}" {
project_id = "{{ .ProjectID }}"
name = "{{ .Name }}"
backup_schedule = "{{ .BackupSchedule }}"
retention_days = {{ .RetentionDays }}
flavor_id = "{{ .FlavorID }}"
replicas = {{ .Replicas }}
storage = {
performance_class = "{{ .PerformanceClass }}"
size = {{ .Size }}
}
{{ if .UseEncryption }}
encryption = {
kek_key_id = "{{ .KekKeyID }}"
kek_key_ring_id = "{{ .KekKeyRingID }}"
kek_key_version = {{ .KekKeyVersion }}
service_account = "{{ .KekServiceAccount }}"
}
{{ end }}
network = {
acl = [{{ range $i, $v := .ACLStrings }}{{if $i}},{{end}}"{{$v}}"{{end}}]
access_scope = "{{ .AccessScope }}"
}
{{ if .Version }}
version = "{{ .Version }}"
{{ end }}
}
{{ if .Users }}
{{ $tfName := .TfName }}
{{ range $user := .Users }}
resource "stackitprivatepreview_postgresflexalpha_user" "{{ $user.Name }}" {
depends_on = [
stackitprivatepreview_postgresflexalpha_instance.{{ $tfName }}
]
project_id = "{{ $user.ProjectID }}"
instance_id = stackitprivatepreview_postgresflexalpha_instance.{{ $tfName }}.instance_id
name = "{{ $user.Name }}"
roles = [{{ range $i, $v := $user.Roles }}{{if $i}},{{end}}"{{$v}}"{{end}}]
}
{{ end }}
{{ end }}
{{ if .Databases }}
{{ $tfName := .TfName }}
{{ range $db := .Databases }}
resource "stackitprivatepreview_postgresflexalpha_database" "{{ $db.Name }}" {
depends_on = [
stackitprivatepreview_postgresflexalpha_instance.{{ $tfName }},
stackitprivatepreview_postgresflexalpha_user.{{ $db.Owner }}
]
project_id = "{{ $db.ProjectID }}"
instance_id = stackitprivatepreview_postgresflexalpha_instance.{{ $tfName }}.instance_id
name = "{{ $db.Name }}"
owner = stackitprivatepreview_postgresflexalpha_user.{{ $db.Owner }}.name
}
{{ end }}
{{ end }}
{{ if .DataSourceTest }}
data "stackitprivatepreview_postgresflexalpha_instance" "{{ .TfName }}" {
project_id = stackitprivatepreview_postgresflexalpha_instance.{{ .TfName }}.project_id
instance_id = stackitprivatepreview_postgresflexalpha_instance.{{ .TfName }}.instance_id
}
{{ if .Users }}
{{ $tfName := .TfName }}
{{ range $user := .Users }}
data "stackitprivatepreview_postgresflexalpha_user" "{{ $user.Name }}" {
project_id = stackitprivatepreview_postgresflexalpha_instance.{{ $tfName }}.project_id
instance_id = stackitprivatepreview_postgresflexalpha_instance.{{ $tfName }}.instance_id
user_id = stackitprivatepreview_postgresflexalpha_user.{{ $user.Name }}.user_id
}
{{ end }}
{{ end }}
{{ if .Databases }}
{{ $tfName := .TfName }}
{{ range $db := .Databases }}
data "stackitprivatepreview_postgresflexalpha_database" "{{ $db.Name }}" {
project_id = stackitprivatepreview_postgresflexalpha_instance.{{ $tfName }}.project_id
instance_id = stackitprivatepreview_postgresflexalpha_instance.{{ $tfName }}.instance_id
database_id = stackitprivatepreview_postgresflexalpha_database.{{ $db.Name }}.database_id
}
{{ end }}
{{ end }}
{{ end }}

View file

@ -35,7 +35,7 @@ func UserDataSourceSchema(ctx context.Context) schema.Schema {
MarkdownDescription: "The STACKIT project ID.", MarkdownDescription: "The STACKIT project ID.",
}, },
"region": schema.StringAttribute{ "region": schema.StringAttribute{
Required: true, Optional: true,
Description: "The region which should be addressed", Description: "The region which should be addressed",
MarkdownDescription: "The region which should be addressed", MarkdownDescription: "The region which should be addressed",
Validators: []validator.String{ Validators: []validator.String{

View file

@ -116,7 +116,12 @@ func mapResourceFields(userResp *v3alpha1api.GetUserResponse, model *resourceMod
return fmt.Errorf("user id not present") return fmt.Errorf("user id not present")
} }
model.Id = types.Int64Value(userID) model.Id = utils.BuildInternalTerraformId(
model.ProjectId.ValueString(),
model.Region.ValueString(),
model.InstanceId.ValueString(),
strconv.FormatInt(userID, 10),
)
model.UserId = types.Int64Value(userID) model.UserId = types.Int64Value(userID)
model.Name = types.StringValue(user.Name) model.Name = types.StringValue(user.Name)

View file

@ -1,6 +1,7 @@
package postgresflexalpha package postgresflexalpha
import ( import (
"fmt"
"testing" "testing"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
@ -165,7 +166,7 @@ func TestMapFieldsCreate(t *testing.T) {
}, },
testRegion, testRegion,
resourceModel{ resourceModel{
Id: types.Int64Value(1), Id: types.StringValue(fmt.Sprintf("%s,%s,%s,%d", "pid", testRegion, "iid", 1)),
UserId: types.Int64Value(1), UserId: types.Int64Value(1),
InstanceId: types.StringValue("iid"), InstanceId: types.StringValue("iid"),
ProjectId: types.StringValue("pid"), ProjectId: types.StringValue("pid"),
@ -187,7 +188,7 @@ func TestMapFieldsCreate(t *testing.T) {
}, },
testRegion, testRegion,
resourceModel{ resourceModel{
Id: types.Int64Value(1), Id: types.StringValue(fmt.Sprintf("%s,%s,%s,%d", "pid", testRegion, "iid", 1)),
UserId: types.Int64Value(1), UserId: types.Int64Value(1),
InstanceId: types.StringValue("iid"), InstanceId: types.StringValue("iid"),
ProjectId: types.StringValue("pid"), ProjectId: types.StringValue("pid"),
@ -209,7 +210,7 @@ func TestMapFieldsCreate(t *testing.T) {
}, },
testRegion, testRegion,
resourceModel{ resourceModel{
Id: types.Int64Value(1), Id: types.StringValue(fmt.Sprintf("%s,%s,%s,%d", "pid", testRegion, "iid", 1)),
UserId: types.Int64Value(1), UserId: types.Int64Value(1),
InstanceId: types.StringValue("iid"), InstanceId: types.StringValue("iid"),
ProjectId: types.StringValue("pid"), ProjectId: types.StringValue("pid"),
@ -249,6 +250,7 @@ func TestMapFieldsCreate(t *testing.T) {
tt.description, func(t *testing.T) { tt.description, func(t *testing.T) {
state := &resourceModel{ state := &resourceModel{
ProjectId: tt.expected.ProjectId, ProjectId: tt.expected.ProjectId,
Region: types.StringValue(testRegion),
InstanceId: tt.expected.InstanceId, InstanceId: tt.expected.InstanceId,
} }
@ -286,7 +288,7 @@ func TestMapFields(t *testing.T) {
}, },
testRegion, testRegion,
resourceModel{ resourceModel{
Id: types.Int64Value(1), Id: types.StringValue(fmt.Sprintf("%s,%s,%s,%d", "pid", testRegion, "iid", 1)),
UserId: types.Int64Value(int64(1)), UserId: types.Int64Value(int64(1)),
InstanceId: types.StringValue("iid"), InstanceId: types.StringValue("iid"),
ProjectId: types.StringValue("pid"), ProjectId: types.StringValue("pid"),
@ -311,7 +313,7 @@ func TestMapFields(t *testing.T) {
}, },
testRegion, testRegion,
resourceModel{ resourceModel{
Id: types.Int64Value(1), Id: types.StringValue(fmt.Sprintf("%s,%s,%s,%d", "pid", testRegion, "iid", 1)),
UserId: types.Int64Value(1), UserId: types.Int64Value(1),
InstanceId: types.StringValue("iid"), InstanceId: types.StringValue("iid"),
ProjectId: types.StringValue("pid"), ProjectId: types.StringValue("pid"),
@ -339,7 +341,7 @@ func TestMapFields(t *testing.T) {
}, },
testRegion, testRegion,
resourceModel{ resourceModel{
Id: types.Int64Value(1), Id: types.StringValue(fmt.Sprintf("%s,%s,%s,%d", "pid", testRegion, "iid", 1)),
UserId: types.Int64Value(1), UserId: types.Int64Value(1),
InstanceId: types.StringValue("iid"), InstanceId: types.StringValue("iid"),
ProjectId: types.StringValue("pid"), ProjectId: types.StringValue("pid"),
@ -379,6 +381,7 @@ func TestMapFields(t *testing.T) {
state := &resourceModel{ state := &resourceModel{
ProjectId: tt.expected.ProjectId, ProjectId: tt.expected.ProjectId,
InstanceId: tt.expected.InstanceId, InstanceId: tt.expected.InstanceId,
Region: types.StringValue(tt.region),
} }
err := mapResourceFields(tt.input, state, tt.region) err := mapResourceFields(tt.input, state, tt.region)
if !tt.isValid && err == nil { if !tt.isValid && err == nil {
@ -388,7 +391,7 @@ func TestMapFields(t *testing.T) {
t.Fatalf("Should not have failed: %v", err) t.Fatalf("Should not have failed: %v", err)
} }
if tt.isValid { if tt.isValid {
diff := cmp.Diff(state, &tt.expected) diff := cmp.Diff(&tt.expected, state)
if diff != "" { if diff != "" {
t.Fatalf("Data does not match: %s", diff) t.Fatalf("Data does not match: %s", diff)
} }
@ -476,7 +479,7 @@ func TestToCreatePayload(t *testing.T) {
t.Fatalf("Should not have failed: %v", err) t.Fatalf("Should not have failed: %v", err)
} }
if tt.isValid { if tt.isValid {
diff := cmp.Diff(output, tt.expected) diff := cmp.Diff(tt.expected, output)
if diff != "" { if diff != "" {
t.Fatalf("Data does not match: %s", diff) t.Fatalf("Data does not match: %s", diff)
} }

Some files were not shown because too many files have changed in this diff Show more