Skip to content

Refactor ibm_database resource and datasource to introduce backend abstraction#6667

Merged
obai-1 merged 14 commits intoIBM-Cloud:masterfrom
obai-1:obai/refactor-for-gen2
Mar 23, 2026
Merged

Refactor ibm_database resource and datasource to introduce backend abstraction#6667
obai-1 merged 14 commits intoIBM-Cloud:masterfrom
obai-1:obai/refactor-for-gen2

Conversation

@obai-1
Copy link
Copy Markdown
Collaborator

@obai-1 obai-1 commented Feb 15, 2026

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Relates #0000

Summary

This PR introduces backend abstraction for both the ibm_database resource and datasource to separate Classic and Gen2 implementation paths. This is a preparatory refactor to enable incremental addition of Gen2 support without changing current behavior.

Details

  • Adds a backend interface and concrete backend structs for Classic and Gen2 paths.
  • Routes existing Classic resource and datasource logic through the new backend layer.
  • Introduces Gen2 backend scaffolding only (no functional implementation yet).
  • Gen2 plans will continue to behave exactly as before (currently erroring).
  • No schema, API, or user-visible functional changes.

This is the first step in a planned series of incremental changes to support Gen2 databases while keeping risk low and avoiding large one-time refactors.

Testing

No functional changes expected. Existing acceptance tests pass.

Output from acceptance testing:

$ make build
$ make testacc TEST=./ibm/service/database TESTARGS='-run=TestAccIBMDatabaseInstance_Redis_Basic'
=== RUN   TestAccIBMDatabaseInstance_Redis_Basic
=== PAUSE TestAccIBMDatabaseInstance_Redis_Basic
=== CONT  TestAccIBMDatabaseInstance_Redis_Basic
--- PASS: TestAccIBMDatabaseInstance_Redis_Basic (633.08s)
PASS
ok  	github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/database	634.608s

$ make testacc TEST=./ibm/service/database TESTARGS='-run=TestAccIBMDatabaseDataSourceBasic'
=== RUN   TestAccIBMDatabaseDataSourceBasic
=== PAUSE TestAccIBMDatabaseDataSourceBasic
=== CONT  TestAccIBMDatabaseDataSourceBasic
--- PASS: TestAccIBMDatabaseDataSourceBasic (529.11s)
PASS
ok  	github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/database	530.638s
...

Output form unit testing:

$ make test TEST=./ibm/service/database
==> Checking that code complies with gofmt requirements...
go test -i ./ibm/service/database || exit 1
?   	github.com/IBM-Cloud/terraform-provider-ibm	[no test files]
echo ./ibm/service/database | \
		xargs -t -n4 go test  -timeout=30s -parallel=4
go test -timeout=30s -parallel=4 ./ibm/service/database
ok  	github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/database	1.646s

@obai-1 obai-1 marked this pull request as draft February 15, 2026 22:32
@obai-1 obai-1 marked this pull request as ready for review March 9, 2026 13:06
Copy link
Copy Markdown
Contributor

@pushpalathaeg pushpalathaeg left a comment

Choose a reason for hiding this comment

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

LGTM

@obai-1 obai-1 merged commit 7b3513f into IBM-Cloud:master Mar 23, 2026
1 check passed
@obai-1 obai-1 deleted the obai/refactor-for-gen2 branch March 23, 2026 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants