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

"admin_pass" attribute of "huaweicloud_compute_instance" resource block does not take effect when setting "hostname" attribute #6232

Open
gutierrezps opened this issue Jan 20, 2025 · 3 comments

Comments

@gutierrezps
Copy link

Terraform Version

Terraform v1.10.0
on windows_amd64
+ provider registry.terraform.io/huaweicloud/huaweicloud v1.72.1

Terraform Configuration Files

terraform {
  required_providers {
    huaweicloud = {
      source  = "huaweicloud/huaweicloud"
      version = "1.72.1"
    }
  }
}

provider "huaweicloud" {
  region = "sa-brazil-1"
  access_key = var.hwc_access_key
  secret_key = var.hwc_secret_key
}

resource "huaweicloud_vpc" "test" {
  name = "vpc-test"
  cidr = "10.0.0.0/16"
}

resource "huaweicloud_vpc_subnet" "test" {
  name              = "subnet-test"
  cidr              = "10.0.0.0/24"
  gateway_ip        = "10.0.0.1"
  vpc_id            = huaweicloud_vpc.test.id
}

resource "huaweicloud_networking_secgroup" "test" {
  name                 = "sg-test"
  delete_default_rules = true
}

data "huaweicloud_images_image" "ubuntu" {
  name        = "Ubuntu 22.04 server 64bit"
  visibility  = "public"
  most_recent = true
}

resource "huaweicloud_compute_instance" "test" {
  name               = "ecs-test"
  image_id           = data.huaweicloud_images_image.ubuntu.id
  flavor_id          = "t6.small.1"
  security_group_ids = [huaweicloud_networking_secgroup.test.id]
  availability_zone  = "sa-brazil-1a"
  admin_pass         = "Huawei@1234"
  hostname           = "test-vm"

  network {
    uuid        = huaweicloud_vpc_subnet.test.id
  }
}

Debug Output

https://gist.github.com/gutierrezps/ce4125849a00665e1e4415e94240b4c9

Expected Behavior

Password set in argument admin_pass should be assigned to the instance. According to provider documentation, admin_pass only becomes invalid if user_data is set, which is not the case.

Actual Behavior

Password set in argument admin_pass is not assigned to the instance when hostname argument is specified. If I do not set a value for hostname, the password is assigned successfully.

Steps to Reproduce

  1. terraform init
  2. terraform apply
@Jason-Zhang9309
Copy link
Collaborator

@gutierrezps problem confirmed, we will fix it ASAP

@Jason-Zhang9309
Copy link
Collaborator

@gutierrezps according to the API doc, the hostname is deprecated, please check this link, https://support.huaweicloud.com/intl/en-us/api-ecs/ecs_02_0106.html
we will remove this argument from the Terraform doc in next version

@gutierrezps
Copy link
Author

No problem, please remove it. Thank you.

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

No branches or pull requests

2 participants