Documentation ¶
Index ¶
- Constants
- Variables
- func AZUREPolicy(permissions []string, policyName string) (string, error)
- func AlmostEqual(a, b float64) bool
- func Apply(target string, region string) error
- func AwsDataLookup(find string) interface{}
- func AwsLookup(name string) interface{}
- func AzureDataLookup(name string) interface{}
- func AzureLookup(name string) interface{}
- func Compare(directory string, arn string, init bool) (bool, error)
- func CompareIAMPolicy(policy string, oldPolicy string) (bool, error)
- func Contains(s []string, e string) bool
- func EncryptPlaintext(plaintext string, publicKeyB64 string) ([]byte, error)
- func FileExists(filename string) bool
- func GCPDataLookup(result string) interface{}
- func GCPLookup(result string) interface{}
- func GCPPolicy(permissions []string) (policy string, err error)
- func GetAWSDataPermissions(result ResourceV2) ([]string, error)
- func GetAWSPermissions(result ResourceV2) ([]string, error)
- func GetAWSResourcePermissions(result ResourceV2) ([]string, error)
- func GetAZUREDataPermissions(result ResourceV2) ([]string, error)
- func GetAZUREPermissions(result ResourceV2) ([]string, error)
- func GetAZUREResourcePermissions(result ResourceV2) ([]string, error)
- func GetBlockAttributes(attributes []string, block *hclsyntax.Block) []string
- func GetGCPDataPermissions(result ResourceV2) ([]string, error)
- func GetGithubClient() (context.Context, *github.Client)
- func GetHCLType(resourceName string) string
- func GetModulePath(block *hclsyntax.Block) string
- func GetPermissionMap(raw []byte, attributes []string, resource string) ([]string, error)
- func GetPolicyVersion(client *iam.Client, policyArn string, version string) (*string, error)
- func GetPublicKeyDetails(owner string, repository string) (string, string, error)
- func GetResourceBlocks(file string) (*hclsyntax.Body, error)
- func GetTF(dirName string) ([]string, error)
- func GetTFFiles(dirName string) ([]string, error)
- func GetVersion(client *iam.Client, policyArn string) (*string, error)
- func Init(dirName string) (*string, []string, error)
- func InvokeGithubDispatchEvent(repository string, workflowFileName string, branch string) error
- func IsTypeOK(mappings interface{}) (map[string]interface{}, error)
- func LocateTerraform() (string, error)
- func Make(directory string) (*string, error)
- func RandSeq(n int) string
- func Readme(dirName string, output string, init bool, autoAppend bool) error
- func Remote(target string, repository string, region string) error
- func ReplaceSection(source string, middle string, autoadd bool) error
- func Repository(repository, destination, directory, output string, ...) error
- func Scan(dirName string, output string, file *string, init bool, write bool, ...) error
- func SetRepoSecret(repository string, keyText string, keyName string) (*github.Response, error)
- func ShowDifferences(policy string, compare diff.Diff) (bool, error)
- func SortActions(myPolicy string) (*string, error)
- func SplitHub(repository string) (string, string, error)
- func StringInSlice(a string, list []string) bool
- func Unique(s []string) []string
- func VerifyBranch(client *github.Client, owner string, repo string, branch string) error
- func VerifyURL(url string) error
- func WaitForPolicyChange(client *iam.Client, arn string, version string, wait, pollInterval int) (int, error)
- func Watch(arn string, wait int) error
- func WriteOutput(outPolicy OutputPolicy, output, location string) error
- type AwsOutput
- type OutputPolicy
- type Policy
- type PolicyDiff
- type ResourceV2
- type Sorted
- type Statement
Constants ¶
const ( DefaultPolicyName = "terraform_pike" DefaultProject = "pike" DefaultRoleID = "terraform_pike" )
const Allow = "Allow"
const PollIntervalSeconds int = 5
const Version = "9.9.9"
Version controls the applications version
Variables ¶
var AWSAcmCertificate []byte
var GoogleSpannerDatabase []byte
var GoogleSpannerDatabaseIam []byte
var GoogleSpannerInstance []byte
var GoogleSpannerInstanceIam []byte
Functions ¶
func AZUREPolicy ¶
AZUREPolicy creates an Azure role definition. permissions: slice of Azure permission strings in format "action:resource" Returns the policy definition as a string or an error if generation fails.
func AlmostEqual ¶ added in v0.2.96
func AwsDataLookup ¶ added in v0.2.113
func AwsDataLookup(find string) interface{}
AwsDataLookup is a map to connect resource name to an object map
func AzureDataLookup ¶ added in v0.2.94
func AzureDataLookup(name string) interface{}
func AzureLookup ¶ added in v0.2.94
func AzureLookup(name string) interface{}
func CompareIAMPolicy ¶
CompareIAMPolicy takes two IAM policies and compares.
func EncryptPlaintext ¶ added in v0.2.76
EncryptPlaintext standard encryption.
func FileExists ¶ added in v0.2.76
FileExists looks for a file.
func GCPDataLookup ¶ added in v0.2.94
func GCPDataLookup(result string) interface{}
func GetAWSDataPermissions ¶
func GetAWSDataPermissions(result ResourceV2) ([]string, error)
GetAWSDataPermissions gets permissions required for datasource's.
func GetAWSPermissions ¶
func GetAWSPermissions(result ResourceV2) ([]string, error)
GetAWSPermissions for AWS resources.
func GetAWSResourcePermissions ¶
func GetAWSResourcePermissions(result ResourceV2) ([]string, error)
GetAWSResourcePermissions looks up permissions required for resources
func GetAZUREDataPermissions ¶
func GetAZUREDataPermissions(result ResourceV2) ([]string, error)
GetAZUREDataPermissions gets permissions required for datasources.
func GetAZUREPermissions ¶
func GetAZUREPermissions(result ResourceV2) ([]string, error)
GetAZUREPermissions for GCP resources.
func GetAZUREResourcePermissions ¶
func GetAZUREResourcePermissions(result ResourceV2) ([]string, error)
GetAZUREResourcePermissions looks up permissions required for resources.
func GetBlockAttributes ¶
GetBlockAttributes walks through a blocks getting all blocks and attributes.
func GetGCPDataPermissions ¶
func GetGCPDataPermissions(result ResourceV2) ([]string, error)
GetGCPDataPermissions gets permissions required for datasources.
func GetGithubClient ¶ added in v0.2.76
GetGithubClient instantiate and return a client object for GitHub.
func GetModulePath ¶
GetModulePath extracts the source location from a module.
func GetPermissionMap ¶
GetPermissionMap Anonymous parsing.
func GetPolicyVersion ¶
GetPolicyVersion Obtains the versioned IAM policy.
func GetPublicKeyDetails ¶ added in v0.2.76
GetPublicKeyDetails obtains the public key of the owner.
func GetResourceBlocks ¶
GetResourceBlocks breaks down a file into resources.
func GetTFFiles ¶ added in v0.2.76
GetTFFiles get tf files in directory.
func GetVersion ¶
GetVersion gets the version of the IAM policy.
func Init ¶
Init can download and install terraform if required and then terraform init your specified directory.
func InvokeGithubDispatchEvent ¶
InvokeGithubDispatchEvent uses your GitHub api key (if sufficiently enabled) to invoke a GitHub action workflow.
func LocateTerraform ¶
LocateTerraform finds the Terraform executable or installs it.
func ReplaceSection ¶
ReplaceSection find a section in a readme and replaces the section.
func Repository ¶ added in v0.2.108
func Scan ¶
func Scan(dirName string, output string, file *string, init bool, write bool, enableResources bool) error
Scan looks for resources in a given directory.
func SetRepoSecret ¶
SetRepoSecret sets an encrypted GitHub action secret.
func ShowDifferences ¶ added in v0.3.29
func SortActions ¶
SortActions sorts the actions list of an IAM policy.
func StringInSlice ¶ added in v0.2.76
StringInSlice looks for item in slice.
func VerifyBranch ¶ added in v0.2.48
VerifyBranch checks that a branch exists in a repo.
func WaitForPolicyChange ¶
func WaitForPolicyChange(client *iam.Client, arn string, version string, wait, pollInterval int) (int, error)
WaitForPolicyChange looks at IAM policy change.
func WriteOutput ¶
func WriteOutput(outPolicy OutputPolicy, output, location string) error
WriteOutput writes out the policy as json or terraform.
Types ¶
type OutputPolicy ¶
OutputPolicy is the main output type.
func GetPolicy ¶
func GetPolicy(actions Sorted, resources bool) (OutputPolicy, error)
GetPolicy creates new iam polices from a list of Permissions.
func MakePolicy ¶
func MakePolicy(dirName string, file *string, init bool, EnableResources bool) (OutputPolicy, error)
MakePolicy does the guts of determining a policy from code.
func (OutputPolicy) AsString ¶
func (out OutputPolicy) AsString(format string) string
AsString converts an object into string.
type PolicyDiff ¶ added in v0.3.18
func CompareAllow ¶ added in v0.3.18
type ResourceV2 ¶
type ResourceV2 struct { TypeName string Name string ResourceName string Provider string Attributes []string }
ResourceV2 is what resources get parsed into.
func DetectBackend ¶ added in v0.2.65
func DetectBackend(resource ResourceV2, block *hclsyntax.Block, resources []ResourceV2) ([]ResourceV2, error)
DetectBackend handles permissions for backend blocks.
func GetLocalModules ¶ added in v0.2.76
func GetLocalModules(block *hclsyntax.Block, dirName string) ([]ResourceV2, error)
GetLocalModules return resource from a path.
func GetResources ¶
func GetResources(file string, dirName string) ([]ResourceV2, error)
GetResources retrieves all the resources in a tf file.
type Sorted ¶
Sorted is to help split out permission to the relevant auth.
func GetPermission ¶
func GetPermission(result ResourceV2) (Sorted, error)
GetPermission determines the IAM permissions required and returns a list of permission.
Source Files ¶
- aws.go
- aws_datasource.go
- azure.go
- azure_datasource.go
- azure_policy.go
- compare.go
- credentials.go
- data.go
- error.go
- files.go
- files_azure.go
- files_azure_datasource.go
- files_datasource.go
- files_gcp.go
- files_gcp_datasource.go
- gcp.go
- gcp_datasource.go
- gcp_policy.go
- gitHub.go
- inspect.go
- make.go
- policy.go
- readme.go
- repository.go
- scan.go
- secrets.go
- types.go
- utils.go
- version.go
- watch.go