rancher / terraform-provider-rancher2

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

Add extra_args_array Field rancher#1209 #1440

Open nobbs opened 2 weeks ago

nobbs commented 2 weeks ago

This is a rebase of #1212 since it got closed months ago without merging. Here's also the original PR comment by @khrisrichardson:

Issue:

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