tfutils

package
v0.3.0-beta1 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2025 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SubaccountLevel   = "subaccountLevel"
	DirectoryLevel    = "directoryLevel"
	OrganizationLevel = "organizationLevel"
	SpaceLevel        = "spaceLevel"
)
View Source
const (
	CmdDirectoryParameter           string = "directory"
	CmdSubaccountParameter          string = "subaccount"
	CmdEntitlementParameter         string = "entitlements"
	CmdEnvironmentInstanceParameter string = "environment-instances"
	CmdSubscriptionParameter        string = "subscriptions"
	CmdTrustConfigurationParameter  string = "trust-configurations"
	CmdRoleParameter                string = "roles"
	CmdRoleCollectionParameter      string = "role-collections"
	CmdServiceInstanceParameter     string = "service-instances"
	CmdServiceBindingParameter      string = "service-bindings"
	CmdSecuritySettingParameter     string = "security-settings"
	CmdCfSpaceParameter             string = "spaces"
	CmdCfUserParameter              string = "users"
	CmdCfDomainParamater            string = "domains"
	CmdCfOrgRoleParameter           string = "org-roles"
	CmdCfRouteParameter             string = "routes"
	CmdCfSpaceQuotaParameter        string = "space-quotas"
	CmdCfServiceInstanceParameter   string = "cf-service-instances"
	CmdCfSpaceRoleParameter         string = "space-roles"
)
View Source
const (
	SubaccountType                    string = "btp_subaccount"
	SubaccountEntitlementType         string = "btp_subaccount_entitlement"
	SubaccountEnvironmentInstanceType string = "btp_subaccount_environment_instance"
	SubaccountSubscriptionType        string = "btp_subaccount_subscription"
	SubaccountTrustConfigurationType  string = "btp_subaccount_trust_configuration"
	SubaccountRoleType                string = "btp_subaccount_role"
	SubaccountRoleCollectionType      string = "btp_subaccount_role_collection"
	SubaccountServiceInstanceType     string = "btp_subaccount_service_instance"
	SubaccountServiceBindingType      string = "btp_subaccount_service_binding"
	SubaccountSecuritySettingType     string = "btp_subaccount_security_setting"
)
View Source
const (
	DirectoryType               string = "btp_directory"
	DirectoryEntitlementType    string = "btp_directory_entitlement"
	DirectoryRoleType           string = "btp_directory_role"
	DirectoryRoleCollectionType string = "btp_directory_role_collection"
)
View Source
const (
	CfSpaceType           string = "cloudfoundry_space"
	CfUserType            string = "cloudfoundry_user"
	CfOrgRoleType         string = "cloudfoundry_org_role"
	CfDomainType          string = "cloudfoundry_domain"
	CfRouteType           string = "cloudfoundry_route"
	CfSpaceQuotaType      string = "cloudfoundry_space_quota"
	CfServiceInstanceType string = "cloudfoundry_service_instance"
	CfSpaceRoleType       string = "cloudfoundry_space_role"
)
View Source
const BtpProviderVersion = "v1.10.0"

Constants for TF version for Terraform providers

View Source
const CfProviderVersion = "v1.3.0"
View Source
const DirectoryFeatureDefault string = "DEFAULT"
View Source
const DirectoryFeatureEntitlements string = "ENTITLEMENTS"
View Source
const DirectoryFeatureRoles string = "AUTHORIZATIONS"

Variables

View Source
var TmpFolder string

Functions

func CleanupProviderConfig

func CleanupProviderConfig(directory ...string)

func CleanupTempFiles

func CleanupTempFiles(tempConfigDir string)

func ConfigureProvider

func ConfigureProvider(level string)

func ExecPostExportSteps

func ExecPostExportSteps(tempConfigDir string, targetConfigDir string, targetResourceFileName string, resourceNameLong string)

func ExecPreExportSteps

func ExecPreExportSteps(tempConfigDir string, level string)

Convenience functions that wrap repetitive steps

func FetchImportConfiguration

func FetchImportConfiguration(subaccountId string, directoryId string, organizationId string, spaceId string, resourceType string, tmpFolder string) (map[string]interface{}, error)

func FinalizeTfConfig

func FinalizeTfConfig(configFolder string)

func GenerateConfig

func GenerateConfig(resourceFileName string, configFolder string, isMainCmd bool, resourceNameLong string) error

func GetExecutionLevelAndId

func GetExecutionLevelAndId(subaccountID string, directoryID string, organizationID string, spaceID string) (level string, id string)

func GetResourcesList

func GetResourcesList(resourcesString string, level string) []string

func GetValidResourcesByLevel

func GetValidResourcesByLevel(level string) []string

func SetupConfigDir

func SetupConfigDir(configFolder string, isMainCmd bool, level string)

func TranslateResourceParamToTechnicalName

func TranslateResourceParamToTechnicalName(resource string, level string) string

Types

type BtpResource

type BtpResource struct {
	Name   string
	Values []string
}

type BtpResources

type BtpResources struct {
	BtpResources []BtpResource
}

func ReadDataSources

func ReadDataSources(subaccountId string, directoryId string, organizationId string, resourceList []string) (btpResources BtpResources, err error)

type DocKind

type DocKind string

DocKind indicates what kind of entity's documentation is being requested.

const DataSourcesKind DocKind = "data-sources"
const ResourcesKind DocKind = "resources"

type EntityDocs

type EntityDocs struct {
	// Description is the description of the resource
	Description string
	Arguments   map[string]*argumentDocs
	Attributes  map[string]string
	Import      string
}

EntityDocs represents the documentation for a resource or datasource as extracted from TF markdown.

func GetDocByResourceName

func GetDocByResourceName(kind DocKind, resourceName string, level string) (EntityDocs, error)

func GetDocsForResource

func GetDocsForResource(org string, provider string, resourcePrefix string, kind DocKind,
	rawname string, providerModuleVersion string,
	githost string) (EntityDocs, error)

GetDocsForResource extracts documentation details for the given package from TF website documentation markdown content

type ResourceMode

type ResourceMode string

type State

type State struct {
	// The version of the state format. This should always match the
	// StateFormatVersion constant in this package, or else am
	// unmarshal will be unstable.
	FormatVersion string `json:"format_version,omitempty"`

	// The Terraform version used to make the state.
	TerraformVersion string `json:"terraform_version,omitempty"`

	// The values that make up the state.
	Values *StateValues `json:"values,omitempty"`
}

type StateModule

type StateModule struct {
	// All resources or data sources within this module.
	Resources []*StateResource `json:"resources,omitempty"`

	// The absolute module address, omitted for the root module.
	Address string `json:"address,omitempty"`

	// Any child modules within this module.
	ChildModules []*StateModule `json:"child_modules,omitempty"`
}

type StateResource

type StateResource struct {
	// The absolute resource address.
	Address string `json:"address,omitempty"`

	// The resource mode.
	Mode ResourceMode `json:"mode,omitempty"`

	// The resource type, example: "aws_instance" for aws_instance.foo.
	Type string `json:"type,omitempty"`

	// The resource name, example: "foo" for aws_instance.foo.
	Name string `json:"name,omitempty"`

	// The instance key for any resources that have been created using
	// "count" or "for_each". If neither of these apply the key will be
	// empty.
	//
	// This value can be either an integer (int) or a string.
	Index interface{} `json:"index,omitempty"`

	// The name of the provider this resource belongs to. This allows
	// the provider to be interpreted unambiguously in the unusual
	// situation where a provider offers a resource type whose name
	// does not start with its own name, such as the "googlebeta"
	// provider offering "google_compute_instance".
	ProviderName string `json:"provider_name,omitempty"`

	// The version of the resource type schema the "values" property
	// conforms to.
	SchemaVersion uint64 `json:"schema_version,"`

	// The JSON representation of the attribute values of the resource,
	// whose structure depends on the resource type schema. Any unknown
	// values are omitted or set to null, making them indistinguishable
	// from absent values.
	AttributeValues map[string]interface{} `json:"values,omitempty"`

	// The JSON representation of the sensitivity of the resource's
	// attribute values. Only attributes which are sensitive
	// are included in this structure.
	SensitiveValues json.RawMessage `json:"sensitive_values,omitempty"`

	// The addresses of the resources that this resource depends on.
	DependsOn []string `json:"depends_on,omitempty"`

	// If true, the resource has been marked as tainted and will be
	// re-created on the next update.
	Tainted bool `json:"tainted,omitempty"`

	// DeposedKey is set if the resource instance has been marked Deposed and
	// will be destroyed on the next apply.
	DeposedKey string `json:"deposed_key,omitempty"`
}

type StateValues

type StateValues struct {
	// The root module in this state representation.
	RootModule *StateModule `json:"root_module,omitempty"`
}

Jump to

Keyboard shortcuts

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