rancher / terraform-provider-rancher2

Terraform Rancher2 provider
https://www.terraform.io/docs/providers/rancher2/
Mozilla Public License 2.0
253 stars 218 forks source link

Add extra_args_array Field #1212

Closed khrisrichardson closed 3 weeks ago

khrisrichardson commented 10 months ago

Issue:

https://github.com/rancher/terraform-provider-rancher2/issues/1209

Problem

Two new fields were added to RKE, ExtraArgsArray and WindowsExtraArgsArray. These fields allow users to specify an extraArg multiple times with different values. The provider now needs to be updated to support these two new fields.

Solution

An extra_args_array set field was added adjacent to the existing extra_args field.

Testing

Engineering Testing

Manual Testing

Here's a snippet demonstrating which fields were added, with everything else in ellipsis.

resource "rancher2_cluster" "cluster" {

  rke_config {
    services {
      kube_api {
        extra_args_array {
          name  = "api-audiences"
          value = [
            "sts.amazonaws.com",
          ]
        }
        extra_args_array {
          name  = "service-account-key-file"
          value = [
            "/etc/kubernetes/ssl/sa-signer-pkcs8.pub",
          ]
        }
        extra_args_array {
          name  = "service-account-issuer"
          value = [
            "rke",
          ]
        }
      }
   }
}

And these were the results, trimmed for clarity

      ~ rke_config {
          ~ services {
              ~ kube_api {
                  + extra_args_array {
                      + name  = "api-audiences"
                      + value = [
                          + "sts.amazonaws.com",
                        ]
                    }
                  + extra_args_array {
                      + name  = "service-account-issuer"
                      + value = [
                          + "rke",
                        ]
                    }
                  + extra_args_array {
                      + name  = "service-account-key-file"
                      + value = [
                          + "/etc/kubernetes/ssl/sa-signer-pkcs8.pub",
                        ]
                    }
                }
            }
        }
    }

Automated Testing

Tests have been added only to rancher2/structure_cluster_rke_config_services_etcd_test.go, since the tests for the other services would otherwise use identical schemas, flatteners, and expanders.

QA Testing Considerations

Regressions Considerations

krichardson-tubi commented 7 months ago

CC: @a-blender, could you recommend a reviewer for this PR please? My apologies for keeping it in draft for so long.

khrisrichardson commented 7 months ago

CC: @snasovich, would you by any chance be able to assign a reviewer? Thanks

khrisrichardson commented 7 months ago

Is it ok to specify both extra_args and the new extra_args_array?

@richardcase that is correct, just as they are not mutually exclusive in the rancher/rancher or rancher/rke code

krichardson-tubi commented 6 months ago

@richardcase do you have any additional concerns or questions?