vmware / terraform-provider-vra

Terraform Provider for VMware Aria Automation
https://registry.terraform.io/providers/vmware/vra/
Mozilla Public License 2.0
103 stars 93 forks source link

error "Update action not supported" running apply after import, but imports fine #296

Closed azrdev closed 3 years ago

azrdev commented 3 years ago

Describe the bug

I get an error&abort from terraform apply, but it does what it should

To Reproduce

Steps to reproduce the behavior:

  1. create resources for vra catalog deployment

    test.tf ~~~tf ~~~tf terraform { required_providers { vra = { source = "vmware/vra" } } } provider "vra" { url = var.url insecure = var.insecure refresh_token = var.refresh_token } data "vra_catalog_item" "this" { name = var.catalog_item_name expand_versions = true } resource "vra_deployment" "this" { name = var.deployment_name description = "terraform test deployment" catalog_item_id = data.vra_catalog_item.this.id project_id = var.project_id inputs = { Datacenter = var.vra_datacenter } timeouts { create = "30m" delete = "30m" update = "30m" } } output "vra_deployment_properties" { value = [ for res in vra_deployment.this.resources: jsondecode(res.properties_json) ] } ~~~
  2. apply (== create)
  3. remove the *.tfstate
  4. terraform import to recreate the state from vRA
  5. terraform plan shows the inputs = {} and timeout ={} parameters are missing in the state
  6. run terraform apply to update these, but get

    Error: noticed changes to inputs, but 'Update' action is not supported based on the current state of the deployment Terraform test 2021-01 (updated)
    
    on test.tf line 25, in resource "vra_deployment" "this":
    25: resource "vra_deployment" "this" {

Expected behavior

terraform apply does the update of these parameters, and aborts/errors only when it actually fails

Logs

stdout with TF_LOG=DEBUG ~~~python traceback Do you want to perform these actions? Terraform will perform the actions described above. Only 'yes' will be accepted to approve. Enter a value: yes 2021/01/19 14:44:01 [INFO] backend/local: apply calling Apply 2021/01/19 14:44:01 [INFO] terraform: building graph: GraphTypeApply 2021/01/19 14:44:01 [DEBUG] ProviderTransformer: "vra_deployment.this" (*terraform.NodeApplyableResourceInstance) needs provider["registry.terraform.io/vmware/vra"] 2021/01/19 14:44:01 [DEBUG] ProviderTransformer: "vra_deployment.this (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/vmware/vra"] 2021/01/19 14:44:01 [DEBUG] ProviderTransformer: "data.vra_catalog_item.this (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/vmware/vra"] 2021/01/19 14:44:01 [DEBUG] ReferenceTransformer: "vra_deployment.this" references: [var.vra_datacenter data.vra_catalog_item.this (expand) var.deployment_name var.project_id] 2021/01/19 14:44:01 [DEBUG] ReferenceTransformer: "vra_deployment.this (expand)" references: [] 2021/01/19 14:44:01 [DEBUG] ReferenceTransformer: "data.vra_catalog_item.this (expand)" references: [] 2021/01/19 14:44:01 [DEBUG] ReferenceTransformer: "var.url" references: [] 2021/01/19 14:44:01 [DEBUG] ReferenceTransformer: "var.vra_datacenter" references: [] 2021/01/19 14:44:01 [DEBUG] ReferenceTransformer: "var.project_id" references: [] 2021/01/19 14:44:01 [DEBUG] ReferenceTransformer: "var.catalog_item_name" references: [] 2021/01/19 14:44:01 [DEBUG] ReferenceTransformer: "var.deployment_name" references: [] 2021/01/19 14:44:01 [DEBUG] ReferenceTransformer: "var.insecure" references: [] 2021/01/19 14:44:01 [DEBUG] ReferenceTransformer: "var.refresh_token" references: [] 2021/01/19 14:44:01 [DEBUG] ReferenceTransformer: "output.vra_deployment_properties" references: [vra_deployment.this vra_deployment.this vra_deployment.this (expand)] 2021/01/19 14:44:01 [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/vmware/vra\"]" references: [var.refresh_token var.url var.insecure] 2021/01/19 14:44:01 [DEBUG] Starting graph walk: walkApply 2021-01-19T14:44:01.618+0100 [INFO] plugin: configuring client automatic mTLS 2021-01-19T14:44:01.684+0100 [DEBUG] plugin: starting plugin: path=.terraform/providers/registry.terraform.io/vmware/vra/0.3.3/linux_amd64/terraform-provider-vra_v0.3.3 args=[.terraform/providers/registry.terraform.io/vmware/vra/0.3.3/l inux_amd64/terraform-provider-vra_v0.3.3] 2021-01-19T14:44:01.685+0100 [DEBUG] plugin: plugin started: path=.terraform/providers/registry.terraform.io/vmware/vra/0.3.3/linux_amd64/terraform-provider-vra_v0.3.3 pid=9318 2021-01-19T14:44:01.685+0100 [DEBUG] plugin: waiting for RPC address: path=.terraform/providers/registry.terraform.io/vmware/vra/0.3.3/linux_amd64/terraform-provider-vra_v0.3.3 2021-01-19T14:44:01.712+0100 [INFO] plugin.terraform-provider-vra_v0.3.3: configuring server automatic mTLS: timestamp=2021-01-19T14:44:01.712+0100 2021-01-19T14:44:01.738+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: plugin address: address=/tmp/plugin795241643 network=unix timestamp=2021-01-19T14:44:01.738+0100 2021-01-19T14:44:01.739+0100 [DEBUG] plugin: using plugin: version=5 vra_deployment.this: Modifying... [id=d7998237-47e1-4cb2-abd7-d4e1bbf2134d] 2021/01/19 14:44:02 [DEBUG] EvalApply: ProviderMeta config value set 2021/01/19 14:44:02 [DEBUG] vra_deployment.this: applying the planned Update change 2021-01-19T14:44:02.463+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: 2021/01/19 14:44:02 Starting to update the vra_deployment resource with name Terraform test 2021-01 (updated) 2021-01-19T14:44:02.464+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: 2021/01/19 14:44:02 Noticed changes to inputs. Starting to update deployment with inputs 2021-01-19T14:44:02.464+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: 2021/01/19 14:44:02 GET /deployment/api/deployments/d7998237-47e1-4cb2-abd7-d4e1bbf2134d/actions HTTP/1.1 2021-01-19T14:44:02.464+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: 2021/01/19 14:44:02 Host: vra.example.com 2021-01-19T14:44:02.464+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: 2021/01/19 14:44:02 User-Agent: Go-http-client/1.1 2021-01-19T14:44:02.464+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: 2021/01/19 14:44:02 Accept: application/json 2021-01-19T14:44:02.464+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: 2021/01/19 14:44:02 Authorization: Bearer token 2021-01-19T14:44:02.464+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: 2021/01/19 14:44:02 Accept-Encoding: gzip 2021-01-19T14:44:02.464+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: 2021/01/19 14:44:02 2021-01-19T14:44:02.464+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: 2021/01/19 14:44:02 2021-01-19T14:44:02.464+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: 2021/01/19 14:44:02 2021-01-19T14:44:02.464+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: 2021/01/19 14:44:02 [DEBUG] VRA API Request Details: 2021-01-19T14:44:02.464+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: ---[ REQUEST ]--------------------------------------- 2021-01-19T14:44:02.464+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: GET /deployment/api/deployments/d7998237-47e1-4cb2-abd7-d4e1bbf2134d/actions HTTP/1.1 2021-01-19T14:44:02.464+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: Host: vra.example.com 2021-01-19T14:44:02.464+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: User-Agent: Go-http-client/1.1 2021-01-19T14:44:02.464+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: Accept: application/json 2021-01-19T14:44:02.464+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: Authorization: Bearer token 2021-01-19T14:44:02.464+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: Accept-Encoding: gzip 2021-01-19T14:44:02.464+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: 2021-01-19T14:44:02.464+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: 2021-01-19T14:44:02.464+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: ----------------------------------------------------- 2021-01-19T14:44:02.757+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: 2021/01/19 14:44:02 [DEBUG] VRA API Response Details: 2021-01-19T14:44:02.757+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: ---[ RESPONSE ]-------------------------------------- 2021-01-19T14:44:02.757+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: HTTP/1.1 200 OK 2021-01-19T14:44:02.757+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: Content-Length: 633 2021-01-19T14:44:02.757+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: Cache-Control: no-cache, no-store, max-age=0, must-revalidate 2021-01-19T14:44:02.757+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: Content-Type: application/json 2021-01-19T14:44:02.757+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: Date: Tue, 19 Jan 2021 13:44:02 GMT 2021-01-19T14:44:02.757+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: Etag: "0e6268832cacfc96c230a3517cb5d9d74" 2021-01-19T14:44:02.757+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: Expires: 0 2021-01-19T14:44:02.757+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: Pragma: no-cache 2021-01-19T14:44:02.757+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: Strict-Transport-Security: max-age=31536000 ; includeSubDomains 2021-01-19T14:44:02.757+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: X-Content-Type-Options: nosniff 2021-01-19T14:44:02.757+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: X-Frame-Options: DENY 2021-01-19T14:44:02.757+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: X-Xss-Protection: 1; mode=block 2021-01-19T14:44:02.757+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: 2021-01-19T14:44:02.757+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: [ 2021-01-19T14:44:02.757+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: { 2021-01-19T14:44:02.757+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: "id": "Deployment.ChangeLease", 2021-01-19T14:44:02.757+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: "name": "ChangeLease", 2021-01-19T14:44:02.757+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: "displayName": "Change Lease", 2021-01-19T14:44:02.757+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: "description": "Set a deployment's expiration date", 2021-01-19T14:44:02.757+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: "valid": true, 2021-01-19T14:44:02.757+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: "actionType": "RESOURCE_ACTION" 2021-01-19T14:44:02.757+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: }, 2021-01-19T14:44:02.757+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: { 2021-01-19T14:44:02.757+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: "id": "Deployment.Delete", 2021-01-19T14:44:02.757+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: "name": "Delete", 2021-01-19T14:44:02.757+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: "displayName": "Delete", 2021-01-19T14:44:02.757+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: "description": "Delete a deployment", 2021-01-19T14:44:02.757+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: "valid": true, 2021-01-19T14:44:02.757+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: "actionType": "RESOURCE_ACTION" 2021-01-19T14:44:02.758+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: }, 2021-01-19T14:44:02.758+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: { 2021-01-19T14:44:02.758+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: "id": "Deployment.PowerOff", 2021-01-19T14:44:02.758+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: "name": "PowerOff", 2021-01-19T14:44:02.758+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: "displayName": "Power Off", 2021-01-19T14:44:02.758+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: "description": "Power off a deployment", 2021-01-19T14:44:02.758+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: "valid": true, 2021-01-19T14:44:02.758+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: "actionType": "RESOURCE_ACTION" 2021-01-19T14:44:02.758+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: }, 2021-01-19T14:44:02.758+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: { 2021-01-19T14:44:02.758+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: "id": "Deployment.PowerOn", 2021-01-19T14:44:02.758+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: "name": "PowerOn", 2021-01-19T14:44:02.758+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: "displayName": "Power On", 2021-01-19T14:44:02.758+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: "description": "Power on a deployment", 2021-01-19T14:44:02.758+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: "valid": false, 2021-01-19T14:44:02.758+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: "actionType": "RESOURCE_ACTION" 2021-01-19T14:44:02.758+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: } 2021-01-19T14:44:02.758+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: ] 2021-01-19T14:44:02.758+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: ----------------------------------------------------- 2021-01-19T14:44:02.758+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: 2021/01/19 14:44:02 HTTP/1.1 200 OK 2021-01-19T14:44:02.758+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: 2021/01/19 14:44:02 Content-Length: 633 2021-01-19T14:44:02.758+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: 2021/01/19 14:44:02 Cache-Control: no-cache, no-store, max-age=0, must-revalidate 2021-01-19T14:44:02.758+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: 2021/01/19 14:44:02 Content-Type: application/json 2021-01-19T14:44:02.758+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: 2021/01/19 14:44:02 Date: Tue, 19 Jan 2021 13:44:02 GMT 2021-01-19T14:44:02.758+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: 2021/01/19 14:44:02 Etag: "0e6268832cacfc96c230a3517cb5d9d74" 2021-01-19T14:44:02.758+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: 2021/01/19 14:44:02 Expires: 0 2021-01-19T14:44:02.758+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: 2021/01/19 14:44:02 Pragma: no-cache 2021-01-19T14:44:02.758+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: 2021/01/19 14:44:02 Strict-Transport-Security: max-age=31536000 ; includeSubDomains 2021-01-19T14:44:02.758+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: 2021/01/19 14:44:02 X-Content-Type-Options: nosniff 2021-01-19T14:44:02.758+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: 2021/01/19 14:44:02 X-Frame-Options: DENY 2021-01-19T14:44:02.758+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: 2021/01/19 14:44:02 X-Xss-Protection: 1; mode=block 2021-01-19T14:44:02.758+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: 2021/01/19 14:44:02 2021-01-19T14:44:02.758+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: 2021/01/19 14:44:02 [{"id":"Deployment.ChangeLease","name":"ChangeLease","displayName":"Change Lease","description":"Set a deployment's expiration date","valid": true,"actionType":"RESOURCE_ACTION"},{"id":"Deployment.Delete","name":"Delete","displayName":"Delete","description":"Delete a deployment","valid":true,"actionType":"RESOURCE_ACTION"},{"id":"Deployment.PowerOff","name":"PowerOff","displa yName":"Power Off","description":"Power off a deployment","valid":true,"actionType":"RESOURCE_ACTION"},{"id":"Deployment.PowerOn","name":"PowerOn","displayName":"Power On","description":"Power on a deployment","valid":false,"actionType" :"RESOURCE_ACTION"}] 2021-01-19T14:44:02.758+0100 [DEBUG] plugin.terraform-provider-vra_v0.3.3: 2021/01/19 14:44:02 2021/01/19 14:44:02 [DEBUG] vra_deployment.this: apply errored, but we're indicating that via the Error pointer rather than returning it: noticed changes to inputs, but 'Update' action is not supported based on the current state of the deployment Terraform test 2021-01 (updated) Error: noticed changes to inputs, but 'Update' action is not supported based on the current state of the deployment Terraform test 2021-01 (updated) Error: noticed changes to inputs, but 'Update' action is not supported based on the current state of the deployment Terraform test 2021-01 (updated) on test.tf line 25, in resource "vra_deployment" "this": 25: resource "vra_deployment" "this" { 2021-01-19T14:44:02.796+0100 [WARN] plugin.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing" 2021-01-19T14:44:02.798+0100 [DEBUG] plugin: plugin process exited: path=.terraform/providers/registry.terraform.io/vmware/vra/0.3.3/linux_amd64/terraform-provider-vra_v0.3.3 pid=9318 2021-01-19T14:44:02.798+0100 [DEBUG] plugin: plugin exited ~~~

Desktop (please complete the following information):

Additional context

Add any other context about the problem here.

Prativa20 commented 3 years ago

Hi @azrdev I could not reproduce this issue. inputs and timeout will be empty on importing a deployment and that is the correct behavior. I am able to update the deployment with inputs after importing.

Adding logs: 2021-03-22T16:03:50.772-0700 [DEBUG] plugin.terraform-provider-vra_v0.3.4: 2021/03/22 16:03:50 2021-03-22T16:03:50.772-0700 [DEBUG] plugin.terraform-provider-vra_v0.3.4: 2021/03/22 16:03:50 input_key: name, type: "string", value: "tf_machine" 2021-03-22T16:03:50.772-0700 [DEBUG] plugin.terraform-provider-vra_v0.3.4: 2021/03/22 16:03:50 Converted incoming value to string: Key: name, Value: tf_machine, Converted value: "tf_machine" 2021-03-22T16:03:50.772-0700 [DEBUG] plugin.terraform-provider-vra_v0.3.4: 2021/03/22 16:03:50 Finished reading the vra_deployment resource with name 'tf_deployment'. Current status: 'UPDATE_SUCCESSFUL'

Can you try updating the input with a new value after step 2? Its behavior should be same as what you are expecting in step 6 as both are updating inputs of an existing deployment.

Thanks, Prativa

github-actions[bot] commented 3 years ago

Marking this issue as stale due to inactivity. This helps us focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!