diff --git a/internal/providers/akamai/akamai.go b/internal/providers/akamai/akamai.go index f316ded78..73fecaa20 100644 --- a/internal/providers/akamai/akamai.go +++ b/internal/providers/akamai/akamai.go @@ -18,6 +18,7 @@ package akamai import ( "encoding/base64" + "errors" "fmt" "net/http" "net/url" @@ -44,7 +45,15 @@ var ( ) func fetchConfig(f *resource.Fetcher) (types.Config, report.Report, error) { - encoded, err := f.FetchToBuffer(userdataURL, resource.FetchOptions{}) + if f.AkamaiMetadataToken == "" { + return types.Config{}, report.Report{}, errors.New("akamai metadata token not set") + } + + encoded, err := f.FetchToBuffer(userdataURL, resource.FetchOptions{ + Headers: http.Header{ + "Metadata-Token": []string{f.AkamaiMetadataToken}, + }, + }) if err != nil { return types.Config{}, report.Report{}, err }