rancher / terraform-provider-rancher2

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

[BUG] 4.1.0 - tf want to unset rke_config.services.kube_api.admission_configuration when default_pod_security_admission_configuration_template_name is set #1339

Open gorantornqvist-sr opened 2 months ago

gorantornqvist-sr commented 2 months ago

Rancher Server Setup

Information about the Cluster

User Information

Provider Information

Describe the bug

When rancher2_cluster.default_pod_security_admission_configuration_template_name set, terraform wants to remove rke_config.services.kube_api.admission_configuration each time it is run, see screenshot.

To Reproduce

Actual Result

Expected Result

tf apply/plan should not try to remove the rancher generated contents

Screenshots

image

Additional context

pwurbs commented 1 month ago

I face the same

pwurbs commented 1 month ago

There is another negative impact: When applying the plan, then it brought back the formerly removed defaultPodSecurityPolicyTemplateName config parameter in the cluster configuration. This then enabled back the (useless) configuration of a PSP for a Rancher project.

I mitigated the issue by redundantly added admission_configuration to the kube-api in cluster config in TF configuration. This stops the Rancher TF provider from removing it from the Rancher generated rke_config.

As an alternative, rke_config[0].services[0].kube_api[0].admission_configuration can be added to ignore_changes

gorantornqvist-sr commented 1 month ago

This workaround appears to work:

resource "rancher2_cluster" "cluster" {

  lifecycle {
    ignore_changes = [
        rke_config[0].services[0].kube_api[0].admission_configuration
    ]
  }
}
pwurbs commented 1 month ago

For me too