Skip to content

Can't manage hcp_waypoint_tfc_config on existing project #1330

Open
@danquack

Description

@danquack

Terraform Version and Provider Version

Terraform v1.12.1
on darwin_arm64
+ provider registry.terraform.io/hashicorp/hcp v0.107.0
+ provider registry.terraform.io/hashicorp/tfe v0.67.1
+ provider registry.terraform.io/hashicorp/vault v5.0.0

Your version of Terraform is out of date! The latest version
is 1.12.2. You can update by downloading from https://developer.hashicorp.com/terraform/install

Affected Resource(s)

  • hcp_waypoint_tfc_config

Terraform Configuration Files

locals {
  org_name = "<insert org name here>"
}

resource "tfe_project" "test" {
  name         = "waypoint-test-project"
  organization = local.org_name
}

resource "tfe_team" "test" {
  name         = "waypoint-test-team"
  organization = local.org_name
}

resource "tfe_team_token" "test" {
  depends_on = [tfe_team_project_access.maintain]
  team_id    = tfe_team.test.id
}

resource "tfe_team_project_access" "maintain" {
  access     = "maintain"
  team_id    = tfe_team.test.id
  project_id = tfe_project.test.id
}

resource "hcp_waypoint_tfc_config" "test" {
  token        = tfe_team_token.test.token
  tfc_org_name = local.org_name
}

Debug Output

2025-07-01T10:09:57.515-0400 [INFO]  provider.terraform-provider-hcp_v0.107.0_x5: Creating TFC Config: @caller=github.com/hashicorp/terraform-provider-hcp/internal/provider/waypoint/resource_waypoint_tfc_config.go:116 @module=hcp tf_mux_provider="*proto6server.Server" tf_provider_addr=registry.terraform.io/hashicorp/hcp tf_req_id=4538d041-8b73-3c55-aadc-8e797353fb3f tf_resource_type=hcp_waypoint_tfc_config tf_rpc=ApplyResourceChange timestamp=2025-07-01T10:09:57.515-0400
2025-07-01T10:09:57.515-0400 [DEBUG] provider.terraform-provider-hcp_v0.107.0_x5: 2025/07/01 10:09:57 [DEBUG] POST /waypoint/2024-11-22/organizations/44912dde-5d21-41da-a5af-b1417992e9b4/projects/61eeb9a4-c095-4c82-aa10-070087880f72/tfcconfig HTTP/1.1
2025-07-01T10:09:57.515-0400 [DEBUG] provider.terraform-provider-hcp_v0.107.0_x5: Host: api.cloud.hashicorp.com:443
2025-07-01T10:09:57.515-0400 [DEBUG] provider.terraform-provider-hcp_v0.107.0_x5: User-Agent: Go-http-client/1.1
2025-07-01T10:09:57.515-0400 [DEBUG] provider.terraform-provider-hcp_v0.107.0_x5: Content-Length: 148
2025-07-01T10:09:57.515-0400 [DEBUG] provider.terraform-provider-hcp_v0.107.0_x5: Accept: application/json
2025-07-01T10:09:57.515-0400 [DEBUG] provider.terraform-provider-hcp_v0.107.0_x5: Content-Type: application/json
2025-07-01T10:09:57.515-0400 [DEBUG] provider.terraform-provider-hcp_v0.107.0_x5: Accept-Encoding: gzip
2025-07-01T10:09:57.515-0400 [DEBUG] provider.terraform-provider-hcp_v0.107.0_x5
2025-07-01T10:09:57.515-0400 [DEBUG] provider.terraform-provider-hcp_v0.107.0_x5: {"tfc_config":{"organization_name":"<MY ORG NAME REDACTED>","token":"<MY TOKEN REDACTED>"}}
2025-07-01T10:09:57.515-0400 [DEBUG] provider.terraform-provider-hcp_v0.107.0_x5
2025-07-01T10:09:57.600-0400 [DEBUG] provider.terraform-provider-hcp_v0.107.0_x5: 2025/07/01 10:09:57 [DEBUG] HTTP/2.0 409 Conflict
2025-07-01T10:09:57.600-0400 [DEBUG] provider.terraform-provider-hcp_v0.107.0_x5: Access-Control-Allow-Credentials: true
2025-07-01T10:09:57.600-0400 [DEBUG] provider.terraform-provider-hcp_v0.107.0_x5: Cache-Control: no-store, max-age=0
2025-07-01T10:09:57.600-0400 [DEBUG] provider.terraform-provider-hcp_v0.107.0_x5: Content-Type: application/json
2025-07-01T10:09:57.600-0400 [DEBUG] provider.terraform-provider-hcp_v0.107.0_x5: Date: Tue, 01 Jul 2025 14:09:57 GMT
2025-07-01T10:09:57.600-0400 [DEBUG] provider.terraform-provider-hcp_v0.107.0_x5: Server: envoy
2025-07-01T10:09:57.600-0400 [DEBUG] provider.terraform-provider-hcp_v0.107.0_x5: Strict-Transport-Security: max-age=31536000; includeSubDomains
2025-07-01T10:09:57.600-0400 [DEBUG] provider.terraform-provider-hcp_v0.107.0_x5: Vary: Accept-Encoding
2025-07-01T10:09:57.600-0400 [DEBUG] provider.terraform-provider-hcp_v0.107.0_x5: X-Envoy-Upstream-Service-Time: 30
2025-07-01T10:09:57.600-0400 [DEBUG] provider.terraform-provider-hcp_v0.107.0_x5
2025-07-01T10:09:57.600-0400 [DEBUG] provider.terraform-provider-hcp_v0.107.0_x5: {"code":6,"message":"Error: conflicting data item detected","details":[]}
2025-07-01T10:09:57.601-0400 [ERROR] provider.terraform-provider-hcp_v0.107.0_x5: Response contains error diagnostic: @caller=github.com/hashicorp/[email protected]/tfprotov6/internal/diag/diagnostics.go:58 diagnostic_detail="[POST /waypoint/2024-11-22/organizations/{namespace.location.organization_id}/projects/{namespace.location.project_id}/tfcconfig][409] WaypointService_CreateTFCConfig default {\"code\":6,\"details\":[],\"message\":\"Error: conflicting data item detected\"}" diagnostic_summary="Error creating TFC Config" tf_proto_version=6.9 tf_provider_addr=registry.terraform.io/hashicorp/hcp tf_resource_type=hcp_waypoint_tfc_config @module=sdk.proto diagnostic_severity=ERROR tf_req_id=4538d041-8b73-3c55-aadc-8e797353fb3f tf_rpc=ApplyResourceChange timestamp=2025-07-01T10:09:57.600-0400
2025-07-01T10:09:57.609-0400 [DEBUG] State storage *statemgr.Filesystem declined to persist a state snapshot
2025-07-01T10:09:57.609-0400 [ERROR] vertex "hcp_waypoint_tfc_config.test" error: Error creating TFC Config
╷
│ Error: Error creating TFC Config
│ 
│   with hcp_waypoint_tfc_config.test,
│   on main.tf line 82, in resource "hcp_waypoint_tfc_config" "test":
│   82: resource "hcp_waypoint_tfc_config" "test" {
│ 
│ [POST /waypoint/2024-11-22/organizations/{namespace.location.organization_id}/projects/{namespace.location.project_id}/tfcconfig][409] WaypointService_CreateTFCConfig
│ default {"code":6,"details":[],"message":"Error: conflicting data item detected"}
╵

Panic Output

Steps to Reproduce

  1. terraform apply

Expected Behavior

The apply should overwrite the resource, or I should be able to import the resource and overwrite the token.

Actual Behavior

Error: conflicting data item detected

Important Factoids

The project id I am trying to use, had an expired token. I am trying to move the management of token into code. if I manually enter the token, to bring it into a working waypoint config, the same error occurs.

If a new project is created, this resource works:

resource "hcp_project" "example" {
  name        = "example-project"
  description = "My new project!"
}

resource "hcp_waypoint_tfc_config" "test" {
  token        = tfe_team_token.test.token
  tfc_org_name = local.org_name
  project_id   = hcp_project.example.resource_id
}

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions