-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Circular Dependency project_id #677
Comments
#808 fixes the issue with |
Sorry @manish-hashicorp, I'm not sure I understand, as this is not a Vault Secrets specific problem. The intent of this ticket was to allow a project to be defined and then other resources to use that project; something like this, resource "hcp_project" "example" {
name = "example-project"
description = "My new project!"
}
resource "hcp_vault_secrets_app" "example" {
app_name = "example-app-name"
description = "My new app!"
project_id = hcp_project.example.project_id
}
resource "hcp_consul_cluster" "example" {
cluster_id = "consul-cluster"
hvn_id = hcp_hvn.example.hvn_id
tier = "development"
project_id = hcp_project.example.project_id
} Does #808 fix that? |
Yes. The above tf should work except that resource "hcp_project" "example" {
name = "example-project"
description = "My new project!"
}
resource "hcp_vault_secrets_app" "example" {
app_name = "example-app-name"
description = "My new app!"
project_id = hcp_project.example.resource_id
}
resource "hcp_consul_cluster" "example" {
cluster_id = "consul-cluster"
hvn_id = hcp_hvn.example.hvn_id
tier = "development"
project_id = hcp_project.example.resource_id
} |
Terraform Version and Provider Version
Affected Resource(s)
Debug Output
The provider is working as currently intended.
Expected Behavior
When using the HashiCorp Cloud Platform (HCP) Terraform provider, it is anticipated that one should be able to dynamically create an HCP project using the hcp_project resource and then use the output of this resource (specifically the project_id) within the same Terraform configuration to configure other HCP resources, like hcp_vault_secrets_app. This is based on the expectation that Terraform should handle the flow of data between resources and allow the use of outputs from one resource as inputs to others, or even as part of the provider configuration, within the same execution plan.
Actual Behavior
In practice, when attempting to use the hcp_project resource to create an HCP project and then reference its project_id in subsequent resources or as part of the provider configuration, a circular dependency error is encountered. The HCP Terraform provider requires the project_id to be set at the provider level. However, this project_id is only known after the hcp_project resource is created, leading to a situation where the provider configuration is dependent on a resource that, in turn, depends on the provider. This results in Terraform being unable to resolve the order of creation and configuration, causing a cycle error.
Important
FactoidsFactsCommunity Note
The text was updated successfully, but these errors were encountered: