Skip to content

[BUG] Terraform does not fail if secret is missing #1337

@lukeelten

Description

@lukeelten

Rancher Server Setup

  • Rancher version: RKE2

Information about the Cluster

Hosted on-prem with RockyLinux as OS.

User Information

  • What is the role of the user logged in? (Admin/Cluster Owner/Cluster Member/Project Owner/Project Member/Custom)
    Admin

Provider Information

  • What is the version of the Rancher v2 Terraform Provider in use? 4.1.0
  • What is the version of Terraform in use? 1.7.4

Describe the bug

My terraform pipeline uses the data source "rancher2_secret_v2" to retrieve information about a secret.
When the secret is not available in the cluster, the pipeline still continues to run and the referenced values are empty.
This causes our deployments to fail.

To Reproduce

data "rancher2_secret_v2" "test" {
  cluster_id = <CLUSTER_ID>
  name = "DOES_NOT_EXIST"
  namespace = "default"
}

This terraform script works always whether the secret exists or not.

Actual Result

Terraform script succeeds.

Expected Result

Terraform fails because the referenced secret is missing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    impact/patchThis changes a behavior without users needing to make a change.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions