Skip to content

Idempotency with terraform #654

Open
@pand-app

Description

@pand-app

Hello,

This issue is maybe related to hashicorp/terraform-provider-kubernetes-alpha#41, I create an issue here to track this behavior and share information.

We manage our kubernetes cluster via terraform, to enforce maintenability and collaboration (using gitlab and Merge requests).
To deploy CRD we are using kubernetes-alpha provider from hashicorp.
Some parameters are not idempotents, and when we run apply two times, the second one is failing cause of dry-run failure.

resource "kubernetes_manifest" "arangodb-db" {
  provider = kubernetes-alpha

  manifest = {
    "apiVersion" = "database.arangodb.com/v1alpha"
    "kind" = "ArangoDeployment"
    "metadata" = {
      "name" = "test"
    }
    "spec" = {
      "mode" = "Single"
      "bootstrap" = {
        "passwordSecretNames" = {
          "root" = "Auto"
        }
      }
    }
  }
}

Some other behaviors results to a failure, first time apply the previous hcl, then change it to

resource "kubernetes_manifest" "arangodb-db" {
  provider = kubernetes-alpha

  manifest = {
    "apiVersion" = "database.arangodb.com/v1alpha"
    "kind" = "ArangoDeployment"
    "metadata" = {
      "name" = "test"
    }
    "spec" = {
      "mode" = "Single"
      "bootstrap" = {
        "passwordSecretNames" = {
          "root" = "Auto"
        }
      }
      "tls" = {
        "caSecretName" = "None"
      }
    }
  }
}

It's failure, but expected to have a force replace scenario

Best regards,
Gaël

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions