tfc

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Scrape

func Scrape(ctx context.Context) (*types.InventoryReport, error)

Types

type AWSAssetReference

type AWSAssetReference struct {
	// OrgName -> WorkspaceName -> RepoURL -> Repo
	ARN     arn.ARN `json:"arn"`
	TFEOrgs Orgs    `json:"orgs"`
}

type OrgAssets added in v0.22.0

type OrgAssets map[string]WorkspaceAssets

type Orgs

type Orgs map[string]Workspaces

type Repo

type Repo struct {
	WorkingDir []string `json:"working_dir"`
	Branch     []string `json:"branch"`
	Module     string   `json:"module"`
	Mode       string   `json:"mode"`
	Type       string   `json:"type"`
	Name       string   `json:"name"`
	Provider   string   `json:"provider"`
}

type SourceRepos

type SourceRepos map[string]*Repo

type TFEAssets

type TFEAssets struct {
	// contains filtered or unexported fields
}

func Setup

func Setup(ctx context.Context) (*TFEAssets, error)

Expects the following evn vars to be set: TFE_TOKEN=<secret> TFE_ADDRESS=https://<tfe-or-tfc-url>/

func (*TFEAssets) AllWorkspacesByOrg

func (c *TFEAssets) AllWorkspacesByOrg(ctx context.Context, orgs map[string]*tfe.Organization) (map[string][]*tfe.Workspace, error)

func (*TFEAssets) GetAllManagedAssets

func (c *TFEAssets) GetAllManagedAssets(orgWorkspaces map[string][]*tfe.Workspace) (WorkspaceAssets, map[string]OrgAssets, error)

func (*TFEAssets) GetAllOrgs

func (c *TFEAssets) GetAllOrgs(ctx context.Context) (map[string]*tfe.Organization, error)

func (*TFEAssets) GetAllWorkspaceStates

func (c *TFEAssets) GetAllWorkspaceStates(ctx context.Context, orgWorkspaces map[string][]*tfe.Workspace) (map[string]OrgAssets, error)

Returns a map of maps of maps; top level map is org name, second level map is workspace name, third level map is the resource

func (*TFEAssets) GetAllWorkspaces

func (c *TFEAssets) GetAllWorkspaces() (map[string][]*tfe.Workspace, error)

func (*TFEAssets) GetWorkspaceState

func (c *TFEAssets) GetWorkspaceState(ctx context.Context, workspace *tfe.Workspace) (WorkspaceAssets, int, error)

type TFEState

type TFEState struct {
	Resources []struct {
		Module    string `json:"module"`
		Mode      string `json:"mode"`
		Type      string `json:"type"`
		Name      string `json:"name"`
		Provider  string `json:"provider"`
		Instances []struct {
			Attributes struct {
				Arn string `json:"arn"`
			} `json:"attributes"`
		} `json:"instances"`
	} `json:"resources"`
}

type WorkspaceAssets added in v0.22.0

type WorkspaceAssets map[string]*AWSAssetReference

type Workspaces

type Workspaces map[string]SourceRepos

Jump to

Keyboard shortcuts

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