kubevela/terraform-controller

Specify branch/tag of a repository when generating the definition for a new module

d-vm opened this issue · 8 comments

d-vm commented

Preparing the provisioning in AWS, with this addon for KubeVela, we need to be able to generate new componentdefinitions of a module in GitHub based on a branch/tag.

Currently we can only specify the url of the repository and the path of the module.

Can you consider adding this new functionality to your roadmap?

Could be an example?

apiVersion: terraform.core.oam.dev/v1beta1
kind: Configuration
metadata:
  name: aws-s3
spec:
  remote: https://github.com/kubevela-contrib/terraform-modules.git
  branch: your_branch
  path: aws/s3


  variable:
    bucket: "vela-website-aws-202101019"
    acl: "private"

  providerRef:
    name: aws
    namespace: default

  writeConnectionSecretToRef:
    name: s3-conn
    namespace: default

Hi @davma-io! This is reasonable. I'd like to add this to roadmap. But due to the time I can't guarantee the time to complete. Would you like to help?

d-vm commented

Hi @chivalryq. I would like to help, but my knowledge of low level addon operation is limited. I would not have time available until the beginning of August. And after that it would be limited. I could especially contribute with the consolidation tests.

@davma-io You can use the v0.8.0 to do the test. https://github.com/kubevela/terraform-controller/releases/tag/v0.8.0 Any feedback are welcome :)

d-vm commented

Hi @chivalryq

In order to test it, I need version 0.8.0 to be available to deploy from the helm terraform-controller chart.

Either that or I can deploy it with the official addon from KubeVela if the docker-controller image is updated. We need a more updated version of terraform to use some modules.

I leave a pull request to review, if you consider it, in the docker-terraform repository.

#oam-dev/docker-terraform#22

Currently I have the addon deployed as follows:`

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
  name: terraform-controller
  namespace: vela-system
spec:
  components:
    - name: terraform-controller
      type: helm
      properties:
        repoType: "helm"
        url: "https://charts.kubevela.net/addons/"
        valuesFiles:
          - "values.yaml"
replicaCount: 1

image:
  repository: oamdev/terraform-controller
  tag: 0.7.10
  pullPolicy: Always

gitImage: alpine/git:latest
busyboxImage: busybox:latest
terraformImage: ghcr.io/activa-prefapp/docker-terraform:1.5.5
controllerNamespace: ""

# "{\"nat\": \"true\"}"
jobNodeSelector: ""

resources:
  limits:
    cpu: "500m"
    memory: "500Mi"
  requests:
    cpu: "250m"
    memory: "250Mi"

backend:
  namespace: vela-system

githubBlocked: "'false'"

featureGates:
  # Enable the feature of allowing to delete a configuration whose cloud resources is not fully provisioned, or error happens
  # This guarantees that the partial cloud resources will be deleted when the configuration is deleted
  # Default value is true
  AllowDeleteProvisioningResource: true

"https://charts.kubevela.net/addons/" is no longer maintained and is depracated. New charts repo: https://github.com/kubevela/charts. See usage in it. I'll check the PR.

d-vm commented

Thank you. All updated and deployed to version 0.8.0. I will run the tests tomorrow and post the results here if they are correct.

d-vm commented

Hi @chivalryq

The PR has been effective, now we can select different references from the repository to deploy.

But we can only use this new feature if we directly apply a kind:Configuration.
If we try to configure a new module for terraform by means of a ComponentDefinition the result is the following one:

Error from server (BadRequest): error when creating "/modules-definition/terraform-aws-s3.yml": ComponentDefinition in version "v1beta1" cannot be handled as a ComponentDefinition: strict decoding error: unknown field "spec.schematic.terraform.gitRef"

Could you modify core.oam.dev/v1beta1@ComponentDefinition to support these changes? Can we generate an issue at https://github.com/kubevela/kubevela to update the changes?