terraoldinject

package module
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2021 License: GPL-3.0 Imports: 6 Imported by: 0

README

TerraInject

madebyshield

This package creates the ability to inject specifications for providers, resources, etc into Terraform files and is most useful for testing those Terraform configurations.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildAz

func BuildAz(f string, prov string, fields *AzProv) error

BuildAz takes JSON data in from the ReadFile function and formats it into the needed provider block If fields are not intended to be set for provider block simply omit them, they will evaluate to false

Types

type AzProv

type AzProv struct {
	Azure struct {
		Features struct {
			APIMngmt struct {
				PurgeOnDestroy bool `json:"PurgeOnDestroy"`
			} `json:"ApiMngmt"`
			CogAccount struct {
				PurgeOnDestroy bool `json:"PurgeOnDestroy"`
			} `json:"CogAccount"`
			KeyVault struct {
				PurgeOnDestroy    bool `json:"PurgeOnDestroy"`
				RecoverSoftDelete bool `json:"RecoverSoftDelete"`
			} `json:"KeyVault"`
			LogAnalyticsWrkSpc struct {
				PermDeleteOnDestroy bool `json:"PermDeleteOnDestroy"`
			} `json:"LogAnalyticsWrkSpc"`
			ResourceGroup struct {
				PrevDeleteIfRes bool `json:"PrevDeleteIfRes"`
			} `json:"ResourceGroup"`
			TempDeploy struct {
				DeleteNestedItems bool `json:"DeleteNestedItems"`
			} `json:"TempDeploy"`
			VirtMachine struct {
				DeleteOsDisk        bool `json:"DeleteOsDisk"`
				GracefulShutdown    bool `json:"GracefulShutdown"`
				SkipShutForceDelete bool `json:"SkipShutForceDelete"`
			} `json:"VirtMachine"`
			Vmss struct {
				ForceDelete   bool `json:"ForceDelete"`
				RollInstances bool `json:"RollInstances"`
			} `json:"VMSS"`
		} `json:"Features"`
		ClientID          string   `json:"ClientId"`
		Environment       string   `json:"Environment"`
		SubID             string   `json:"SubId"`
		TenantID          string   `json:"TenantId"`
		AuxTenantID       []string `json:"AuxTenantId"`
		ClientCertPass    string   `json:"ClientCertPass"`
		ClientCertPath    string   `json:"ClientCertPath"`
		ClientSecret      string   `json:"ClientSecret"`
		MsiEndpoint       string   `json:"MsiEndpoint"`
		UseMsi            bool     `json:"UseMsi"`
		DisablePartnerID  bool     `json:"DisablePartnerId"`
		MetaHost          string   `json:"MetaHost"`
		PartnerID         string   `json:"PartnerId"`
		SkipProviderReg   bool     `json:"SkipProviderReg"`
		StorageUseAzureAd bool     `json:"StorageUseAzureAd"`
	} `json:"Azure"`
}

AzProv is populated using JSON unmarshalling to creat a struct that can be used to populate provider fields for Microsoft Azure Optionally other methods other than a file can be used in order to populate the struct but function ReadFile is also available for this purpose

func ReadFile

func ReadFile(path string) (*AzProv, error)

ReadFile Function readFile reads the JSON file provided from struct files for provider creation Takes one argument which is a string in order to read the file and then Unmarshal the JSON This is backwards compatible with older versions of GO

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL