Skip to content

Configurations created from a CloudResource unable to find auth secrets #1688

@chris-brindley

Description

@chris-brindley

Describe the bug
When attempting to provision a CloudResource using a Revision that has an auth secret in a different namespace, the Configuration triggers an event Authentication secret (spec.auth) does not exist and Terranetes does not attempt to run terraform plan.

To Reproduce
Steps to reproduce the behavior:

  1. Create a git secret in the terraform-system namespace.
kubectl -n terraform-system create secret generic github-credentials \
    --from-literal=GIT_USERNAME=foo \
    --from-literal=GIT_PASSWORD=bar
  1. Create a Revision that references this secret.
kubectl apply -f- <<EOT
apiVersion: terraform.appvia.io/v1alpha1
kind: Revision
metadata:
  name: bucket.v1
spec:
  plan:
    name: bucket
    categories: [gcp, bucket, gcs]
    description: Creates a GCS storage bucket
    revision: v1.0.0
  inputs:
    - key: name
      description: The name of the bucket you are provisioning
      required: true
  configuration:
    auth:
      name: github-credentials
      namespace: terraform-system
    module: "https://github.com/my-org/my-module-repo.git?ref=v1.0.0"
EOT
  1. Attempt to deploy a CloudResource referencing this Revision.
kubectl apply -f- <<EOT
apiVersion: terraform.appvia.io/v1alpha1
kind: CloudResource
metadata:
  name: my-bucket
  namespace: tenant
spec:
  plan:
    name: bucket
    revision: v1.0.0
  providerRef:
    name: my-provider
  variables:
    name: my-test-bucket
EOT
  1. Observe a failure in the Configuration resource indicating the auth secret does not exist.
kubectl -n tenant events
LAST SEEN             TYPE      REASON            OBJECT                          MESSAGE
4m5s (x13 over 64m)   Warning   Action Required   Configuration/my-bucket-xl9ck   Authentication secret (spec.auth) does not exist

Expected behavior
Terranetes should be able to provision the CloudResource correctly.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

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