Documentation ¶
Index ¶
- Variables
- func FindPluginPath(config *InstallConfig) (string, error)
- type Checksummer
- type InstallConfig
- type Plugin
- type Server
- func (s *Server) Attributes(req *tfplugin.AttributesRequest, resp *tfplugin.AttributesResponse) error
- func (s *Server) Backend(req *tfplugin.BackendRequest, resp *tfplugin.BackendResponse) error
- func (s *Server) Blocks(req *tfplugin.BlocksRequest, resp *tfplugin.BlocksResponse) error
- func (s *Server) Config(req *tfplugin.ConfigRequest, resp *tfplugin.ConfigResponse) error
- func (s *Server) EmitIssue(req *tfplugin.EmitIssueRequest, resp *interface{}) error
- func (s *Server) EvalExpr(req *tfplugin.EvalExprRequest, resp *tfplugin.EvalExprResponse) error
- func (s *Server) EvalExprOnRootCtx(req *tfplugin.EvalExprRequest, resp *tfplugin.EvalExprResponse) error
- func (s *Server) File(req *tfplugin.FileRequest, resp *tfplugin.FileResponse) error
- func (s *Server) Files(req *tfplugin.FilesRequest, resp *tfplugin.FilesResponse) error
- func (s *Server) IsNullExpr(req *tfplugin.IsNullExprRequest, resp *tfplugin.IsNullExprResponse) error
- func (s *Server) ModuleCalls(req *tfplugin.ModuleCallsRequest, resp *tfplugin.ModuleCallsResponse) error
- func (s *Server) Resources(req *tfplugin.ResourcesRequest, resp *tfplugin.ResourcesResponse) error
- func (s *Server) RootProvider(req *tfplugin.RootProviderRequest, resp *tfplugin.RootProviderResponse) error
- func (s *Server) RuleConfig(req *tfplugin.RuleConfigRequest, resp *tfplugin.RuleConfigResponse) error
- type SignatureChecker
Constants ¶
This section is empty.
Variables ¶
var (
PluginRoot = "~/.tflint.d/plugins"
)
PluginRoot is the root directory of the plugins This variable is exposed for testing.
Functions ¶
func FindPluginPath ¶ added in v0.29.0
func FindPluginPath(config *InstallConfig) (string, error)
FindPluginPath returns the plugin binary path.
Types ¶
type Checksummer ¶ added in v0.29.0
type Checksummer struct {
// contains filtered or unexported fields
}
Checksummer validates checksums
func NewChecksummer ¶ added in v0.29.0
func NewChecksummer(f io.Reader) (*Checksummer, error)
NewChecksummer returns a new Checksummer from passed checksums.txt file. The checksums.txt must contain multiple lines containing sha256 hashes and filenames separated by spaces. An example is shown below:
3a61fff3689f27c89bce22893219919c629d2e10b96e7eadd5fef9f0e90bb353 tflint-ruleset-aws_darwin_amd64.zip 482419fdeed00692304e59558b5b0d915d4727868b88a5adbbbb76f5ed1b537a tflint-ruleset-aws_linux_amd64.zip db4eed4c0abcfb0b851da5bbfe8d0c71e1c2b6afe4fd627638a462c655045902 tflint-ruleset-aws_windows_amd64.zip
type InstallConfig ¶ added in v0.29.0
type InstallConfig struct { *tflint.PluginConfig // contains filtered or unexported fields }
InstallConfig is a config for plugin installation. This is a wrapper for PluginConfig and manages naming conventions and directory names for installation. Note that need a global config to manage installation directory.
func NewInstallConfig ¶ added in v0.29.0
func NewInstallConfig(config *tflint.Config, pluginCfg *tflint.PluginConfig) *InstallConfig
NewInstallConfig returns a new InstallConfig from passed PluginConfig.
func (*InstallConfig) AssetName ¶ added in v0.29.0
func (c *InstallConfig) AssetName() string
AssetName returns a name that the asset contained in the release should meet. The name must be in a format similar to `tflint-ruleset-aws_darwin_amd64.zip`.
func (*InstallConfig) Install ¶ added in v0.29.0
func (c *InstallConfig) Install() (string, error)
Install fetches the release from GitHub and puts the binary in the plugin directory. This installation process will automatically check the checksum of the downloaded zip file. Therefore, the release must always contain a checksum file. In addition, the release must meet the following conventions:
- The release must be tagged with a name like v1.1.1
- The release must contain an asset with a name like tflint-ruleset-{name}_{GOOS}_{GOARCH}.zip
- The zip file must contain a binary named tflint-ruleset-{name} (tflint-ruleset-{name}.exe in Windows)
- The release must contain a checksum file for the zip file with the name checksums.txt
- The checksum file must contain a sha256 hash and filename
For security, you can also make sure that the checksum file is signed correctly. In that case, the release must additionally meet the following conventions:
- The release must contain a signature file for the checksum file with the name checksums.txt.sig
- The signature file must be binary OpenPGP format
func (*InstallConfig) InstallPath ¶ added in v0.29.0
func (c *InstallConfig) InstallPath() string
InstallPath returns an installation path from the plugin directory.
func (*InstallConfig) ManuallyInstalled ¶ added in v0.29.0
func (c *InstallConfig) ManuallyInstalled() bool
ManuallyInstalled returns whether the plugin should be installed manually. If source or version is omitted, you will have to install it manually.
func (*InstallConfig) TagName ¶ added in v0.29.0
func (c *InstallConfig) TagName() string
TagName returns a tag name that the GitHub release should meet. The version must not contain leading "v", as the prefix "v" is added here, and the release tag must be in a format similar to `v1.1.1`.
type Plugin ¶
type Plugin struct { RuleSets map[string]*tfplugin.Client // contains filtered or unexported fields }
Plugin is an object handling plugins Basically, it is a wrapper for go-plugin and provides an API to handle them collectively.
func Discovery ¶ added in v0.14.0
Discovery searches and launches plugins according the passed configuration. If the plugin is not enabled, skip without starting. The AWS plugin is treated specially. Plugins for which no version is specified will launch the bundled plugin instead of returning an error. This is a process for backward compatibility.
type Server ¶ added in v0.14.0
type Server struct {
// contains filtered or unexported fields
}
Server is a RPC server for responding to requests from plugins
func (*Server) Attributes ¶ added in v0.14.0
func (s *Server) Attributes(req *tfplugin.AttributesRequest, resp *tfplugin.AttributesResponse) error
Attributes returns corresponding hcl.Attributes
func (*Server) Backend ¶ added in v0.18.0
func (s *Server) Backend(req *tfplugin.BackendRequest, resp *tfplugin.BackendResponse) error
Backend returns corresponding configs.Backend as tfplugin.Backend
func (*Server) Blocks ¶ added in v0.17.0
func (s *Server) Blocks(req *tfplugin.BlocksRequest, resp *tfplugin.BlocksResponse) error
Blocks returns corresponding hcl.Blocks
func (*Server) Config ¶ added in v0.20.0
func (s *Server) Config(req *tfplugin.ConfigRequest, resp *tfplugin.ConfigResponse) error
Config returns corresponding configs.Config as tfplugin.Config
func (*Server) EmitIssue ¶ added in v0.14.0
func (s *Server) EmitIssue(req *tfplugin.EmitIssueRequest, resp *interface{}) error
EmitIssue reflects a issue to the Runner
func (*Server) EvalExpr ¶ added in v0.14.0
func (s *Server) EvalExpr(req *tfplugin.EvalExprRequest, resp *tfplugin.EvalExprResponse) error
EvalExpr returns a value of the evaluated expression
func (*Server) EvalExprOnRootCtx ¶ added in v0.23.0
func (s *Server) EvalExprOnRootCtx(req *tfplugin.EvalExprRequest, resp *tfplugin.EvalExprResponse) error
EvalExprOnRootCtx returns a value of the evaluated expression on the context of the root module.
func (*Server) File ¶ added in v0.23.0
func (s *Server) File(req *tfplugin.FileRequest, resp *tfplugin.FileResponse) error
File returns the corresponding hcl.File object
func (*Server) Files ¶ added in v0.30.0
func (s *Server) Files(req *tfplugin.FilesRequest, resp *tfplugin.FilesResponse) error
Files returns the corresponding hcl.File representation (in bytes) of all Terraform configuration in the module directory.
func (*Server) IsNullExpr ¶ added in v0.23.0
func (s *Server) IsNullExpr(req *tfplugin.IsNullExprRequest, resp *tfplugin.IsNullExprResponse) error
IsNullExpr returns the result of determining whether the expression is null or not.
func (*Server) ModuleCalls ¶ added in v0.19.0
func (s *Server) ModuleCalls(req *tfplugin.ModuleCallsRequest, resp *tfplugin.ModuleCallsResponse) error
ModuleCalls returns all configs.ModuleCall as tfplugin.ModuleCall
func (*Server) Resources ¶ added in v0.17.0
func (s *Server) Resources(req *tfplugin.ResourcesRequest, resp *tfplugin.ResourcesResponse) error
Resources returns corresponding configs.Resource as tfplugin.Resource
func (*Server) RootProvider ¶ added in v0.23.0
func (s *Server) RootProvider(req *tfplugin.RootProviderRequest, resp *tfplugin.RootProviderResponse) error
RootProvider returns the provider configuration on the root module as tfplugin.Provider
func (*Server) RuleConfig ¶ added in v0.23.0
func (s *Server) RuleConfig(req *tfplugin.RuleConfigRequest, resp *tfplugin.RuleConfigResponse) error
RuleConfig returns an encoded HCL format rule config
type SignatureChecker ¶ added in v0.29.0
type SignatureChecker struct {
// contains filtered or unexported fields
}
SignatureChecker checks the signature of GitHub releases. Determines whether to select a signing key or skip it based on the InstallConfig.
func NewSignatureChecker ¶ added in v0.29.0
func NewSignatureChecker(config *InstallConfig) *SignatureChecker
NewSignatureChecker returns a new SignatureChecker from passed InstallConfig.
func (*SignatureChecker) GetSigningKey ¶ added in v0.29.0
func (c *SignatureChecker) GetSigningKey() string
GetSigningKey returns an ASCII armored signing key. If the plugin is under the terraform-linters organization, you can use the built-in key even if the signing_key is omitted.
func (*SignatureChecker) HasSigningKey ¶ added in v0.29.0
func (c *SignatureChecker) HasSigningKey() bool
HasSigningKey determines whether the checker should verify the signature. Skip verification if no signing key is set.