Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ci): add terraform registry source #1576

Merged
merged 1 commit into from
Sep 12, 2023

Conversation

mcwarman
Copy link
Member

Adds terraform registry source, also adds an alias to hcl plugin as terraform/file for usability.

Registry Provider - terraform/provider

name: Test Terraform Lock plugin resource from SCM

scms:
  default:
    kind: git
    spec:
      url: https://github.com/updatecli-test/jenkins-infra-aws.git

sources:
  kubernetes:
    name: Get version from registry
    kind: terraform/registry
    spec:
      type: provider
      namespace: hashicorp
      name: kubernetes

targets:
  update-file-from-source:
    name: Update files content from source
    kind: terraform/lock
    sourceid: kubernetes
    scmid: default
    spec:
      file: .terraform.lock.hcl
      provider: hashicorp/kubernetes
      platforms:
        - linux_amd64

Registry Module - terraform/file

name: Test Terraform File plugin resource - SCM

scms:
  default:
    kind: git
    spec:
      url: https://github.com/updatecli-test/jenkins-infra-aws.git

sources:
  terraform-aws-modules-eks:
    name: Get version from registry
    kind: terraform/registry
    spec:
      type: module
      namespace: terraform-aws-modules
      name: eks
      targetsystem: aws

conditions:
  using-value:
    name: Condition using value
    kind: terraform/file
    scmid: default
    disablesourceinput: true
    spec:
      file: cik8s-cluster.tf
      path: module.cik8s.source
      value: terraform-aws-modules/eks/aws


targets:
  update-file:
    name: Update files content
    kind: terraform/file
    sourceid: terraform-aws-modules-eks
    scmid: default
    spec:
      file: cik8s-cluster.tf
      path: module.cik8s.version

Test

To test this pull request, you can run the following commands:

cd ./pkg/plugins/resources/terraform/registry/
go test
go build -o ./bin/updatecli && ./bin/updatecli diff --config ./e2e/updatecli.d/success.d/terraform/

@mcwarman mcwarman force-pushed the feature/terraform-registry branch 2 times, most recently from e940ca0 to b649766 Compare September 11, 2023 09:44
Copy link
Member

@olblak olblak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just did some testing and it works great with the UT and e2e tests.

Congrats

Note on myself, I'll need to redesign how we fetch changelog information as we start to have quite a few code duplication

@olblak olblak added this to the 0.60.0 milestone Sep 12, 2023
@olblak olblak merged commit f4f8e61 into updatecli:main Sep 12, 2023
6 checks passed
@olblak olblak added the enhancement New feature or request label Sep 12, 2023
@mcwarman mcwarman deleted the feature/terraform-registry branch September 18, 2023 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants