Documentation ¶
Index ¶
- Constants
- Variables
- func AlphanumericFormatFunc(s string) string
- func CheckIfSizeIsValid(size string) error
- func GetAvailabilityZone(location string, az int, cloud CloudProvider) string
- func GetCloudLocation(location string, provider CloudProvider) (string, error)
- func GetLocationFromCloudLocation(location string, cloud CloudProvider) string
- func GetResourceTypeAbbreviation(t string) string
- func LowercaseAlphanumericFormatFunc(s string) string
- func RandomString(n int) string
- func RemoveSpecialChars(a string) string
- func StringInSlice(a string, list []string) bool
- func UniqueId(prefix string, suffix string, formatFunc FormatFunc) string
- func ValidateVmSize(s string) bool
- type AwsResource
- type AzResource
- type CloudProvider
- type FormatFunc
Constants ¶
View Source
const ( IRELAND = "ireland" UK = "uk" USEAST = "us_east" )
View Source
const ( // MICRO - 1 core and 0.5 gb ram MICRO = "nano" // MEDIUM - 2 cores and 4 gb ram MEDIUM = "medium" )
Variables ¶
View Source
var AMIMAP = map[string]string{
"eu-west-1": "ami-09d4a659cdd8677be",
"us-east-1": "ami-04ad2567c9e3d7893",
}
eu-west-2 "ami-0fc15d50d39e4503c" amzn2-ami-hvm-2.0.20211103.0-x86_64-gp2 https://cloud-images.ubuntu.com/locator/ec2/
View Source
var AVAILABILITY_ZONES = map[string]map[CloudProvider][]string{ UK: { AWS: []string{"eu-west-2a", "eu-west-2b", "eu-west-2c"}, AZURE: []string{"1", "2", "3"}, }, IRELAND: { AWS: []string{"eu-west-1a", "eu-west-1b", "eu-west-1c"}, AZURE: []string{"1", "2", "3"}, }, USEAST: { AWS: []string{"us-east-1a", "us-east-1b", "us-east-1c"}, AZURE: []string{"1", "2", "3"}, }, }
View Source
var DBSIZE = map[string]map[CloudProvider]string{ MICRO: { AWS: "db.t2.micro", AZURE: "GP_Gen5_2", }, }
View Source
var LOCATION = map[string]map[CloudProvider]string{ UK: { AWS: "eu-west-2", AZURE: "ukwest", }, IRELAND: { AWS: "eu-west-1", AZURE: "northeurope", }, USEAST: { AWS: "us-east-1", AZURE: "eastus", }, }
View Source
var RESOURCETYPES = map[string]string{
"virtual_network": "vn",
"subnet": "vn",
"route_table": "vn",
"database": "db",
"virtual_machine": "vm",
"network_security_group": "nsg",
"object_storage": "st",
"object_storage_object": "st",
"public_ip": "pip",
"network_interface": "nic",
"vault": "kv",
"vault_secret": "kv",
"vault_access_policy": "kv",
"lambda": "fun",
"kubernetes_service": "ks",
"kubernetes_node_pool": "ks",
}
View Source
var VMSIZE = map[string]map[CloudProvider]string{
MICRO: {
AWS: "t2.nano",
AZURE: "Standard_B1ls",
},
MEDIUM: {
AWS: "t2.medium",
AZURE: "Standard_A2_v2",
},
}
Functions ¶
func AlphanumericFormatFunc ¶
func CheckIfSizeIsValid ¶
func GetAvailabilityZone ¶
func GetAvailabilityZone(location string, az int, cloud CloudProvider) string
func GetCloudLocation ¶
func GetCloudLocation(location string, provider CloudProvider) (string, error)
func GetLocationFromCloudLocation ¶ added in v0.1.13
func GetLocationFromCloudLocation(location string, cloud CloudProvider) string
GetLocationFromCloudLocation get multy location from cloud specific location (eu-west-1 -> ireland)
func RandomString ¶
func RemoveSpecialChars ¶
func StringInSlice ¶
func UniqueId ¶
func UniqueId(prefix string, suffix string, formatFunc FormatFunc) string
UniqueId generates a stable string composed of prefix+suffix and a 4 char hash. Prefix can be any size but will be sliced if bigger than 16 chars. Suffix can have 4 chars at most. Returns a string with at most 24 chars.
func ValidateVmSize ¶
Types ¶
type AwsResource ¶
type AwsResource struct { output.TerraformResource `hcl:",squash"` Tags map[string]string `hcl:"tags" hcle:"omitempty"` }
func NewAwsResource ¶
func NewAwsResource(resourceId string, name string) *AwsResource
func NewAwsResourceWithIdOnly ¶
func NewAwsResourceWithIdOnly(resourceId string) *AwsResource
func (*AwsResource) SetName ¶
func (r *AwsResource) SetName(name string)
type AzResource ¶
type AzResource struct { output.TerraformResource `hcl:",squash"` ResourceGroupName string `hcl:"resource_group_name,expr" hcle:"omitempty"` Name string `hcl:"name" hcle:"omitempty"` Location string `hcl:"location" hcle:"omitempty"` }
func NewAzResource ¶
func NewAzResource(resourceId string, name string, rgName string, location string) *AzResource
func (*AzResource) SetName ¶
func (r *AzResource) SetName(name string)
type CloudProvider ¶
type CloudProvider string
const ( AWS CloudProvider = "aws" AZURE = "azure" )
func AsCloudProvider ¶
func AsCloudProvider(s string) (CloudProvider, bool)
func GetAllCloudProviders ¶
func GetAllCloudProviders() []CloudProvider
type FormatFunc ¶
Click to show internal directories.
Click to hide internal directories.