terraform-redhat / terraform-rhcs-rosa-hcp

Repository for rosa hcp modules
3 stars 15 forks source link

OCM-5758 | rosa hcp modules #1

Closed gdbranco closed 7 months ago

gdbranco commented 9 months ago

Related issue: OCM-5758

tphee commented 9 months ago

Could you provide an example to create htpasswd idp something like this https://github.com/terraform-redhat/terraform-rhcs-rosa/blob/main/examples/rosa-classic-public-with-idp-machine-pools/main.tf ?

tphee commented 9 months ago

I couldn't get the upgrade to work. I started HCP with version 14.4.8 and wanted to upgrade to 14.4.* latest version by adding this line to .tf file: upgrade_acknowledgements_for = "4.14" Did the terraform apply successfully, but HCP version still remains at version 14.4.8

gdbranco commented 9 months ago

I couldn't get the upgrade to work. I started HCP with version 14.4.8 and wanted to upgrade to 14.4.* latest version by adding this line to .tf file: upgrade_acknowledgements_for = "4.14" Did the terraform apply successfully, but HCP version still remains at version 14.4.8

The acknowledgements allow to supply your intent to be ok to upgrade if the version has gates, but the actual upgrade is controlled by specifying a newer version to the "version" attribute

tphee commented 9 months ago

I got the Control plan upgraded from 4.14.8 to 4.14.9. Now, I want to upgrade the Compute nodes. I have this .tf file:

resource "rhcs_hcp_machine_pool" "pools" {
  cluster = "29l7dcmufhk2oates01chdidfnt52tos"
  name = "workers-0"
  autoscaling = {
    enabled = false
  }
  upgrade_acknowledgements_for = "4.14"
  version = "4.14.9"
  subnet_id = "subnet-01c6b70e154657ea0"
}

Getting error when doing the terraform apply:

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # rhcs_hcp_machine_pool.pools will be created
  + resource "rhcs_hcp_machine_pool" "pools" {
      + auto_repair                  = (known after apply)
      + autoscaling                  = {
          + enabled = false
        }
      + availability_zone            = (known after apply)
      + cluster                      = "29l7dcmufhk2oates01chdidfnt52tos"
      + current_version              = (known after apply)
      + id                           = (known after apply)
      + name                         = "workers-0"
      + status                       = (known after apply)
      + subnet_id                    = "subnet-01c6b70e154657ea0"
      + upgrade_acknowledgements_for = "4.14"
resource "rhcs_hcp_machine_pool" "pools" {
resource "rhcs_hcp_machine_pool" "pools" {
      + version                      = "4.14.9"
    }

Plan: 1 to add, 0 to change, 0 to destroy.

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

rhcs_hcp_machine_pool.pools: Creating...
╷
│ Error: Can't upgrade machine pool
│
│   with rhcs_hcp_machine_pool.pools,
│   on main.tf line 1, in resource "rhcs_hcp_machine_pool" "pools":
│    1: resource "rhcs_hcp_machine_pool" "pools" {
│
│ Can't upgrade machine pool version with identifier: `workers-0`, failed to check for missing upgrade agreements: failed to check for missing gate agreements upgrade for
│ cluster '29l7dcmufhk2oates01chdidfnt52tos': Only 'NodePool' upgrade type is supported
╵

How to upgrade HCP Compute nodes?

tphee commented 9 months ago

Trying to test the machine_pool_datasource.go. Why is autoscaling a required value? https://github.com/terraform-redhat/terraform-provider-rhcs/blob/main/provider/machinepool/hcp/machine_pool_datasource.go#L87

I am getting an error trying to test the machine_pool_datasource:

data "rhcs_hcp_machine_pool" "pools" {
  cluster = "29l7dcmufhk2oates01chdidfnt52tos"
  name = "workers-0"
  autoscaling = {
    enabled = false
  }
}
# terraform apply
data.rhcs_hcp_machine_pool.pools: Reading...
╷
│ Error: Value Conversion Error
│
│   with data.rhcs_hcp_machine_pool.pools,
│ An unexpected error was encountered trying to convert tftypes.Value into hcp.HcpMachinePoolState. This is always an error in the provider. Please report the following to the
│ provider developer:
│
│ mismatch between struct and object: Struct defines fields not found in object: current_version, version, and upgrade_acknowledgements_for.
╵
gdbranco commented 9 months ago

How to upgrade HCP Compute nodes?

huh, let me set it up again, I hand't had issues. The path you are taking seems to be correct to me

gdbranco commented 9 months ago

Why is autoscaling a required value?

Has been kept from the classic if I'm not mistaken, but I believe we could also leave it as optional and just consider null as false

tphee commented 9 months ago

I don't think subnet_id is required for upgrade, could this be removed?

resource "rhcs_hcp_machine_pool" "pools" {
  cluster = "29l7dcmufhk2oates01chdidfnt52tos"
  name = "workers-0"
  autoscaling = {
    enabled = false
  }
  upgrade_acknowledgements_for = "4.14"
  version = "4.14.9"
  subnet_id = "subnet-01c6b70e154657ea0"
}
gdbranco commented 9 months ago

@tphee

How to upgrade HCP Compute nodes?

Found a bug in the API, we'll submit a fix and it should be working soon

gdbranco commented 9 months ago

@tphee

I don't think subnet_id is required for upgrade, could this be removed?

It's not for the upgrade, but it is required for creating a new pool in general. So it needs to be required