Giter Site home page Giter Site logo

Comments (3)

CameronHudson8 avatar CameronHudson8 commented on July 17, 2024

Unfortunately, while it is possible to terraform apply the TriggerTemplate after changing the capitalization, Terraform subsequently emits an error, and the resource is tainted. So there isn't a clean workaround at the moment.

╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to
│ module.tekton_pipelines.module.trigger_templates.kubernetes_manifest.trigger_template_github_image_pr,
│ provider "provider[\"registry.terraform.io/hashicorp/kubernetes\"]"
│ produced an unexpected new value: .object: wrong final value type:
│ attribute "spec": attribute "resourceTemplates" is required.
│ 
│ This is a bug in the provider, which should be reported in the provider's
│ own issue tracker.
╵

Performing terraform plan after this shows a persistent diff in the state.

 # module.tekton_pipelines.module.trigger_templates.kubernetes_manifest.trigger_template_github_image_pr is tainted, so must be replaced
-/+ resource "kubernetes_manifest" "trigger_template_github_image_pr" {
      ~ object   = {
          ~ spec       = {
              + resourceTemplates = [
                  + {
                      + apiVersion = "tekton.dev/v1"
                      + kind       = "PipelineRun"
                      + metadata   = {
                          + generateName = "github-image-pr-"
                        }
                      + spec       = {
                          + params          = [
                              + {
                                  + name  = "github-status-url"
                                  + value = "$(tt.params.github-status-url)"
                                },
                              + {
                                  + name  = "pr-number"
                                  + value = "$(tt.params.pr-number)"
                                },
                              + {
                                  + name  = "repo-name"
                                  + value = "$(tt.params.repo-name)"
                                },
                              + {
                                  + name  = "repo-url"
                                  + value = "$(tt.params.repo-url)"
                                },
                            ]
                          + pipelineRef     = {
                              + name = "github-image-pr"
                            }
                          + taskRunTemplate = {
                              + serviceAccountName = "cicd-bot"
                            }
                          + workspaces      = [
                              + {
                                  + name                = "default"
                                  + volumeClaimTemplate = {
                                      + spec = {
                                          + accessModes = [
                                              + "ReadWriteOnce",
                                            ]
                                          + resources   = {
                                              + requests = {
                                                  + storage = "512Mi"
                                                }
                                            }
                                        }
                                    }
                                },
                            ]
                        }
                    },
                ]
              - resourcetemplates = [
                  - {
                      - apiVersion = "tekton.dev/v1"
                      - kind       = "PipelineRun"
                      - metadata   = {
                          - generateName = "github-image-pr-"
                        }
                      - spec       = {
                          - params          = [
                              - {
                                  - name  = "github-status-url"
                                  - value = "$(tt.params.github-status-url)"
                                },
                              - {
                                  - name  = "pr-number"
                                  - value = "$(tt.params.pr-number)"
                                },
                              - {
                                  - name  = "repo-name"
                                  - value = "$(tt.params.repo-name)"
                                },
                              - {
                                  - name  = "repo-url"
                                  - value = "$(tt.params.repo-url)"
                                },
                            ]
                          - pipelineRef     = {
                              - name = "github-image-pr"
                            }
                          - taskRunTemplate = {
                              - serviceAccountName = "cicd-bot"
                            }
                          - workspaces      = [
                              - {
                                  - name                = "default"
                                  - volumeClaimTemplate = {
                                      - spec = {
                                          - accessModes = [
                                              - "ReadWriteOnce",
                                            ]
                                          - resources   = {
                                              - requests = {
                                                  - storage = "512Mi"
                                                }
                                            }
                                        }
                                    }
                                },
                            ]
                        }
                    },
                ]
                # (1 unchanged attribute hidden)
            }
            # (3 unchanged attributes hidden)
        }
        # (1 unchanged attribute hidden)
    }

from triggers.

savitaashture avatar savitaashture commented on July 17, 2024

Hi @CameronHudson8 👋

I followed the steps which you have provided but i did not see any issue

  1. Created terraform code which you have provided
  2. did terraform apply
  3. Below is the output of terraform apply
$ terraform apply

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # kubernetes_manifest.trigger_template_github_image_pr will be created
  + resource "kubernetes_manifest" "trigger_template_github_image_pr" {
      + manifest = {
          + apiVersion = "triggers.tekton.dev/v1beta1"
          + kind       = "TriggerTemplate"
          + metadata   = {
              + name      = "github-image-pr"
              + namespace = "tekton-pipelines"
            }
          + spec       = {
              + params            = [
                  + {
                      + name = "github-status-url"
                    },
                  + {
                      + name = "pr-number"
                    },
                  + {
                      + name = "repo-name"
                    },
                  + {
                      + name = "repo-url"
                    },
                ]
              + resourcetemplates = [
                  + {
                      + apiVersion = "tekton.dev/v1"
                      + kind       = "PipelineRun"
                      + metadata   = {
                          + generateName = "github-image-pr-"
                        }
                      + spec       = {
                          + params          = [
                              + {
                                  + name  = "github-status-url"
                                  + value = "$(tt.params.github-status-url)"
                                },
                              + {
                                  + name  = "pr-number"
                                  + value = "$(tt.params.pr-number)"
                                },
                              + {
                                  + name  = "repo-name"
                                  + value = "$(tt.params.repo-name)"
                                },
                              + {
                                  + name  = "repo-url"
                                  + value = "$(tt.params.repo-url)"
                                },
                            ]
                          + pipelineRef     = {
                              + name = "github-image-pr"
                            }
                          + taskRunTemplate = {
                              + serviceAccountName = "tekton-triggers-example-sa"
                            }
                          + workspaces      = [
                              + {
                                  + name                = "default"
                                  + volumeClaimTemplate = {
                                      + spec = {
                                          + accessModes = [
                                              + "ReadWriteOnce",
                                            ]
                                          + resources   = {
                                              + requests = {
                                                  + storage = "512Mi"
                                                }
                                            }
                                        }
                                    }
                                },
                            ]
                        }
                    },
                ]
            }
        }
      + object   = {
          + apiVersion = "triggers.tekton.dev/v1beta1"
          + kind       = "TriggerTemplate"
          + metadata   = {
              + name      = "github-image-pr"
              + namespace = "tekton-pipelines"
            }
          + spec       = {
              + params            = [
                  + {
                      + name = "github-status-url"
                    },
                  + {
                      + name = "pr-number"
                    },
                  + {
                      + name = "repo-name"
                    },
                  + {
                      + name = "repo-url"
                    },
                ]
              + resourcetemplates = [
                  + {
                      + apiVersion = "tekton.dev/v1"
                      + kind       = "PipelineRun"
                      + metadata   = {
                          + generateName = "github-image-pr-"
                        }
                      + spec       = {
                          + params          = [
                              + {
                                  + name  = "github-status-url"
                                  + value = "$(tt.params.github-status-url)"
                                },
                              + {
                                  + name  = "pr-number"
                                  + value = "$(tt.params.pr-number)"
                                },
                              + {
                                  + name  = "repo-name"
                                  + value = "$(tt.params.repo-name)"
                                },
                              + {
                                  + name  = "repo-url"
                                  + value = "$(tt.params.repo-url)"
                                },
                            ]
                          + pipelineRef     = {
                              + name = "github-image-pr"
                            }
                          + taskRunTemplate = {
                              + serviceAccountName = "tekton-triggers-example-sa"
                            }
                          + workspaces      = [
                              + {
                                  + name                = "default"
                                  + volumeClaimTemplate = {
                                      + spec = {
                                          + accessModes = [
                                              + "ReadWriteOnce",
                                            ]
                                          + resources   = {
                                              + requests = {
                                                  + storage = "512Mi"
                                                }
                                            }
                                        }
                                    }
                                },
                            ]
                        }
                    },
                ]
            }
        }
    }

Plan: 1 to add, 0 to change, 0 to destroy.
╷
│ Warning: This custom resource does not have an associated OpenAPI schema.
│ 
│   with kubernetes_manifest.trigger_template_github_image_pr,
│   on main.tf line 1, in resource "kubernetes_manifest" "trigger_template_github_image_pr":
│    1: resource "kubernetes_manifest" "trigger_template_github_image_pr" {
│ 
│ We could not find an OpenAPI schema for this custom resource. Updates to this resource will cause a forced replacement.
╵

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

kubernetes_manifest.trigger_template_github_image_pr: Creating...
kubernetes_manifest.trigger_template_github_image_pr: Creation complete after 0s
╷
│ Warning: This custom resource does not have an associated OpenAPI schema.
│ 
│   with kubernetes_manifest.trigger_template_github_image_pr,
│   on main.tf line 1, in resource "kubernetes_manifest" "trigger_template_github_image_pr":
│    1: resource "kubernetes_manifest" "trigger_template_github_image_pr" {
│ 
│ We could not find an OpenAPI schema for this custom resource. Updates to this resource will cause a forced replacement.
╵

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
  1. `TriggerTemplate created successfully
$ kubectl get tt -n tekton-pipelines
NAME              AGE
github-image-pr   7s
  1. Kubectl version
$ kubectl version
WARNING: This version information is deprecated and will be replaced with the output from kubectl version --short.  Use --output=yaml|json to get the full version.
Client Version: version.Info{Major:"1", Minor:"26", GitVersion:"v1.26.6", GitCommit:"11902a838028edef305dfe2f96be929bc4d114d8", GitTreeState:"archive", BuildDate:"2023-06-15T00:00:00Z", GoVersion:"go1.20.4", Compiler:"gc", Platform:"linux/amd64"}
Kustomize Version: v4.5.7
Server Version: version.Info{Major:"1", Minor:"26", GitVersion:"v1.26.3", GitCommit:"9e644106593f3f4aa98f8a84b23db5fa378900bd", GitTreeState:"clean", BuildDate:"2023-03-15T13:33:12Z", GoVersion:"go1.19.7", Compiler:"gc", Platform:"linux/amd64"}
  1. Terraform version
$ terraform  version
Terraform v1.5.7
on linux_amd64
+ provider registry.terraform.io/hashicorp/kubernetes v2.17.0

Let me know if i misunderstand your question

from triggers.

CameronHudson8 avatar CameronHudson8 commented on July 17, 2024

I started from scratch, this time with a cluster of kubernetes version 1.27, and I'm no longer able to reproduce it. Weird, but works for me!

from triggers.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.