support for defualt configs, index aws instances

This commit is contained in:
schulze
2023-03-22 14:01:08 +01:00
parent 5d7c5b3d26
commit 81dbb99017
3 changed files with 94 additions and 20 deletions

View File

@ -31,8 +31,13 @@ func NewConfig(region string, credentials string) aws.Config {
return cfg
}
// IndexInstances scans all configured regions for instances and add them to services
func IndexInstances(config state.Config) []AwsInstance {
// GetCloudID returns a string to find the instance based on information from aws
func GetCloudID(instance AwsInstance) string {
return "aws_" + instance.Region + "_" + instance.InstanceID
}
// GetInstances scans all configured regions for instances and add them to services
func GetInstances(config state.Config) []AwsInstance {
awsInstances := []AwsInstance{}
for _, region := range config.AWS.Regions {
awsConfig := NewConfig(region, config.AWS.CredentialsPath)