Closed JasonCubic closed 1 year ago
The RemoteBackend
is used for connecting to Terraform Cloud (though CloudBackend
has replaced it).
ArtifactoryBackend
is what is used for connecting to an artifactory backend. Note that this backend has been removed in the latest versions of Terraform.
Its my understanding that artifactory now uses the remote_backend in terraform. It works in terraform. It's just cdktf where it doesn't seem to work.
https://www.jfrog.com/confluence/display/JFROG/Terraform+Backend+Repository
I made a simpler repo to show the problem. https://github.com/JasonCubic/cdktf-remote-backend-artifactory
If you fill in the .env file with values then you will see that the cdktf fails and terraform works.
If you look at the scripts in package.json, these commands fail:
npm run cdktf:plan
npm run cdktf:apply
npm run cdktf:destroy
These command work:
npm run tf:init
npm run tf:plan
npm run tf:apply
npm run tf:state:pull
npm run tf:destroy
If you look at the contents of the scripts in package.json I hope it helps clarify.
Thank You,
@JasonCubic thanks for the additional information.
cdktf
does/did rely on using an api for performing actions when using RemoteBackend
or CloudBackend
. These pieces must not be compatible with using a non TFC/TFE backend.
That API usage is being replaced with direct Terraform CLI
usage, which may cover a fix for this. https://github.com/hashicorp/terraform-cdk/pull/2424 and https://github.com/hashicorp/terraform-cdk/pull/2427 are a couple in-progress PRs which may fully resolve this.
Those should be fixed in the upcoming 0.15 release (should be ready latest by end of the week)
I'm going to lock this issue because it has been closed for 30 days. This helps our maintainers find and focus on the active issues. If you've found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Community Note
cdktf & Language Versions
v0.14.3 TypeScript
Affected Resource(s)
The standard RemoteBackend
Debug Output
Expected Behavior
connects to an artifactory terraform RemoteBackend successfully. With the same level of success that the terraform cli has.
These terraform commands work:
This cdktf deploy command does not:
cdktf deploy <stack-name> -auto-approve
Actual Behavior
works using terraform cli but not using cdktf cli
Steps to Reproduce
setup an artifactory terraform backend free trial and try to connect to it using CDKTF RemoteBackend
Important Factoids
It seems like the correct url's might not be getting used? Maybe??
This is the URL of a repo in artifactory:
https://<artifactory jfrog domain>/artifactory/<repo name>/workspaces/<workspace name>/
This seems to be the url being used:
https://<artifactory jfrog domain>/api/v2/organizations/<repo name>/workspaces/<workspace name>
0000