github.com/khulnasoft-lab/defsec@v1.0.5-0.20230827010352-5e9f46893d95/pkg/scanners/terraformplan/parser/plan_file.go (about)

     1  package parser
     2  
     3  type Resource struct {
     4  	Address       string `json:"address"`
     5  	ModuleAddress string `json:"module_address"`
     6  	Mode          string `json:"mode"`
     7  	Type          string `json:"type"`
     8  	Name          string `json:"name"`
     9  	ProviderName  string `json:"provider_name"`
    10  	SchemaVersion int    `json:"schema_version"`
    11  }
    12  
    13  type ResourceChange struct {
    14  	Resource
    15  	Change `json:"change"`
    16  }
    17  
    18  type ConfigurationResource struct {
    19  	Resource
    20  	Expressions map[string]interface{} `json:"expressions"`
    21  }
    22  
    23  type Change struct {
    24  	Before map[string]interface{} `json:"before"`
    25  	After  map[string]interface{} `json:"after"`
    26  }
    27  
    28  type Module struct {
    29  	Resources    []Resource    `json:"resources"`
    30  	ChildModules []ChildModule `json:"child_modules"`
    31  }
    32  
    33  type ChildModule struct {
    34  	Module
    35  	Address string `json:"address"`
    36  }
    37  
    38  type ConfigurationModule struct {
    39  	Resources   []ConfigurationResource `json:"resources"`
    40  	ModuleCalls map[string]CallModule   `json:"module_calls"`
    41  }
    42  
    43  type CallModule struct {
    44  	Source string              `json:"source"`
    45  	Module ConfigurationModule `json:"module"`
    46  }
    47  
    48  type ConfigurationChildModule struct {
    49  	ConfigurationModule
    50  	Address string `json:"address"`
    51  }
    52  
    53  type PlannedValues struct {
    54  	RootModule Module `json:"root_module"`
    55  }
    56  
    57  type Configuration struct {
    58  	RootModule ConfigurationModule `json:"root_module"`
    59  }
    60  
    61  type PlanFile struct {
    62  	FormatVersion    string           `json:"format_version"`
    63  	TerraformVersion string           `json:"terraform_version"`
    64  	PlannedValues    PlannedValues    `json:"planned_values"`
    65  	ResourceChanges  []ResourceChange `json:"resource_changes"`
    66  	Configuration    Configuration    `json:"configuration"`
    67  }