Skip to content

Richard-Barrett/terraform-codefresh-pipeline

Repository files navigation

Terraform Codefresh Pipeline Module

A Terraform module to manage Codefresh pipelines. This module allows you to define and configure Codefresh pipelines using Terraform, enabling Infrastructure as Code (IaC) practices for your CI/CD workflows.

CodeQL IaC Terraform Validate TFLint Trivy Scan

Module Diagram
graph TD
    subgraph Variables
        A[pipeline_name] 
        B[pipeline_repo]
        C[pipeline_path]
        D[pipeline_revision]
        E[pipeline_context]
        F[pipeline_location]
        G[pipeline_cpu]
        H[pipeline_memory]
        I[pipeline_variables]
        J[pipeline_tags]
        K[runtime_environment_default]
    end

    subgraph Resource
        L[codefresh_pipeline.tf-datalake-buckets-terraform]
    end

    %% Relationships
    A -->|sets| L.name
    B -->|sets| L.spec.spec_template.repo
    C -->|sets| L.spec.spec_template.path
    D -->|sets| L.spec.spec_template.revision
    E -->|sets| L.spec.spec_template.context
    F -->|sets| L.spec.spec_template.location
    K -->|sets| L.spec.runtime_environment.name
    G -->|sets| L.spec.runtime_environment.cpu
    H -->|sets| L.spec.runtime_environment.memory
    I -->|sets| L.spec.variables
    J -->|sets| L.tags


Loading

CICD Implementations

An Example of a CICD Integration using Codefresh and BitBucket with this module can be found below:

Diagram of Terraform Module

Usage

module "codefresh_pipeline" {
  source = "git::https://github.com/Richard-Barrett/terraform-codefresh-pipeline.git?ref=0.4.0"

  pipeline_name               = "my-codefresh-pipeline"
  pipeline_repo               = "https://github.com/your-repo.git"
  pipeline_path               = "path/to/pipeline"
  pipeline_revision           = "main"
  pipeline_context            = "production"
  pipeline_location           = "us-west-2"
  pipeline_cpu                = "2"
  pipeline_memory             = "4Gi"
  runtime_environment_default = "default-env"

  pipeline_tags = [
    "prodsys-data",
    "ci-cd",
  ]

  pipeline_variables = {
    ENV_VAR1 = "value1"
    ENV_VAR2 = "value2"
  }
}

Terraform Documentation

Requirements

Name Version
terraform >= 1.5.7
codefresh 0.11.0

Providers

Name Version
codefresh 0.11.0

Modules

No modules.

Resources

Name Type
codefresh_pipeline.tf-datalake-buckets-terraform resource

Inputs

Name Description Type Default Required
pipeline_context Context for the pipeline string n/a yes
pipeline_cpu CPU allocation for the runtime environment string 2500 no
pipeline_location Location of the pipeline repository string n/a yes
pipeline_memory Memory allocation for the runtime environment (e.g., '512Mi', '2Gi') string "512Mi" no
pipeline_name Name of the Codefresh pipeline string n/a yes
pipeline_path Path to the pipeline configuration in the repository string n/a yes
pipeline_repo Repository containing the pipeline configuration string n/a yes
pipeline_revision Revision of the pipeline configuration to use string n/a yes
pipeline_tags Tags to associate with the pipeline list(string) n/a yes
pipeline_variables Environment variables for the pipeline map(string) n/a yes
runtime_environment_default Default runtime environment name string n/a yes

Outputs

Name Description
network_rule_id The ID of the network rule.
network_rule_name The name of the network rule.
network_rule_type The type of the network rule.

Licence

MIT License. See LICENSE for full details.

About

Terraform Module to Create and Manage Pipelines

Resources

License

Stars

Watchers

Forks

Packages

No packages published