diff --git a/providers/aws/connection/awsec2ebsconn/provider.go b/providers/aws/connection/awsec2ebsconn/provider.go index fe3f1e9877..91b7a9d579 100644 --- a/providers/aws/connection/awsec2ebsconn/provider.go +++ b/providers/aws/connection/awsec2ebsconn/provider.go @@ -322,16 +322,16 @@ func NewInstanceId(account string, region string, id string) (*awsec2ebstypes.In func ParseInstanceId(path string) (*awsec2ebstypes.InstanceId, error) { if !IsValidInstanceId(path) { - return nil, errors.New("invalid instance id. expected account//region//instance/") + return nil, errors.New("invalid instance id. expected account//region//instances/") } keyValues := strings.Split(path, "/") if len(keyValues) != 6 { - return nil, errors.New("invalid instance id. expected account//region//instance/") + return nil, errors.New("invalid instance id. expected account//region//instances/") } return NewInstanceId(keyValues[1], keyValues[3], keyValues[5]) } -var VALID_INSTANCE_ID = regexp.MustCompile(`^account/\d{12}/region\/(us(-gov)?|ap|ca|cn|eu|sa)-(central|(north|south)?(east|west)?)-\d\/instance\/.+$`) +var VALID_INSTANCE_ID = regexp.MustCompile(`^account/\d{12}/region\/(us(-gov)?|ap|ca|cn|eu|sa)-(central|(north|south)?(east|west)?)-\d\/instances\/.+$`) func IsValidInstanceId(path string) bool { return VALID_INSTANCE_ID.MatchString(path) diff --git a/providers/aws/connection/awsec2ebsconn/types/types.go b/providers/aws/connection/awsec2ebsconn/types/types.go index 7c45302e37..9d0558a75d 100644 --- a/providers/aws/connection/awsec2ebsconn/types/types.go +++ b/providers/aws/connection/awsec2ebsconn/types/types.go @@ -49,6 +49,6 @@ type VolumeInfo struct { } func (s *InstanceId) String() string { - // e.g. account/999000999000/region/us-east-2/instance/i-0989478343232 - return path.Join("account", s.Account, "region", s.Region, "instance", s.Id) + // e.g. account/999000999000/region/us-east-2/instances/i-0989478343232 + return path.Join("account", s.Account, "region", s.Region, "instances", s.Id) } diff --git a/providers/aws/connection/awsec2ebsconn/types_test.go b/providers/aws/connection/awsec2ebsconn/types_test.go index bfae1c9075..8693169fb1 100644 --- a/providers/aws/connection/awsec2ebsconn/types_test.go +++ b/providers/aws/connection/awsec2ebsconn/types_test.go @@ -11,7 +11,7 @@ import ( ) func TestParseInstanceId(t *testing.T) { - path := "account/185972265011/region/us-east-1/instance/i-07f67838ada5879af" + path := "account/185972265011/region/us-east-1/instances/i-07f67838ada5879af" id, err := ParseInstanceId(path) require.NoError(t, err) assert.Equal(t, id.Account, "185972265011")