schemaVersion: 2.3.0
metadata:
  generateNme: terraform-dev
  version: 1.0.0
  description: A devfile for Terraform development and testing.
  projectType: Infrastructure-as-Code
  language: HCL
  provider: Open Source
  tags: ['Terraform', 'IaC']
  displayName: Terraform Development Environment
  icon: https://www.terraform.io/assets/images/og-image-8b3e4f7d.png

components:
  - name: terraform-tools
    container:
      image: quay.io/repository/pfeifferj/tfdev:latest
      memoryLimit: 512Mi
      cpuLimit: "1"
      mountSources: true
      volumeMounts:
        - name: terraform-data
          path: /workspace

  - name: terraform-data
    volume:
      size: 1Gi
      ephemeral: true

commands:
  - id: terraform-init
    exec:
      component: terraform
      commandLine: "terraform init"
      workingDir: /workspace
      group:
        kind: build
        isDefault: true

  - id: terraform-plan
    exec:
      component: terraform
      commandLine: "terraform plan"
      workingDir: /workspace
      group:
        kind: build
        isDefault: false

  - id: terraform-apply
    exec:
      component: terraform
      commandLine: "terraform apply -auto-approve"
      workingDir: /workspace
      group:
        kind: build
        isDefault: false

  - id: terraform-lint
    exec:
      component: terraform-lint
      commandLine: "tflint"
      workingDir: /workspace
      group:
        kind: build
        isDefault: false

  - id: generate-docs
    exec:
      component: terraform-docs
      commandLine: "terraform-docs markdown ."
      workingDir: /workspace
      group:
        kind: build
        isDefault: false
