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

Failure to create avi_useraccount resource #314

Open
yandrushko opened this issue Jan 5, 2022 · 3 comments
Open

Failure to create avi_useraccount resource #314

yandrushko opened this issue Jan 5, 2022 · 3 comments
Labels

Comments

@yandrushko
Copy link

Describe the bug

Terraform produces following error in create user function
│ Error: Provider produced inconsistent result after apply

│ When applying changes to avi_useraccount.avi_user, provider "provider["registry.terraform.io/vmware/avi"]" produced an unexpected new value: Root resource
│ was present, but now absent.

│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

Reproduction steps

1. Deploy 3 VMs from template
2. Use following snippet
terraform {
  required_providers {
    vsphere = {
      source  = "hashicorp/vsphere"
      version = "~> 2.0.0"
     }
    avi = {
      source  = "vmware/avi"
      version = "~> 21.1.1"
    }
  }
}

provider "avi" {
  avi_username   = var.avi_username
  avi_password   = var.avi_password      #even tried with var.avi_new_password
  avi_controller = vsphere_virtual_machine.controller[0].default_ip_address
  avi_tenant     = "admin"
}

resource "avi_useraccount" "avi_user" {
  username     = var.avi_username
  old_password = var.avi_password
  password     = var.avi_new_password
}

3. Username tried was both "admin" and non-admin.

Expected behavior

User account would be created

Additional context

No response

@yandrushko yandrushko added the bug label Jan 5, 2022
@yograjshisode
Copy link
Collaborator

@yandrushko Please refer to example https://github.com/vmware/terraform-provider-avi/tree/eng/examples/useraccount

@adamfowleruk
Copy link

Re-open. This is a bug in the provider. Provider does not follow the Hashicorp terraform guidelines for resource read for useraccount, resulting in the useraccount always being created. This in turn means you have to place the resource useraccount section at the end of your Avi set up terraform otherwise subsequent Avi resource blocks will fail (as the password in the provider is now changed). Further, there is no documentation specifying that the old_password (which needs to be the value passed to prodiver "avi" avi_password) is not blank, but a fixed 'strong' password available only to current customers. This means all current examples are incorrect and do not provide enough information to successfully spin up an Avi VM on vsphere, followed by setting up initial config as per the vmware docs site, and then changing the default admin user password.

@CodeNoob01
Copy link

Re-open this issue it is still the same error:
rror: Provider produced inconsistent result after apply

│ When applying changes to avi_useraccount.avi_user, provider "provider["registry.terraform.io/vmware/avi"]"
│ produced an unexpected new value: Root resource was present, but now absent.

│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

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

No branches or pull requests

5 participants