Skip to content
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

tfe_workspace issue with trigger_patterns and trigger_prefixes #552

Closed
juicybaba opened this issue Jul 15, 2022 · 5 comments
Closed

tfe_workspace issue with trigger_patterns and trigger_prefixes #552

juicybaba opened this issue Jul 15, 2022 · 5 comments
Labels
bug confirmed A maintainer has reproduced the reported issue

Comments

@juicybaba
Copy link

I am using Terraform Enterprise workspace A to manage a bunch of Terraform Enterprise workspaces.

I was trying to revert a manual change in terraform enterprise workspace by rerunning Terraform Enterprise workspace A.

Everything works fine with tfe provider version 0.32.0, but I got below error with 0.33.0, and I don't even have trigger_prefixes and trigger_patterns in my code.
'trigger_prefixes' attribute is deprecated, and cannot be used in conjunction with 'trigger_patterns'. Use the latter only.'

Correct me if I am wrong, will below logic assign [] to trigger_prefixes and trigger_patterns if those attributes are not provided?
https://github.com/hashicorp/terraform-provider-tfe/blob/main/tfe/resource_tfe_workspace.go#L269
https://github.com/hashicorp/terraform-provider-tfe/blob/main/tfe/resource_tfe_workspace.go#L277

Has trigger_prefixes been deprecated already? this doesn't match the doc

Terraform Cloud/Enterprise version

Terraform Enterprise: v202205-1

Terraform version

1.1.9

Terraform Configuration Files

resource "tfe_workspace" "default" {
  organization                  = var.tfe.organization.name
  name                          = var.tfe.workspace.name
  working_directory             = var.git.repository.directory
  terraform_version             = var.tfe.workspace.version
  agent_pool_id                 = var.tfe.workspace.agent_pool_id
  execution_mode                = var.tfe.workspace.execution_mode
  auto_apply                    = var.tfe.workspace.auto_apply
  ssh_key_id                    = var.tfe.workspace.ssh_key_id
  allow_destroy_plan            = true
  file_triggers_enabled         = true
  global_remote_state           = false
  queue_all_runs                = true
  speculative_enabled           = true
  structured_run_output_enabled = var.tfe.workspace.structured_run_output_enabled
  tag_names                     = var.tfe.workspace.tag_names

  vcs_repo {
    oauth_token_id     = var.tfe_oauth
    identifier         = format("%s/%s", var.git.organization.name, var.git.repository.name)
    branch             = var.git.repository.branch
    ingress_submodules = true
  }
}

Debug Output

2022-07-15T18:22:38.695Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5:  "data": {
2022-07-15T18:22:38.695Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5:   "type": "workspaces",
2022-07-15T18:22:38.695Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5:   "attributes": {
2022-07-15T18:22:38.695Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5:    "allow-destroy-plan": true,
2022-07-15T18:22:38.695Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5:    "auto-apply": false,
2022-07-15T18:22:38.695Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5:    "description": "",
2022-07-15T18:22:38.695Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5:    "file-triggers-enabled": true,
2022-07-15T18:22:38.695Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5:    "global-remote-state": false,
2022-07-15T18:22:38.695Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5:    "name": "xxxxx",
2022-07-15T18:22:38.695Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5:    "queue-all-runs": true,
2022-07-15T18:22:38.695Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5:    "speculative-enabled": true,
2022-07-15T18:22:38.695Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5:    "structured-run-output-enabled": true,
2022-07-15T18:22:38.695Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5:    "terraform-version": "latest",
2022-07-15T18:22:38.695Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5:    "trigger-patterns": [],
2022-07-15T18:22:38.695Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5:    "trigger-prefixes": [],
2022-07-15T18:22:38.695Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5:    "vcs-repo": {
2022-07-15T18:22:38.695Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5:     "branch": "main",
2022-07-15T18:22:38.695Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5:     "identifier": "xxxxx",
2022-07-15T18:22:38.695Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5:     "ingress-submodules": true,
2022-07-15T18:22:38.695Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5:     "oauth-token-id": "ot-4nXuEo3iN6YjGzfk"
2022-07-15T18:22:38.695Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5:    },
2022-07-15T18:22:38.695Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5:    "working-directory": "xxxx"
2022-07-15T18:22:38.695Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5:   }
2022-07-15T18:22:38.695Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5:  }
2022-07-15T18:22:38.695Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5: }
2022-07-15T18:22:38.695Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5: -----------------------------------------------------
2022-07-15T18:22:38.799Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5: [DEBUG] TFE API Response Details:
2022-07-15T18:22:38.799Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5: ---[ RESPONSE ]--------------------------------------
2022-07-15T18:22:38.799Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5: HTTP/1.1 422 Unprocessable Entity
2022-07-15T18:22:38.799Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5: Transfer-Encoding: chunked
2022-07-15T18:22:38.799Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5: Cache-Control: no-cache
2022-07-15T18:22:38.799Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5: Connection: keep-alive
2022-07-15T18:22:38.799Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5: Content-Type: application/vnd.api+json; charset=utf-8
2022-07-15T18:22:38.799Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5: Date: Fri, 15 Jul 2022 18:22:38 GMT
2022-07-15T18:22:38.799Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5: Referrer-Policy: strict-origin-when-cross-origin
2022-07-15T18:22:38.799Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5: Server: nginx
2022-07-15T18:22:38.799Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5: Tfp-Api-Version: 2.5
2022-07-15T18:22:38.799Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5: Vary: Accept, Origin
2022-07-15T18:22:38.799Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5: X-Content-Type-Options: nosniff
2022-07-15T18:22:38.799Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5: X-Download-Options: noopen
2022-07-15T18:22:38.799Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5: X-Frame-Options: SAMEORIGIN
2022-07-15T18:22:38.799Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5: X-Permitted-Cross-Domain-Policies: none
2022-07-15T18:22:38.799Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5: X-Ratelimit-Limit: 120
2022-07-15T18:22:38.799Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5: X-Ratelimit-Remaining: 116
2022-07-15T18:22:38.799Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5: X-Ratelimit-Reset: 0.226
2022-07-15T18:22:38.799Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5: X-Request-Id: 9147d70f-0630-465a-9d8b-fa46c4c3983f
2022-07-15T18:22:38.799Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5: X-Xss-Protection: 1; mode=block
2022-07-15T18:22:38.799Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5:
2022-07-15T18:22:38.799Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5: c4
2022-07-15T18:22:38.799Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5: {
2022-07-15T18:22:38.799Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5:  "errors": [
2022-07-15T18:22:38.799Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5:   {
2022-07-15T18:22:38.799Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5:    "status": "422",
2022-07-15T18:22:38.799Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5:    "title": "unprocessable entity",
2022-07-15T18:22:38.799Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5:    "detail": "'trigger_prefixes' attribute is deprecated, and cannot be used in conjunction with 'trigger_patterns'. Use the latter only.'"
2022-07-15T18:22:38.799Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5:   }
2022-07-15T18:22:38.799Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5:  ]
2022-07-15T18:22:38.799Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5: }
2022-07-15T18:22:38.799Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5: 0
2022-07-15T18:22:38.799Z [DEBUG] provider.terraform-provider-tfe_v0.33.0_x5: -----------------------------------------------------
2022-07-15T18:22:38.804Z [ERROR] vertex "module.tfe[\"core-lab\"].tfe_workspace.default" error: Error updating workspace ws-osMxkrvLhML2sFi3: unprocessable entity

'trigger_prefixes' attribute is deprecated, and cannot be used in conjunction with 'trigger_patterns'. Use the latter only.'
...

Expected Behavior

No error

Actual Behavior

Error : 'trigger_prefixes' attribute is deprecated, and cannot be used in conjunction with 'trigger_patterns'. Use the latter only.'

Additional Context

@juicybaba juicybaba added the bug label Jul 15, 2022
@juicybaba
Copy link
Author

Please see the difference between 0.32.0 and 0.33.0 workspace plan

0.32.0
image

0.33.0
image

@sebasslash
Copy link
Contributor

sebasslash commented Jul 19, 2022

Howdy!

Thanks for reporting this issue. We've created an internal issue to investigate a solution for this bug. It seems the TFE version you're using doesn't allow trigger_prefixes and trigger_patterns to both be set to []. As far as I'm aware, the provider currently has no way of determining a specific TFE version to provide a fallback accordingly.

We'll look into this, in the meantime the current workaround would be to downgrade back to v0.32, or if possible, upgrade the version of your TFE installation.

@sebasslash sebasslash added the confirmed A maintainer has reproduced the reported issue label Jul 19, 2022
@juicybaba
Copy link
Author

Howdy!

Thanks for reporting this issue. We've created an internal issue to investigate a solution for this bug. It seems the TFE version you're using doesn't allow trigger_prefixes and trigger_patterns to both be set to []. As far as I'm aware, the provider currently has no way of determining a specific TFE version to provide a fallback accordingly.

We'll look into this, in the meantime the current workaround would be to downgrade back to v0.32, or if possible, upgrade the version of your TFE installation.

Hi @sebasslash, thanks for the reply, and yes, pining v0.32 is our workaround. What TFE version should I use? I don't see anything related to trigger_prefixes and trigger_patterns in June and July TFE releases.

@sebasslash
Copy link
Contributor

👋 Just following up! We've identified a fix for the issue and it will be included in v0.34.

@uturunku1
Copy link
Collaborator

We got an internal request from Paul Anunda for this issue to get closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug confirmed A maintainer has reproduced the reported issue
Projects
None yet
Development

No branches or pull requests

3 participants