Documentation ¶
Index ¶
- Constants
- Variables
- func AlphanumericFormatFunc(s string) string
- func GetAvailabilityZone(location commonpb.Location, az int, cloud commonpb.CloudProvider) (string, error)
- func GetCloudLocation(location commonpb.Location, provider commonpb.CloudProvider) (string, error)
- 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
- type AwsResource
- type AzResource
- type FormatFunc
Constants ¶
View Source
const ( AWS = commonpb.CloudProvider_AWS AZURE = commonpb.CloudProvider_AZURE )
View Source
const ( // MICRO - 1 core and 0.5 gb ram MICRO = "nano" // MEDIUM - 2 cores and 4 gb ram MEDIUM = "medium" // LARGE - 2 cores and 8 gb ram LARGE = "large" )
Variables ¶
View Source
var AMIMAP = map[string]string{
"eu-west-1": "ami-09d4a659cdd8677be",
"eu-west-2": "ami-0fc15d50d39e4503c",
"eu-west-3": "ami-0fc15d50d39e4503c",
"us-east-1": "ami-04ad2567c9e3d7893",
"us-east-2": "ami-04ad2567c9e3d7893",
"us-west-1": "ami-04ad2567c9e3d7893",
"us-west-2": "ami-04ad2567c9e3d7893",
"eu-north-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[commonpb.Location]map[commonpb.CloudProvider][]string{ commonpb.Location_EU_WEST_1: { AWS: []string{"eu-west-1a", "eu-west-1b", "eu-west-1c"}, AZURE: []string{"1", "2", "3"}, }, commonpb.Location_EU_WEST_2: { AWS: []string{"eu-west-2a", "eu-west-2b", "eu-west-2c"}, AZURE: []string{"1", "2", "3"}, }, commonpb.Location_EU_WEST_3: { AWS: []string{"eu-west-3a", "eu-west-3b", "eu-west-3c"}, AZURE: []string{"1", "2", "3"}, }, commonpb.Location_US_EAST_1: { AWS: []string{"us-east-1a", "us-east-1b", "us-east-1c"}, AZURE: []string{"1", "2", "3"}, }, commonpb.Location_US_EAST_2: { AWS: []string{"us-east-2a", "us-east-2b", "us-east-2c"}, AZURE: []string{"1", "2", "3"}, }, commonpb.Location_US_WEST_1: { AWS: []string{"us-west-1a", "us-west-1c"}, AZURE: []string{"1", "2"}, }, commonpb.Location_US_WEST_2: { AWS: []string{"us-west-2a", "us-west-2b", "us-west-2c", "us-west-2d"}, AZURE: []string{"1", "2", "3"}, }, commonpb.Location_EU_NORTH_1: { AWS: []string{"eu-north-1a", "eu-north-1b", "eu-north-1c"}, AZURE: []string{"1", "2", "3"}, }, }
View Source
var AwsAmiOwners = map[resourcespb.ImageReference_OperatingSystemDistribution]string{ resourcespb.ImageReference_UBUNTU: "099720109477", resourcespb.ImageReference_CENT_OS: "125523088429", resourcespb.ImageReference_DEBIAN: "136693071363", }
View Source
var DBSIZE = map[commonpb.DatabaseSize_Enum]map[commonpb.CloudProvider]string{ commonpb.DatabaseSize_MICRO: { commonpb.CloudProvider_AWS: "db.t2.micro", commonpb.CloudProvider_AZURE: "GP_Gen5_2", }, commonpb.DatabaseSize_SMALL: { commonpb.CloudProvider_AWS: "db.t2.small", commonpb.CloudProvider_AZURE: "GP_Gen5_4", }, commonpb.DatabaseSize_MEDIUM: { commonpb.CloudProvider_AWS: "db.t2.medium", commonpb.CloudProvider_AZURE: "GP_Gen5_6", }, }
View Source
var LOCATION = map[commonpb.Location]map[commonpb.CloudProvider]string{ commonpb.Location_EU_WEST_1: { AWS: "eu-west-1", AZURE: "northeurope", }, commonpb.Location_EU_WEST_2: { AWS: "eu-west-2", AZURE: "uksouth", }, commonpb.Location_EU_WEST_3: { AWS: "eu-west-3", AZURE: "francecentral", }, commonpb.Location_US_EAST_1: { AWS: "us-east-1", AZURE: "eastus", }, commonpb.Location_US_EAST_2: { AWS: "us-east-2", AZURE: "eastus2", }, commonpb.Location_US_WEST_1: { AWS: "us-west-1", AZURE: "westus2", }, commonpb.Location_US_WEST_2: { AWS: "us-west-2", AZURE: "westus3", }, commonpb.Location_EU_NORTH_1: { AWS: "eu-north-1", AZURE: "swedencentral", }, }
View Source
var VMSIZE = map[commonpb.VmSize_Enum]map[commonpb.CloudProvider]string{ commonpb.VmSize_GENERAL_NANO: { commonpb.CloudProvider_AWS: "t2.nano", commonpb.CloudProvider_AZURE: "Standard_B1ls", }, commonpb.VmSize_GENERAL_MICRO: { commonpb.CloudProvider_AWS: "t2.micro", commonpb.CloudProvider_AZURE: "Standard_B1s", }, commonpb.VmSize_GENERAL_SMALL: { commonpb.CloudProvider_AWS: "t2.small", commonpb.CloudProvider_AZURE: "Standard_B1ms", }, commonpb.VmSize_GENERAL_MEDIUM: { commonpb.CloudProvider_AWS: "t2.medium", commonpb.CloudProvider_AZURE: "Standard_B2s", }, commonpb.VmSize_GENERAL_LARGE: { commonpb.CloudProvider_AWS: "t2.large", commonpb.CloudProvider_AZURE: "Standard_B2ms", }, commonpb.VmSize_GENERAL_XLARGE: { commonpb.CloudProvider_AWS: "t2.xlarge", commonpb.CloudProvider_AZURE: "Standard_B4ms", }, commonpb.VmSize_GENERAL_2XLARGE: { commonpb.CloudProvider_AWS: "t2.2xlarge", commonpb.CloudProvider_AZURE: "Standard_B8ms", }, commonpb.VmSize_COMPUTE_LARGE: { commonpb.CloudProvider_AWS: "c4.large", commonpb.CloudProvider_AZURE: "Standard_F2s_v2", }, commonpb.VmSize_COMPUTE_XLARGE: { commonpb.CloudProvider_AWS: "c4.xlarge", commonpb.CloudProvider_AZURE: "Standard_F4s_v2", }, commonpb.VmSize_COMPUTE_2XLARGE: { commonpb.CloudProvider_AWS: "c4.2xlarge", commonpb.CloudProvider_AZURE: "Standard_F8s_v2", }, commonpb.VmSize_COMPUTE_4XLARGE: { commonpb.CloudProvider_AWS: "c4.4xlarge", commonpb.CloudProvider_AZURE: "Standard_F16s_v2", }, commonpb.VmSize_COMPUTE_8XLARGE: { commonpb.CloudProvider_AWS: "c4.8xlarge", commonpb.CloudProvider_AZURE: "Standard_F48s_v2", }, commonpb.VmSize_MEMORY_MEDIUM: { commonpb.CloudProvider_AWS: "r6g.medium", commonpb.CloudProvider_AZURE: "Standard_B2ms", }, commonpb.VmSize_MEMORY_LARGE: { commonpb.CloudProvider_AWS: "r6g.large", commonpb.CloudProvider_AZURE: "Standard_E2s_v3", }, commonpb.VmSize_MEMORY_XLARGE: { commonpb.CloudProvider_AWS: "r6g.xlarge", commonpb.CloudProvider_AZURE: "Standard_E4s_v3", }, commonpb.VmSize_MEMORY_2XLARGE: { commonpb.CloudProvider_AWS: "r6g.2xlarge", commonpb.CloudProvider_AZURE: "Standard_E8s_v3", }, commonpb.VmSize_MEMORY_4XLARGE: { commonpb.CloudProvider_AWS: "r6g.4xlarge", commonpb.CloudProvider_AZURE: "Standard_E16s_v3", }, commonpb.VmSize_MEMORY_8XLARGE: { commonpb.CloudProvider_AWS: "r6g.8xlarge", commonpb.CloudProvider_AZURE: "Standard_E32s_v3", }, commonpb.VmSize_MEMORY_12XLARGE: { commonpb.CloudProvider_AWS: "r6g.12xlarge", commonpb.CloudProvider_AZURE: "Standard_E48s_v3", }, commonpb.VmSize_MEMORY_16XLARGE: { commonpb.CloudProvider_AWS: "r6g.16xlarge", commonpb.CloudProvider_AZURE: "Standard_E64a_v4", }, }
Functions ¶
func AlphanumericFormatFunc ¶
func GetAvailabilityZone ¶
func GetCloudLocation ¶
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.
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 NewAwsResourceWithDeps ¶ added in v0.1.38
func NewAwsResourceWithDeps(resourceId string, name string, deps []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 FormatFunc ¶
Click to show internal directories.
Click to hide internal directories.