Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

mware / terraform-provider-vra7 Provider is considering the computed values as changes in the resource even though there is no update which has taken place #116

Open
divya-goyal opened this issue Apr 14, 2021 · 6 comments

Comments

@divya-goyal
Copy link

vRA 7.x version
The vRA 7.6 version
Terraform version
The terraform version : 0.14
terraform-provider-vra7 plugin version
The terraform-provider-vra7 plugin version (e.g. commit id, etc.)
terraform-provide-vra7 : 3.0

Describe the bug
I am using vmware / terraform-provider-vra7 version 3.0.2, facing an issue with the way terraform evaluate the difference for the newly created resource.

For example, we provide the module with the expected input to create a VM in Vshere, and successfully get the VM created as well in return we receive the extended set of variables which gets computed as output which is more then the ones which has been submitted with the request to create the VM.

Now, if the vm is not updated, and we try to submit the request again without any changes to the resource in that case we gets too many differences which impacts the day 2 operation as we didnt have those values as input.

Also, if we update the cpu count, in that case if we run terraform plan. Console displays multiple changes even though only cpu count was updated.

To Reproduce
Steps to reproduce the behaviour:
Terraform config files cant be uploaded due to security. but from reference perspective all the standard config has been used. for provider username, password and tenant value has been passed to the provider to create the resource in the vsphere.

After, resource gets successfully provisioned, terraform returns with the output with all the computed values and the output gets stored in the tf.state file.

Now, if we run terraform apply, the provided shows up multiple difference in console for the resource configuration even though there is no update to the resource. Only difference is the provided input and computed values after the resource provisioning is different.

  1. Terraform config file
    source "vra7_deployment" "vm" {
    count = var.destroy == true ? 0 : 1
    catalog_item_name = "xxxxxxxx"
    businessgroup_name = "xxxxxxxxxx"
    wait_timeout = 60
    description = format("%s Terraform build")
    lease_days = var.buildEnvironment == "xxxxxx" ? leaseDays : 1
    lifecycle {
    # Ignore any lease_days (as it changes immediately!)
    ignore_changes = [lease_days]
    }
    resource_configuration {
    component_name = "vSphere__vCenter__Machine_1"
    cluster = 1 # One machine
    configuration = merge(var.minimalConfig == "true" ? local.minimal_config : {},
    local.standard_config,
    {
    cpu = var.cpu,
    memory = var.memoryGB * 1024

         }
     )
    

    }
    }

  2. Terraform command
    terraform init
    terraform apply

  3. Wait for VM provisioning, then run below command without any module input update
    terraform init
    terraform apply

  4. Console output comes back with the lot of differences between the VM state. Even though there is no update from the user perspective.

Expected behaviour
As there is no update in the resource when we run the terraform plan on an already created resource there should not be any difference for running the day operation.

if the module updates only the cpu count, then only cpu count should get displayed in the changes in console when we run
terraform plan.
Console should not display these many updates as only cpu count resource config got updated.

Logs
Attach logs to help debug the issue
logs cant be added due to security, and there is no crash.

Desktop (please complete the following information):

  • OS: Windows Server 2016

Additional context
Add any other context about the problem here.
We can not add the ignore resource_configuration while creating the resource, as we need to support all the day 2 operation. and need the resource_configuration for that.
lifecycle {
# Ignore any resource config differences and lease_days (as it changes immediately!)
ignore_changes = [
resource_configuration,
lease_days]
}

@divya-goyal divya-goyal changed the title mware / terraform-provider-vra7 Provider is considerind the computed values as changes in the resource even though there is no update which has taken place mware / terraform-provider-vra7 Provider is considering the computed values as changes in the resource even though there is no update which has taken place Apr 14, 2021
@Adam2Marsh
Copy link

Adam2Marsh commented Apr 26, 2021

We're also seeing the same issue above but on provider 3.0.1

I have a commit which confirms back in Febuary we tested day amendments and it was working. Checked our our VmWare team who confirmed no changes have been made on the platform but this is now an issue.

@mmn01-sky
Copy link

I'm also seeing the same issue using provider version 3.0.1.

@Prativa20
Copy link
Contributor

Looking into this issue.

@divya-goyal For day 2 operation to change lease, please do not modify lease_days. It is only for the initial provisioning of the resource. To modify the lease, add expiry_date in the main.tf file. is The instructions are given in the documentation https://github.com/vmware/terraform-provider-vra7/blob/master/website/docs/r/deployment.html.markdown

@Prativa20
Copy link
Contributor

Prativa20 commented May 14, 2021

@divya-goyal @Adam2Marsh @mmn01-sky I could not reproduce the scenario where if I do not make any change to the main.tf file, I see a diff in the plan. It is working as expected. Can you please confirm this? Also please make sure the lease_days and expiry_date is used as documented in https://github.com/vmware/terraform-provider-vra7/blob/master/website/docs/r/deployment.html.markdown

But when I modify the cpu or any property under configuration, I see a diff in the entire resource_configuration block. I am investigating this and I have also reached out to the Hashicorp terraform team.

@Adam2Marsh
Copy link

Any updates on this @Prativa20

@jacnorri
Copy link

Hi I am also facing this issue. Any update @Prativa20 ?

thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants