Giter Club home page Giter Club logo

getting-started's Introduction

IBM Cloud - Terraform modules

This repo captures the guidelines to contribute to either existing repo or creating new repo under terraform-ibm-modules org.

Guidelines

Meeting the requirements for publishing a repo is extremely easy. The list below contains all the guidelines for publishing a repo or contributing to existing repo. The list may appear long only to ensure we're detailed, but adhering to the requirements should happen naturally.

  • GitHub The module must be on GitHub and must be a public repo.

  • Repository Name terraform--. Module repositories must use this three-part name format, where reflects the type of infrastructure the module manages and is the main provider where it creates that infrastructure. The segment can contain additional hyphens.

  • Repository description The GitHub repository description is used to populate the short description of the module. This should be a simple one sentence description of the module.

  • Release tags - Tags are used to identify module versions. Release tag names must be a semantic version, which can optionally be prefixed with a v. For example, v1.0.0.

  • Module structure The module must adhere to the standard module structure. For more details, read the document here.

  • Module inputs - Make sure that name of input varaibles are inline with respective UI page input varaibles. This is to make the user feel same while provisioining the resource either through terraform module or UI. Input Variables should have descriptions. Use input.tfvars file to configue any complex type constraints like list, map etc. For more information, read the guidelines here.

  • Optional input arguments - Make sure the module includes both mandatory and optional arguments, by doing this we enable user to configure the resource as he wishes. For the optional arguments, have a conditional check and send the default value, if the user input is absent.

  • Module outputs - Use to return results to the calling module, which it can then use to populate arguments elsewhere. Outputs should have descriptions. For more information, read the guidelines here.

  • Naming Modules When we regiter our module repo ( naming convention terraform-<PROVIDER>-<NAME> ) with terraform registry, it picks up the NAME from above naming convention and consider it as name of the root module. All the sub-modules will be prefixed with this root module followed by underscore. Hence do not repeat the root module name in sub-module creation.

    E.g: Say we created a module repo called terraform-ibm-cos and we have 2 sub-modules named cos-instance and cos_bucket. Now, when we register our module with terraform registry, it generates module blocks as follows

    module "cos_cos-instance" {
        source  = "terraform-ibm-modules/cos/ibm//modules/cos-instance"
        version = "1.0.0"
    } 
    

    And if we want to name a sub-module with multiple strings, use symbol - as delimiter. e.g: activity-tracker.

  • Source Path Both in main.tf and README.md files, point the source to respective module terraform registry path.

    E.g:

    source = "terraform-ibm-modules/logdna/ibm//modules/instance"

  • Github actions - GitHub Actions makes it easy to automate all the software workflows. As part of github actions we add pre-commit hooks which are being used to validate the PR before it gets merged onto main branch. It also being used to run the test cases perodically to assure the quality of both templates and the modules.

  • test directory - Use terratest to write the test cases under test directory, which will be executed by the github actions using a scheduler on a periodic basis. Following link can be used as a reference to write a test file. To execute terratest files locally, refer the document here

  • .gitignore - Use this file to specify intentionally the untracked files that Git should ignore.

  • .pre-commit-config.yaml - Used for identifying simple issues before submission to code review. We run our hooks on every commit to automatically point out issues in code such as missing semicolons, trailing whitespace, and debug statements.

getting-started's People

Contributors

umarali-nagoor avatar albee-jhoney avatar kavya498 avatar

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.