You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to run below code to add this 2 resources. But it is falling:
import os
from constructs import Construct
from cdktf import App, TerraformStack, TerraformOutput, Token
from imports.dbtcloud.provider import DbtcloudProvider
from imports.dbtcloud.project import Project
from imports.dbtcloud.connection import Connection
from imports.dbtcloud.dbt_cloud_repository import DbtCloudRepository
class MyStack(TerraformStack):
def __init__(self, scope: Construct, id: str):
super().__init__(scope, id)
DbtcloudProvider(
self,
id="dbtcloud",
account_id=1,
token=os.environ.get("DBT_CLOUD_TOKEN"),
host_url=os.environ.get("HOST_URL"),
)
POC_project = Project(self, id_="dbtcloud_project", name="Personal: terraform")
redshift_database = Connection(
self,
id_="dbtcloud_connection",
project_id=Token.as_number(POC_project.id),
type="redshift",
name="connection for POC",
database="gtm_glo_src_temp",
port=5439,
host_name=os.environ.get("HOST_NAME"),
)
#THIS RESOURCE FAILS!:
gitlab_repo = DbtCloudRepository(
self,
id_="dbtcloud_repository",
project_id=Token.as_number(POC_project.id),
remote_url="",
gitlab_project_id=8765,
git_clone_strategy="deploy_token",
)
app = App()
MyStack(app, "cdktf-gitlab")
app.synth()
Actual Behavior
cdktf diff output:
~/terraform/cdktf-gitlab$ cdktf diff
cdktf-gitlab Initializing the backend...
cdktf-gitlab Initializing provider plugins...
- Reusing previous version of dbt-labs/dbtcloud from the dependency lock file
cdktf-gitlab - Finding latest version of hashicorp/dbt...
cdktf-gitlab - Using previously-installed dbt-labs/dbtcloud v0.2.20
cdktf-gitlab ╷
│ Error: Failed to query available provider packages
│
│ Could not retrieve the list of available versions for provider hashicorp/dbt:
│ provider registry registry.terraform.io does not have a provider named
│ registry.terraform.io/hashicorp/dbt
│
│ All modules should specify their required_providers so that external
│ consumers will get the correct providers when using a module. To see which
│ modules are currently depending on hashicorp/dbt, run the following command:
│ terraform providers
╵
⠴ Processing
Error: terraform init failed with exit code 1
Steps to Reproduce
Set 3 env variables: DBT_CLOUD_TOKEN, HOST_URL, HOST_NAME to connect to dbt cloud:
export DBT_CLOUD_TOKEN=""
export HOST_URL=""
export HOST_NAME =""
Run cdktf diff on this code:
import os
from constructs import Construct
from cdktf import App, TerraformStack, TerraformOutput, Token
from imports.dbtcloud.provider import DbtcloudProvider
from imports.dbtcloud.project import Project
from imports.dbtcloud.connection import Connection
from imports.dbtcloud.dbt_cloud_repository import DbtCloudRepository
class MyStack(TerraformStack):
def __init__(self, scope: Construct, id: str):
super().__init__(scope, id)
DbtcloudProvider(
self,
id="dbtcloud",
account_id=1,
token=os.environ.get("DBT_CLOUD_TOKEN"),
host_url=os.environ.get("HOST_URL"),
)
POC_project = Project(self, id_="dbtcloud_project", name="Personal: terraform")
redshift_database = Connection(
self,
id_="dbtcloud_connection",
project_id=Token.as_number(POC_project.id),
type="redshift",
name="connection for POC",
database="gtm_glo_src_temp",
port=5439,
host_name=os.environ.get("HOST_NAME"),
)
# gitlab_repo = DbtCloudRepository(
# self,
# id_="dbtcloud_repository",
# project_id=Token.as_number(POC_project.id),
# remote_url="",
# gitlab_project_id=8765,
# git_clone_strategy="deploy_token",
# )
app = App()
MyStack(app, "cdktf-gitlab")
app.synth()
It gives this output:
cdktf diff
cdktf-gitlab Initializing the backend...
cdktf-gitlab Initializing provider plugins...
- Reusing previous version of dbt-labs/dbtcloud from the dependency lock file
cdktf-gitlab - Using previously-installed dbt-labs/dbtcloud v0.2.20
cdktf-gitlab Terraform has been successfully initialized!
You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.
If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
cdktf-gitlab Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
cdktf-gitlab + create
Terraform will perform the following actions:
# dbtcloud_connection.dbtcloud_connection (dbtcloud_connection) will be created
+ resource "dbtcloud_connection" "dbtcloud_connection" {
+ adapter_id = (known after apply)
+ allow_keep_alive = false
+ allow_sso = false
+ connection_id = (known after apply)
+ database = "gtm_glo_src_temp"
+ host_name = ""
+ id = (known after apply)
+ is_active = true
+ name = "connection for POC"
+ port = 5439
+ project_id = (known after apply)
+ tunnel_enabled = false
+ type = "redshift"
}
# dbtcloud_project.dbtcloud_project (dbtcloud_project) will be created
+ resource "dbtcloud_project" "dbtcloud_project" {
+ id = (known after apply)
+ name = "Personal: terraform"
}
Plan: 2 to add, 0 to change, 0 to destroy.
─────────────────────────────────────────────────────────────────────────────
Saved the plan to: plan
To perform exactly these actions, run the following command to apply:
terraform apply "plan"
Uncoment DbtCloudRepository part.
Run it again and error will appear with this resource.
┌───────────────────┬──────────────────┬───────┬────────────┬──────────────┬─────────────────┐
│ Provider Name │ Provider Version │ CDKTF │ Constraint │ Package Name │ Package Version │
├───────────────────┼──────────────────┼───────┼────────────┼──────────────┼─────────────────┤
│ dbt-labs/dbtcloud │ 0.2.20 │ │ ~> 0.2 │ │ │
└───────────────────┴──────────────────┴───────┴────────────┴──────────────┴─────────────────┘
Gist
No response
Possible Solutions
Probably the problem is with cdktf itself:
Looking inside: imports/dbtcloud/dbt_cloud_repository I can see this class is referencing wrong terraform resource:
Please vote on this issue by adding a 👍 reaction to the original issue 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 issue followers and do not help prioritize the request
If you are interested in working on this issue or have submitted a pull request, please leave a comment
The text was updated successfully, but these errors were encountered:
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.
Expected Behavior
I am trying to run below code to add this 2 resources. But it is falling:
Actual Behavior
cdktf diff output:
Steps to Reproduce
Set 3 env variables: DBT_CLOUD_TOKEN, HOST_URL, HOST_NAME to connect to dbt cloud:
export DBT_CLOUD_TOKEN=""
export HOST_URL=""
export HOST_NAME =""
Run cdktf diff on this code:
It gives this output:
Versions
cdktf debug
Providers
┌───────────────────┬──────────────────┬───────┬────────────┬──────────────┬─────────────────┐
│ Provider Name │ Provider Version │ CDKTF │ Constraint │ Package Name │ Package Version │
├───────────────────┼──────────────────┼───────┼────────────┼──────────────┼─────────────────┤
│ dbt-labs/dbtcloud │ 0.2.20 │ │ ~> 0.2 │ │ │
└───────────────────┴──────────────────┴───────┴────────────┴──────────────┴─────────────────┘
Gist
No response
Possible Solutions
Probably the problem is with cdktf itself:
Looking inside: imports/dbtcloud/dbt_cloud_repository I can see this class is referencing wrong terraform resource:
it reference:
and it should:
Workarounds
No response
Anything Else?
No response
References
No response
Help Wanted
Community Note
The text was updated successfully, but these errors were encountered: