github.com/terraform-linters/tflint-plugin-sdk@v0.22.0/README.md (about)

     1  # TFLint plugin SDK
     2  [![Build Status](https://github.com/terraform-linters/tflint-plugin-sdk/workflows/build/badge.svg?branch=master)](https://github.com/terraform-linters/tflint-plugin-sdk/actions)
     3  [![GitHub release](https://img.shields.io/github/release/terraform-linters/tflint-plugin-sdk.svg)](https://github.com/terraform-linters/tflint-plugin-sdk/releases/latest)
     4  [![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white)](https://pkg.go.dev/github.com/terraform-linters/tflint-plugin-sdk)
     5  [![License: MPL 2.0](https://img.shields.io/badge/License-MPL%202.0-blue.svg)](LICENSE)
     6  
     7  [TFLint](https://github.com/terraform-linters/tflint) plugin SDK for building custom rules.
     8  
     9  NOTE: This plugin system is experimental. This means that API compatibility is frequently broken.
    10  
    11  ## Requirements
    12  
    13  - TFLint v0.42+
    14  - Go v1.23
    15  
    16  ## Usage
    17  
    18  Please refer to [tflint-ruleset-template](https://github.com/terraform-linters/tflint-ruleset-template) for an example plugin implementation using this SDK.
    19  
    20  For more details on the API, see https://pkg.go.dev/github.com/terraform-linters/tflint-plugin-sdk.
    21  
    22  ## Developing
    23  
    24  The proto compiler is required when updating `.proto` files. The `protoc` and `protoc-gen-go` can be installed using [aqua](https://github.com/aquaproj/aqua).
    25  
    26  ```console
    27  $ make prepare
    28  curl -sSfL https://raw.githubusercontent.com/aquaproj/aqua-installer/v2.1.1/aqua-installer | bash
    29  ===> Installing aqua v2.2.3 for bootstraping...
    30  
    31  ...
    32  
    33  aqua version 2.3.7 (c07105b10ab825e7f309d2eb83278a0422a2b24f)
    34  
    35  Add ${AQUA_ROOT_DIR}/bin to the environment variable PATH.
    36  export PATH="${AQUA_ROOT_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/aquaproj-aqua}/bin:$PATH"
    37  $ export PATH="${AQUA_ROOT_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/aquaproj-aqua}/bin:$PATH"
    38  $ aqua install
    39  $ make proto
    40  ```
    41  
    42  ## Architecture
    43  
    44  This plugin system uses [go-plugin](https://github.com/hashicorp/go-plugin). TFLint launch plugins as sub-processes and communicates with plugins over gRPC. A plugin acts as a server, while TFLint acts as a client that sends inspection requests to the plugin.
    45  
    46  On the other hand, the plugin sends various requests to a server (TFLint) to get detailed runtime contexts (e.g. variables and expressions). This means that TFLint and plugins can act as both a server and a client.
    47  
    48  This SDK provides client, server and Protocol Buffers for these bi-directional communications. See [Architecture](https://github.com/terraform-linters/tflint/blob/master/docs/developer-guide/architecture.md) for more details.