From 5b361ce42b85f42e8b7481e726fde701517cffa6 Mon Sep 17 00:00:00 2001 From: fujiwara Date: Sat, 15 Jun 2024 00:46:50 +0900 Subject: [PATCH 01/12] Introduce Jsonnet native functions. --- config.go | 7 + go.mod | 124 ++++++++------- go.sum | 273 +++++++++++++++++++--------------- jsonnet.go | 56 +++++++ plugin.go | 65 ++++++-- secretsmanager/export_test.go | 10 ++ secretsmanager/funcs.go | 78 ++++++++-- secretsmanager/funcs_test.go | 46 ++++++ ssm/export_test.go | 5 - ssm/funcs.go | 25 ---- ssm/lookup.go | 112 -------------- ssm/lookup_test.go | 107 ------------- 12 files changed, 456 insertions(+), 452 deletions(-) create mode 100644 jsonnet.go create mode 100644 secretsmanager/export_test.go create mode 100644 secretsmanager/funcs_test.go delete mode 100644 ssm/export_test.go delete mode 100644 ssm/funcs.go delete mode 100644 ssm/lookup.go delete mode 100644 ssm/lookup_test.go diff --git a/config.go b/config.go index f8e92c1e..f6ee85e0 100644 --- a/config.go +++ b/config.go @@ -38,6 +38,9 @@ func newConfigLoader(extStr, extCode map[string]string) *configLoader { for k, v := range extCode { vm.ExtCode(k, v) } + for _, f := range DefaultJsonnetNativeFuncs { + vm.NativeFunction(f) + } return &configLoader{ Loader: goConfig.New(), VM: vm, @@ -60,6 +63,7 @@ type Config struct { path string templateFuncs []template.FuncMap + jsonnetNativeFuncs []*jsonnet.NativeFunction dir string versionConstraints goVersion.Constraints awsv2Config aws.Config @@ -109,6 +113,9 @@ func (l *configLoader) Load(ctx context.Context, path string, version string) (* for _, f := range conf.templateFuncs { l.Funcs(f) } + for _, f := range conf.jsonnetNativeFuncs { + l.VM.NativeFunction(f) + } return conf, nil } diff --git a/go.mod b/go.mod index 9a6add80..3c71e99d 100644 --- a/go.mod +++ b/go.mod @@ -5,9 +5,9 @@ go 1.18 require ( github.com/Songmu/prompter v0.5.1 github.com/alecthomas/kong v0.8.1 - github.com/aws/aws-sdk-go-v2 v1.24.1 - github.com/aws/aws-sdk-go-v2/config v1.26.3 - github.com/aws/aws-sdk-go-v2/credentials v1.16.14 + github.com/aws/aws-sdk-go-v2 v1.27.2 + github.com/aws/aws-sdk-go-v2/config v1.27.18 + github.com/aws/aws-sdk-go-v2/credentials v1.17.18 github.com/aws/aws-sdk-go-v2/service/applicationautoscaling v1.25.4 github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs v1.31.0 github.com/aws/aws-sdk-go-v2/service/codedeploy v1.22.0 @@ -15,24 +15,25 @@ require ( github.com/aws/aws-sdk-go-v2/service/ecs v1.37.0 github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.26.4 github.com/aws/aws-sdk-go-v2/service/iam v1.28.4 - github.com/aws/aws-sdk-go-v2/service/s3 v1.47.4 + github.com/aws/aws-sdk-go-v2/service/s3 v1.55.1 github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.25.4 github.com/aws/aws-sdk-go-v2/service/servicediscovery v1.27.4 github.com/aws/aws-sdk-go-v2/service/ssm v1.44.7 - github.com/aws/aws-sdk-go-v2/service/sts v1.26.7 - github.com/aws/smithy-go v1.19.0 + github.com/aws/aws-sdk-go-v2/service/sts v1.28.12 + github.com/aws/smithy-go v1.20.2 github.com/fatih/color v1.16.0 - github.com/fujiwara/cfn-lookup v1.0.0 + github.com/fujiwara/cfn-lookup v1.1.0 github.com/fujiwara/ecsta v0.4.5 github.com/fujiwara/logutils v1.1.2 - github.com/fujiwara/tfstate-lookup v1.1.6 + github.com/fujiwara/ssm-lookup v0.1.0 + github.com/fujiwara/tfstate-lookup v1.3.2 github.com/goccy/go-yaml v1.9.5 - github.com/google/go-cmp v0.5.9 - github.com/google/go-jsonnet v0.19.1 + github.com/google/go-cmp v0.6.0 + github.com/google/go-jsonnet v0.20.0 github.com/hashicorp/go-envparse v0.1.0 github.com/hashicorp/go-version v1.6.0 github.com/hexops/gotextdiff v1.0.3 - github.com/itchyny/gojq v0.12.11 + github.com/itchyny/gojq v0.12.16 github.com/kayac/go-config v0.6.0 github.com/kylelemons/godebug v1.1.0 github.com/mattn/go-isatty v0.0.20 @@ -41,18 +42,18 @@ require ( github.com/samber/lo v1.36.0 github.com/schollz/progressbar/v3 v3.13.1 github.com/shogo82148/go-retry v1.1.1 - golang.org/x/sys v0.18.0 + golang.org/x/sys v0.21.0 ) require ( - cloud.google.com/go v0.110.0 // indirect - cloud.google.com/go/compute v1.19.1 // indirect + cloud.google.com/go v0.112.0 // indirect + cloud.google.com/go/compute v1.23.3 // indirect cloud.google.com/go/compute/metadata v0.2.3 // indirect - cloud.google.com/go/iam v0.13.0 // indirect - cloud.google.com/go/storage v1.28.1 // indirect - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.1 // indirect - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.1 // indirect - github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect + cloud.google.com/go/iam v1.1.5 // indirect + cloud.google.com/go/storage v1.36.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.11.1 // indirect + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.6.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.8.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.3.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.1.0 // indirect github.com/Azure/go-autorest v14.2.0+incompatible // indirect @@ -62,67 +63,78 @@ require ( github.com/Azure/go-autorest/autorest/mocks v0.4.2 // indirect github.com/Azure/go-autorest/logger v0.2.1 // indirect github.com/Azure/go-autorest/tracing v0.6.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect github.com/BurntSushi/toml v1.2.0 // indirect github.com/Songmu/flextime v0.1.0 // indirect - github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.5.4 // indirect - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.11 // indirect - github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.15.6 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.10 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.10 // indirect - github.com/aws/aws-sdk-go-v2/internal/ini v1.7.2 // indirect - github.com/aws/aws-sdk-go-v2/internal/v4a v1.2.9 // indirect + github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.2 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.5 // indirect + github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.16.24 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.9 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.9 // indirect + github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 // indirect + github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.9 // indirect github.com/aws/aws-sdk-go-v2/service/cloudformation v1.42.3 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.4 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.2.9 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.10 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.16.9 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.11 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.11 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.9 // indirect github.com/aws/aws-sdk-go-v2/service/sns v1.26.7 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.18.6 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.21.6 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.20.11 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.24.5 // indirect github.com/creack/pty v1.1.20 // indirect github.com/dimchansky/utfbom v1.1.1 // indirect + github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fujiwara/tracer v1.0.2 // indirect + github.com/go-logr/logr v1.3.0 // indirect + github.com/go-logr/stdr v1.2.2 // indirect github.com/golang-jwt/jwt/v4 v4.5.0 // indirect - github.com/golang-jwt/jwt/v5 v5.0.0 // indirect + github.com/golang-jwt/jwt/v5 v5.2.1 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/google/go-querystring v1.1.0 // indirect - github.com/google/uuid v1.3.0 // indirect - github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect - github.com/googleapis/gax-go/v2 v2.7.1 // indirect + github.com/google/s2a-go v0.1.7 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect + github.com/googleapis/gax-go/v2 v2.12.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect - github.com/hashicorp/go-retryablehttp v0.7.1 // indirect - github.com/hashicorp/go-slug v0.10.0 // indirect - github.com/hashicorp/go-tfe v1.10.0 // indirect - github.com/hashicorp/jsonapi v0.0.0-20210826224640-ee7dae0fb22d // indirect - github.com/itchyny/timefmt-go v0.1.5 // indirect + github.com/hashicorp/go-retryablehttp v0.7.5 // indirect + github.com/hashicorp/go-slug v0.15.0 // indirect + github.com/hashicorp/go-tfe v1.56.0 // indirect + github.com/hashicorp/jsonapi v1.3.1 // indirect + github.com/itchyny/timefmt-go v0.1.6 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-runewidth v0.0.14 // indirect + github.com/mattn/go-runewidth v0.0.15 // indirect github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect - github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect + github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/rivo/uniseg v0.4.2 // indirect + github.com/rivo/uniseg v0.4.7 // indirect github.com/tkuchiki/go-timezone v0.2.2 // indirect github.com/tkuchiki/parsetime v0.3.0 // indirect go.opencensus.io v0.24.0 // indirect - golang.org/x/crypto v0.21.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 // indirect + go.opentelemetry.io/otel v1.21.0 // indirect + go.opentelemetry.io/otel/metric v1.21.0 // indirect + go.opentelemetry.io/otel/trace v1.21.0 // indirect + golang.org/x/crypto v0.24.0 // indirect golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17 // indirect - golang.org/x/net v0.23.0 // indirect - golang.org/x/oauth2 v0.7.0 // indirect - golang.org/x/term v0.18.0 // indirect - golang.org/x/text v0.14.0 // indirect - golang.org/x/time v0.0.0-20220722155302-e5dcc9cfc0b9 // indirect + golang.org/x/net v0.26.0 // indirect + golang.org/x/oauth2 v0.16.0 // indirect + golang.org/x/sync v0.7.0 // indirect + golang.org/x/term v0.21.0 // indirect + golang.org/x/text v0.16.0 // indirect + golang.org/x/time v0.5.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect - google.golang.org/api v0.114.0 // indirect - google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect - google.golang.org/grpc v1.56.3 // indirect + google.golang.org/api v0.155.0 // indirect + google.golang.org/appengine v1.6.8 // indirect + google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 // indirect + google.golang.org/grpc v1.62.1 // indirect google.golang.org/protobuf v1.33.0 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v2 v2.4.0 // indirect sigs.k8s.io/yaml v1.3.0 // indirect ) diff --git a/go.sum b/go.sum index cb9d5625..844bedc5 100644 --- a/go.sum +++ b/go.sum @@ -1,21 +1,20 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.110.0 h1:Zc8gqp3+a9/Eyph2KDmcGaPtbKRIoqq4YTlL4NMD0Ys= -cloud.google.com/go v0.110.0/go.mod h1:SJnCLqQ0FCFGSZMUNUf84MV3Aia54kn7pi8st7tMzaY= -cloud.google.com/go/compute v1.19.1 h1:am86mquDUgjGNWxiGn+5PGLbmgiWXlE/yNWpIpNvuXY= -cloud.google.com/go/compute v1.19.1/go.mod h1:6ylj3a05WF8leseCdIf77NK0g1ey+nj5IKd5/kvShxE= +cloud.google.com/go v0.112.0 h1:tpFCD7hpHFlQ8yPwT3x+QeXqc2T6+n6T+hmABHfDUSM= +cloud.google.com/go v0.112.0/go.mod h1:3jEEVwZ/MHU4djK5t5RHuKOA/GbLddgTdVubX1qnPD4= +cloud.google.com/go/compute v1.23.3 h1:6sVlXXBmbd7jNX0Ipq0trII3e4n1/MsADLK6a+aiVlk= +cloud.google.com/go/compute v1.23.3/go.mod h1:VCgBUoMnIVIR0CscqQiPJLAG25E3ZRZMzcFZeQ+h8CI= cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= -cloud.google.com/go/iam v0.13.0 h1:+CmB+K0J/33d0zSQ9SlFWUeCCEn5XJA0ZMZ3pHE9u8k= -cloud.google.com/go/iam v0.13.0/go.mod h1:ljOg+rcNfzZ5d6f1nAUJ8ZIxOaZUVoS14bKCtaLZ/D0= -cloud.google.com/go/longrunning v0.4.1 h1:v+yFJOfKC3yZdY6ZUI933pIYdhyhV8S3NpWrXWmg7jM= -cloud.google.com/go/storage v1.28.1 h1:F5QDG5ChchaAVQhINh24U99OWHURqrW8OmQcGKXcbgI= -cloud.google.com/go/storage v1.28.1/go.mod h1:Qnisd4CqDdo6BGs2AD5LLnEsmSQ80wQ5ogcBBKhU86Y= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.1 h1:/iHxaJhsFr0+xVFfbMr5vxz848jyiWuIEDhYq3y5odY= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.1 h1:LNHhpdK7hzUcx/k1LIcuh5k7k1LGIWLQfCjaneSj7Fc= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.1/go.mod h1:uE9zaUfEQT/nbQjVi2IblCG9iaLtZsuYZ8ne+PuQ02M= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= +cloud.google.com/go/iam v1.1.5 h1:1jTsCu4bcsNsE4iiqNT5SHwrDRCfRmIaaaVFhRveTJI= +cloud.google.com/go/iam v1.1.5/go.mod h1:rB6P/Ic3mykPbFio+vo7403drjlgvoWfYpJhMXEbzv8= +cloud.google.com/go/storage v1.36.0 h1:P0mOkAcaJxhCTvAkMhxMfrTKiNcub4YmmPBtlhAyTr8= +cloud.google.com/go/storage v1.36.0/go.mod h1:M6M/3V/D3KpzMTJyPOR/HU6n2Si5QdaXYEsng2xgOs8= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.11.1 h1:E+OJmp2tPvt1W+amx48v1eqbjDYsgN+RzP4q16yV5eM= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.11.1/go.mod h1:a6xsAQUZg+VsS3TJ05SRp524Hs4pZ/AeFSr5ENf0Yjo= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.6.0 h1:U2rTu3Ef+7w9FHKIAXM6ZyqF3UOWJZ12zIm8zECAFfg= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.6.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.8.0 h1:jBQA3cKT4L2rWMpgE7Yt3Hwh2aUj8KXjIGLxjHeYNNo= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.8.0/go.mod h1:4OG6tQ9EOP/MT0NMjDlRzWoVFxfu9rN9B2X+tlSVktg= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2 h1:mLY+pNLjCUeKhgnAJWAKhEUQM+RJQo2H1fuGSw1Ky1E= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0 h1:ECsQtyERDVz3NP3kvDOTLvbQhqWp/x9EsGKtb4ogUr8= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.3.0 h1:LcJtQjCXJUm1s7JpUHZvu+bpgURhCatxVNbGADXniX0= @@ -38,8 +37,8 @@ github.com/Azure/go-autorest/logger v0.2.1 h1:IG7i4p/mDa2Ce4TRyAO8IHnVhAVF3RFU+Z github.com/Azure/go-autorest/logger v0.2.1/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8= github.com/Azure/go-autorest/tracing v0.6.0 h1:TYi4+3m5t6K48TGI9AUdb+IzbnSxvnvUMfuitfgcfuo= github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= -github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1 h1:WpB/QDNLpMw72xHJc34BNNykqSOeEJDAWkhf0u12/Jk= -github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v1.2.0 h1:Rt8g24XnyGTyglgET/PRUNlrUeu9F5L+7FilkXfZgs0= github.com/BurntSushi/toml v1.2.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= @@ -52,32 +51,32 @@ github.com/alecthomas/kong v0.8.1 h1:acZdn3m4lLRobeh3Zi2S2EpnXTd1mOL6U7xVml+vfkY github.com/alecthomas/kong v0.8.1/go.mod h1:n1iCIO2xS46oE8ZfYCNDqdR0b0wZNrXAIAqro/2132U= github.com/alecthomas/repr v0.1.0 h1:ENn2e1+J3k09gyj2shc0dHr/yjaWSHRlrJ4DPMevDqE= github.com/aws/aws-sdk-go-v2 v1.16.15/go.mod h1:SwiyXi/1zTUZ6KIAmLK5V5ll8SiURNUYOqTerZPaF9k= -github.com/aws/aws-sdk-go-v2 v1.24.1 h1:xAojnj+ktS95YZlDf0zxWBkbFtymPeDP+rvUQIH3uAU= -github.com/aws/aws-sdk-go-v2 v1.24.1/go.mod h1:LNh45Br1YAkEKaAqvmE1m8FUx6a5b/V0oAKV7of29b4= -github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.5.4 h1:OCs21ST2LrepDfD3lwlQiOqIGp6JiEUqG84GzTDoyJs= -github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.5.4/go.mod h1:usURWEKSNNAcAZuzRn/9ZYPT8aZQkR7xcCtunK/LkJo= +github.com/aws/aws-sdk-go-v2 v1.27.2 h1:pLsTXqX93rimAOZG2FIYraDQstZaaGVVN4tNw65v0h8= +github.com/aws/aws-sdk-go-v2 v1.27.2/go.mod h1:ffIFB97e2yNsv4aTSGkqtHnppsIJzw7G7BReUZ3jCXM= +github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.2 h1:x6xsQXGSmW6frevwDA+vi/wqhp1ct18mVXYN08/93to= +github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.2/go.mod h1:lPprDr1e6cJdyYeGXnRaJoP4Md+cDBvi2eOj00BlGmg= github.com/aws/aws-sdk-go-v2/config v1.17.6/go.mod h1:CrxsoI/AcKUoWyL9Zo0YaDxRlBfSnDZKBYKDdkNYDQ0= -github.com/aws/aws-sdk-go-v2/config v1.26.3 h1:dKuc2jdp10y13dEEvPqWxqLoc0vF3Z9FC45MvuQSxOA= -github.com/aws/aws-sdk-go-v2/config v1.26.3/go.mod h1:Bxgi+DeeswYofcYO0XyGClwlrq3DZEXli0kLf4hkGA0= +github.com/aws/aws-sdk-go-v2/config v1.27.18 h1:wFvAnwOKKe7QAyIxziwSKjmer9JBMH1vzIL6W+fYuKk= +github.com/aws/aws-sdk-go-v2/config v1.27.18/go.mod h1:0xz6cgdX55+kmppvPm2IaKzIXOheGJhAufacPJaXZ7c= github.com/aws/aws-sdk-go-v2/credentials v1.12.19/go.mod h1:fRQMbLwSHPr0XRzuez6x7BX5+0nNQs5BzG+oR4bQKyY= -github.com/aws/aws-sdk-go-v2/credentials v1.16.14 h1:mMDTwwYO9A0/JbOCOG7EOZHtYM+o7OfGWfu0toa23VE= -github.com/aws/aws-sdk-go-v2/credentials v1.16.14/go.mod h1:cniAUh3ErQPHtCQGPT5ouvSAQ0od8caTO9OOuufZOAE= +github.com/aws/aws-sdk-go-v2/credentials v1.17.18 h1:D/ALDWqK4JdY3OFgA2thcPO1c9aYTT5STS/CvnkqY1c= +github.com/aws/aws-sdk-go-v2/credentials v1.17.18/go.mod h1:JuitCWq+F5QGUrmMPsk945rop6bB57jdscu+Glozdnc= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.16/go.mod h1:lnJ8tKos2s7JeBdLVFknwVSlQZAKzkgrFNQmUaTWwRQ= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.11 h1:c5I5iH+DZcH3xOIMlz3/tCKJDaHFwYEmxvlh2fAcFo8= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.11/go.mod h1:cRrYDYAMUohBJUtUnOhydaMHtiK/1NZ0Otc9lIb6O0Y= -github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.15.6 h1:y6QFni67bLmpq8O+bXQOB17awtNl8eeB4u20NfeQlpE= -github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.15.6/go.mod h1:FzN3TluFcECZhRe08kXuK+oOL4iL8Daoy5OS2Diu5eU= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.5 h1:dDgptDO9dxeFkXy+tEgVkzSClHZje/6JkPW5aZyEvrQ= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.5/go.mod h1:gjvE2KBUgUQhcv89jqxrIxH9GaKs1JbZzWejj/DaHGA= +github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.16.24 h1:FzNwpVTZDCvm597Ty6mGYvxTolyC1oup0waaKntZI4E= +github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.16.24/go.mod h1:wM9NElT/Wn6n3CT1eyVcXtfCy8lSVjjQXfdawQbSShc= github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.22/go.mod h1:/vNv5Al0bpiF8YdX2Ov6Xy05VTiXsql94yUqJMYaj0w= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.10 h1:vF+Zgd9s+H4vOXd5BMaPWykta2a6Ih0AKLq/X6NYKn4= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.10/go.mod h1:6BkRjejp/GR4411UGqkX8+wFMbFbqsUIimfK4XjOKR4= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.9 h1:cy8ahBJuhtM8GTTSyOkfy6WVPV1IE+SS5/wfXUYuulw= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.9/go.mod h1:CZBXGLaJnEZI6EVNcPd7a6B5IC5cA/GkRWtu9fp3S6Y= github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.16/go.mod h1:62dsXI0BqTIGomDl8Hpm33dv0OntGaVblri3ZRParVQ= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.10 h1:nYPe006ktcqUji8S2mqXf9c/7NdiKriOwMvWQHgYztw= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.10/go.mod h1:6UV4SZkVvmODfXKql4LCbaZUpF7HO2BX38FgBf9ZOLw= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.9 h1:A4SYk07ef04+vxZToz9LWvAXl9LW0NClpPpMsi31cz0= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.9/go.mod h1:5jJcHuwDagxN+ErjQ3PU3ocf6Ylc/p9x+BLO/+X4iXw= github.com/aws/aws-sdk-go-v2/internal/ini v1.3.23/go.mod h1:XtEkQMmxls+Tb5dZLmpa1QAk0OzSIFDAXanC9Jkf81E= -github.com/aws/aws-sdk-go-v2/internal/ini v1.7.2 h1:GrSw8s0Gs/5zZ0SX+gX4zQjRnRsMJDJ2sLur1gRBhEM= -github.com/aws/aws-sdk-go-v2/internal/ini v1.7.2/go.mod h1:6fQQgfuGmw8Al/3M2IgIllycxV7ZW7WCdVSqfBeUiCY= -github.com/aws/aws-sdk-go-v2/internal/v4a v1.2.9 h1:ugD6qzjYtB7zM5PN/ZIeaAIyefPaD82G8+SJopgvUpw= -github.com/aws/aws-sdk-go-v2/internal/v4a v1.2.9/go.mod h1:YD0aYBWCrPENpHolhKw2XDlTIWae2GKXT1T4o6N6hiM= +github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 h1:hT8rVHwugYE2lEfdFE0QWVo81lF7jMrYJVDWI+f+VxU= +github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0/go.mod h1:8tu/lYfQfFe6IGnaOdrpVgEL2IrrDOf6/m9RQum4NkY= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.9 h1:vHyZxoLVOgrI8GqX7OMHLXp4YYoxeEsrjweXKpye+ds= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.9/go.mod h1:z9VXZsWA2BvZNH1dT0ToUYwMu/CR9Skkj/TBX+mceZw= github.com/aws/aws-sdk-go-v2/service/applicationautoscaling v1.25.4 h1:XS9S5KjanEuZYt47KV568u4cYxqCaMI5q1v/+f6RoU0= github.com/aws/aws-sdk-go-v2/service/applicationautoscaling v1.25.4/go.mod h1:GeIiZrYejOpIuMAV4acj3l4arHHaA64VO3aUmkrjH+w= github.com/aws/aws-sdk-go-v2/service/cloudformation v1.22.9/go.mod h1:T3k87PNi5z7Aus/enP5W8LZgy/oAyFuEGBovJWJ2CSk= @@ -95,17 +94,17 @@ github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.26.4 h1:bSjDWRQTc github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.26.4/go.mod h1:Tpt4kC8x1HfYuh2rG/6yXZrxjABETERrUl9IdA/IS98= github.com/aws/aws-sdk-go-v2/service/iam v1.28.4 h1:EyQh7g++21hhuILNnA+SaCd0632VRnbrFYpA6zGQmFA= github.com/aws/aws-sdk-go-v2/service/iam v1.28.4/go.mod h1:kKI0gdVsf+Ev9knh/3lBJbchtX5LLNH25lAzx3KDj3Q= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.4 h1:/b31bi3YVNlkzkBrm9LfpaKoaYZUxIAj4sHfOTmLfqw= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.4/go.mod h1:2aGXHFmbInwgP9ZfpmdIfOELL79zhdNYNmReK8qDfdQ= -github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.2.9 h1:/90OR2XbSYfXucBMJ4U14wrjlfleq/0SB6dZDPncgmo= -github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.2.9/go.mod h1:dN/Of9/fNZet7UrQQ6kTDo/VSwKPIq94vjlU16bRARc= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2 h1:Ji0DY1xUsUr3I8cHps0G+XM3WWU16lP6yG8qu1GAZAs= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2/go.mod h1:5CsjAbs3NlGQyZNFACh+zztPDI7fU6eW9QsxjfnuBKg= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.11 h1:4vt9Sspk59EZyHCAEMaktHKiq0C09noRTQorXD/qV+s= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.11/go.mod h1:5jHR79Tv+Ccq6rwYh+W7Nptmw++WiFafMfR42XhwNl8= github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.16/go.mod h1:faBcf/4ZB4FRc17geaXWOxgzktotyJgBcUBZoHqvdfM= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.10 h1:DBYTXwIGQSGs9w4jKm60F5dmCQ3EEruxdc0MFh+3EY4= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.10/go.mod h1:wohMUQiFdzo0NtxbBg0mSRGZ4vL3n0dKjLTINdcIino= -github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.16.9 h1:iEAeF6YC3l4FzlJPP9H3Ko1TXpdjdqWffxXjp8SY6uk= -github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.16.9/go.mod h1:kjsXoK23q9Z/tLBrckZLLyvjhZoS+AGrzqzUfEClvMM= -github.com/aws/aws-sdk-go-v2/service/s3 v1.47.4 h1:iEkLh6fe2ATtH5PGynlJ1SdnbZuZgoWLdvSedjwmqKk= -github.com/aws/aws-sdk-go-v2/service/s3 v1.47.4/go.mod h1:vADO6Jn+Rq4nDtfwNjhgR84qkZwiC6FqCaXdw/kYwjA= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.11 h1:o4T+fKxA3gTMcluBNZZXE9DNaMkJuUL1O3mffCUjoJo= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.11/go.mod h1:84oZdJ+VjuJKs9v1UTC9NaodRZRseOXCTgku+vQJWR8= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.9 h1:TE2i0A9ErH1YfRSvXfCr2SQwfnqsoJT9nPQ9kj0lkxM= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.9/go.mod h1:9TzXX3MehQNGPwCZ3ka4CpwQsoAMWSF48/b+De9rfVM= +github.com/aws/aws-sdk-go-v2/service/s3 v1.55.1 h1:UAxBuh0/8sFJk1qOkvOKewP5sWeWaTPDknbQz0ZkDm0= +github.com/aws/aws-sdk-go-v2/service/s3 v1.55.1/go.mod h1:hWjsYGjVuqCgfoveVcVFPXIWgz0aByzwaxKlN1StKcM= github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.25.4 h1:gsiwBC1ca43hCwyYilWEsC1y/NSkLj9fGyIV7pRt42U= github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.25.4/go.mod h1:4Ae1NCLK6ghmjzd45Tc33GgCKhUWD2ORAlULtMO1Cbs= github.com/aws/aws-sdk-go-v2/service/servicediscovery v1.27.4 h1:tYD+Csr6x4JxvcRrUVt2DniJsHTI1O0hD4UpbqfAh54= @@ -115,20 +114,21 @@ github.com/aws/aws-sdk-go-v2/service/sns v1.26.7/go.mod h1:mLFiISZfiZAqZEfPWUsZB github.com/aws/aws-sdk-go-v2/service/ssm v1.44.7 h1:a8HvP/+ew3tKwSXqL3BCSjiuicr+XTU2eFYeogV9GJE= github.com/aws/aws-sdk-go-v2/service/ssm v1.44.7/go.mod h1:Q7XIWsMo0JcMpI/6TGD6XXcXcV1DbTj6e9BKNntIMIM= github.com/aws/aws-sdk-go-v2/service/sso v1.11.22/go.mod h1:B2nDzX7lppT8j4EV2/WhT20SnRDp/LdNyqxyGYY46Ow= -github.com/aws/aws-sdk-go-v2/service/sso v1.18.6 h1:dGrs+Q/WzhsiUKh82SfTVN66QzyulXuMDTV/G8ZxOac= -github.com/aws/aws-sdk-go-v2/service/sso v1.18.6/go.mod h1:+mJNDdF+qiUlNKNC3fxn74WWNN+sOiGOEImje+3ScPM= +github.com/aws/aws-sdk-go-v2/service/sso v1.20.11 h1:gEYM2GSpr4YNWc6hCd5nod4+d4kd9vWIAWrmGuLdlMw= +github.com/aws/aws-sdk-go-v2/service/sso v1.20.11/go.mod h1:gVvwPdPNYehHSP9Rs7q27U1EU+3Or2ZpXvzAYJNh63w= github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.4/go.mod h1:mOofcMJCDSJwmtZykUE/i6tWGNwMnkextriwzY1zcbc= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.21.6 h1:Yf2MIo9x+0tyv76GljxzqA3WtC5mw7NmazD2chwjxE4= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.21.6/go.mod h1:ykf3COxYI0UJmxcfcxcVuz7b6uADi1FkiUz6Eb7AgM8= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.24.5 h1:iXjh3uaH3vsVcnyZX7MqCoCfcyxIrVE9iOQruRaWPrQ= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.24.5/go.mod h1:5ZXesEuy/QcO0WUnt+4sDkxhdXRHTu2yG0uCSH8B6os= github.com/aws/aws-sdk-go-v2/service/sts v1.16.18/go.mod h1:AE4zMc8qCw1JnDvy0ZrDVb/OXRuuweG3BcT2Nv7Qh3E= -github.com/aws/aws-sdk-go-v2/service/sts v1.26.7 h1:NzO4Vrau795RkUdSHKEwiR01FaGzGOH1EETJ+5QHnm0= -github.com/aws/aws-sdk-go-v2/service/sts v1.26.7/go.mod h1:6h2YuIoxaMSCFf5fi1EgZAwdfkGMgDY+DVfa61uLe4U= +github.com/aws/aws-sdk-go-v2/service/sts v1.28.12 h1:M/1u4HBpwLuMtjlxuI2y6HoVLzF5e2mfxHCg7ZVMYmk= +github.com/aws/aws-sdk-go-v2/service/sts v1.28.12/go.mod h1:kcfd+eTdEi/40FIbLq4Hif3XMXnl5b/+t/KTfLt9xIk= github.com/aws/smithy-go v1.13.3/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= -github.com/aws/smithy-go v1.19.0 h1:KWFKQV80DpP3vJrrA9sVAHQ5gc2z8i4EzrLhLlWXcBM= -github.com/aws/smithy-go v1.19.0/go.mod h1:NukqUGpCZIILqqiV0NIjeFh24kd/FAa4beRb6nbIUPE= +github.com/aws/smithy-go v1.20.2 h1:tbp628ireGtzcHDDmLT/6ADHidqnwgF57XOXZe6tp4Q= +github.com/aws/smithy-go v1.20.2/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/xds/go v0.0.0-20231128003011-0fa0005c9caa h1:jQCWAUqqlij9Pgj2i/PB79y4KOPYVyFYdROxgaCwdTQ= github.com/crackcomm/go-clitable v0.0.0-20151121230230-53bcff2fea36/go.mod h1:XiV36mPegOHv+dlkCSCazuGdQR2BUTgIZ2FKqTTHles= github.com/creack/pty v1.1.20 h1:VIPb/a2s17qNeQgDnkfZC35RScx+blkKF8GV68n80J4= github.com/creack/pty v1.1.20/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= @@ -137,25 +137,38 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dimchansky/utfbom v1.1.1 h1:vV6w1AhK4VMnhBno/TPVCoK9U/LP0PkLCS9tbxHdi/U= github.com/dimchansky/utfbom v1.1.1/go.mod h1:SxdoEBH5qIqFocHMyGOXVAybYJdr71b1Q/j0mACtrfE= -github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/envoyproxy/protoc-gen-validate v1.0.4 h1:gVPz/FMfvh57HdSJQyvBtF00j8JU4zdyUgIUNhlgg0A= github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= github.com/fatih/color v1.12.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= +github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= +github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/fujiwara/cfn-lookup v1.0.0 h1:oDhBXaEvT27B0dFB4z3zbjuTzA3E6m8t8Sge9mffAzU= github.com/fujiwara/cfn-lookup v1.0.0/go.mod h1:HI8F4hlW+nN9KRTWNzdwvnOUQFrN8jX9puyfhtAVgwU= +github.com/fujiwara/cfn-lookup v1.1.0 h1:wNjMituD/n8XAhBw+L3uqtDCnWr1nrAI7T/YATMwl9A= +github.com/fujiwara/cfn-lookup v1.1.0/go.mod h1:yQiC+G7sSTRTic6E8RKv1G36tp+y2Q/9BT6QMQT4yyw= github.com/fujiwara/ecsta v0.4.5 h1:82M3oL6n+eNd3JgPiFOOKkIYq46ggnts2HbuHOtX3rI= github.com/fujiwara/ecsta v0.4.5/go.mod h1:SwSlCJuhiVrWfpYSaaHUSZVrs6Ey6nJ9V3flWNX7ndk= github.com/fujiwara/logutils v1.1.2 h1:nYVRyTj+5SyCvpZUrYIZU4kubqNycGTxFXMKJBKe0Sg= github.com/fujiwara/logutils v1.1.2/go.mod h1:pdb/Uk70rjQWEmFm/OvYH7OG8meZt1fEIqC0qZbvro4= -github.com/fujiwara/tfstate-lookup v1.1.6 h1:IFWGCpJ/mhK0OkWiBGd/0kIgjwE/H6eh9BobLptkebo= -github.com/fujiwara/tfstate-lookup v1.1.6/go.mod h1:G+sFc6osVH71L32pX3+2ibfdhqePPrDZa0ren/QaMYs= +github.com/fujiwara/ssm-lookup v0.1.0 h1:30dFvRurr1cvBq6KZL0QJrN1e5y80p6EUAari6LoL3Y= +github.com/fujiwara/ssm-lookup v0.1.0/go.mod h1:ssVwS1FrHAKouOMEmYC6j07XRKqBGdABRmv6gBKewVg= +github.com/fujiwara/tfstate-lookup v1.3.0 h1:3KrHqv1uL3REq2hwQWC+qSkDJN5q6e0wBMDTNP8Cxgo= +github.com/fujiwara/tfstate-lookup v1.3.0/go.mod h1:qYLO+8Ane5hF54BdvLQTbXiHWviq3uGCuW6Lz3fcWCM= +github.com/fujiwara/tfstate-lookup v1.3.2 h1:jfPPRecZ9yzPI0epCnK5UCxY3CQAAF0Iq4L3osJ3d58= +github.com/fujiwara/tfstate-lookup v1.3.2/go.mod h1:qYLO+8Ane5hF54BdvLQTbXiHWviq3uGCuW6Lz3fcWCM= github.com/fujiwara/tracer v1.0.2 h1:ztstnson+QwOpO69Jir4nkUKlYgse3vJ28FO2eOUPk0= github.com/fujiwara/tracer v1.0.2/go.mod h1:r2QzBEBNsW9OhmoVdmTANG+GEmxWNZk7317/mnW2yIw= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= @@ -169,15 +182,14 @@ github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzw github.com/golang-jwt/jwt/v4 v4.2.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/golang-jwt/jwt/v5 v5.0.0 h1:1n1XNM9hk7O9mnQoNBGolZvzebBQ7p93ULHRc28XJUE= -github.com/golang-jwt/jwt/v5 v5.0.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= +github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= @@ -187,6 +199,7 @@ github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvq github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -199,45 +212,46 @@ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-jsonnet v0.19.1 h1:MORxkrG0elylUqh36R4AcSPX0oZQa9hvI3lroN+kDhs= -github.com/google/go-jsonnet v0.19.1/go.mod h1:5JVT33JVCoehdTj5Z2KJq1eIdt3Nb8PCmZ+W5D8U350= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-jsonnet v0.20.0 h1:WG4TTSARuV7bSm4PMB4ohjxe33IHT5WVTrJSU33uT4g= +github.com/google/go-jsonnet v0.20.0/go.mod h1:VbgWF9JX7ztlv770x/TolZNGGFfiHEVx9G6ca2eUmeA= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/google/martian/v3 v3.3.2 h1:IqNFLAmvJOgVlpdEBiQbDc2EwKW77amAycfTuWKdfvw= +github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= +github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/enterprise-certificate-proxy v0.2.3 h1:yk9/cqRKtT9wXZSsRH9aurXEpJX+U6FLtpYTdC3R06k= -github.com/googleapis/enterprise-certificate-proxy v0.2.3/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= -github.com/googleapis/gax-go/v2 v2.7.1 h1:gF4c0zjUP2H/s/hEGyLA3I0fA2ZWjzYiONAD6cvPr8A= -github.com/googleapis/gax-go/v2 v2.7.1/go.mod h1:4orTrqY6hXxxaUL4LHIPl6lGo8vAE38/qKbhSAKP6QI= -github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/enterprise-certificate-proxy v0.3.2 h1:Vie5ybvEvT75RniqhfFxPRy3Bf7vr3h0cechB90XaQs= +github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0= +github.com/googleapis/gax-go/v2 v2.12.0 h1:A+gCJKdRfqXkr+BIRGtZLibNXf0m1f9E4HG56etFpas= +github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qKpsEkdD5+I6QGU= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= github.com/hashicorp/go-envparse v0.1.0 h1:bE++6bhIsNCPLvgDZkYqo3nA+/PFI51pkrHdmPSDFPY= github.com/hashicorp/go-envparse v0.1.0/go.mod h1:OHheN1GoygLlAkTlXLXvAdnXdZxy8JUweQ1rAXx1xnc= github.com/hashicorp/go-hclog v0.9.2 h1:CG6TE5H9/JXsFWJCfoIVpKFIkFe6ysEuHirp4DxCsHI= github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= -github.com/hashicorp/go-retryablehttp v0.7.1 h1:sUiuQAnLlbvmExtFQs72iFW/HXeUn8Z1aJLQ4LJJbTQ= -github.com/hashicorp/go-retryablehttp v0.7.1/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= -github.com/hashicorp/go-slug v0.10.0 h1:mh4DDkBJTh9BuEjY/cv8PTo7k9OjT4PcW8PgZnJ4jTY= -github.com/hashicorp/go-slug v0.10.0/go.mod h1:Ib+IWBYfEfJGI1ZyXMGNbu2BU+aa3Dzu41RKLH301v4= -github.com/hashicorp/go-tfe v1.10.0 h1:mkEge/DSca8VQeBSAQbjEy8fWFHbrJA76M7dny5XlYc= -github.com/hashicorp/go-tfe v1.10.0/go.mod h1:uSWi2sPw7tLrqNIiASid9j3SprbbkPSJ/2s3X0mMemg= +github.com/hashicorp/go-retryablehttp v0.7.5 h1:bJj+Pj19UZMIweq/iie+1u5YCdGrnxCT9yvm0e+Nd5M= +github.com/hashicorp/go-retryablehttp v0.7.5/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8= +github.com/hashicorp/go-slug v0.15.0 h1:AhMnE6JIyW0KoDJlmRDwv4xd52a5ZK3VdioQ7SMmZhI= +github.com/hashicorp/go-slug v0.15.0/go.mod h1:THWVTAXwJEinbsp4/bBRcmbaO5EYNLTqxbG4tZ3gCYQ= +github.com/hashicorp/go-tfe v1.56.0 h1:AjBTo7TmWoz42l4KhH65Q3NvjRD5yD3XZrG1tzFySeI= +github.com/hashicorp/go-tfe v1.56.0/go.mod h1:XnTtBj3tVQ4uFkcFsv8Grn+O1CVcIcceL1uc2AgUcaU= github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/jsonapi v0.0.0-20210826224640-ee7dae0fb22d h1:9ARUJJ1VVynB176G1HCwleORqCaXm/Vx0uUi0dL26I0= -github.com/hashicorp/jsonapi v0.0.0-20210826224640-ee7dae0fb22d/go.mod h1:Yog5+CPEM3c99L1CL2CFCYoSzgWm5vTU58idbRUaLik= +github.com/hashicorp/jsonapi v1.3.1 h1:GtPvnmcWgYwCuDGvYT5VZBHcUyFdq9lSyCzDjn1DdPo= +github.com/hashicorp/jsonapi v1.3.1/go.mod h1:kWfdn49yCjQvbpnvY1dxxAuAFzISwrrMDQOcu6NsFoM= github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= -github.com/itchyny/gojq v0.12.11 h1:YhLueoHhHiN4mkfM+3AyJV6EPcCxKZsOnYf+aVSwaQw= -github.com/itchyny/gojq v0.12.11/go.mod h1:o3FT8Gkbg/geT4pLI0tF3hvip5F3Y/uskjRz9OYa38g= -github.com/itchyny/timefmt-go v0.1.5 h1:G0INE2la8S6ru/ZI5JecgyzbbJNs5lG1RcBqa7Jm6GE= -github.com/itchyny/timefmt-go v0.1.5/go.mod h1:nEP7L+2YmAbT2kZ2HfSs1d8Xtw9LY8D2stDBckWakZ8= +github.com/itchyny/gojq v0.12.16 h1:yLfgLxhIr/6sJNVmYfQjTIv0jGctu6/DgDoivmxTr7g= +github.com/itchyny/gojq v0.12.16/go.mod h1:6abHbdC2uB9ogMS38XsErnfqJ94UlngIJGlRAIj4jTM= +github.com/itchyny/timefmt-go v0.1.6 h1:ia3s54iciXDdzWzwaVKXZPbiXzxxnv1SPGFfM/myJ5Q= +github.com/itchyny/timefmt-go v0.1.6/go.mod h1:RRDZYC5s9ErkjQvTvvU7keJjxUYzIISJGxm9/mAERQg= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= @@ -246,8 +260,7 @@ github.com/k0kubun/go-ansi v0.0.0-20180517002512-3bf9e2903213/go.mod h1:vNUNkEQ1 github.com/kayac/go-config v0.6.0 h1:Y4l9tsWrUCvT1id8tbO4aT4SdGxbYqd8lqSe5l1GrK0= github.com/kayac/go-config v0.6.0/go.mod h1:5C4ZN+sMjYpEX0bi+AcgF6g0hZYVdzZiV16TEyzAzfk= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= @@ -265,8 +278,9 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= -github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= +github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/goveralls v0.0.9/go.mod h1:FRbM1PS8oVsOe9JtdzAAXM+DsvDMMHcM1C7drGJD8HY= github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db h1:62I3jR2EmQ4l5rM/4FEfDWcRD+abF5XlKShorW5LRoQ= github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db/go.mod h1:l0dey0ia/Uv7NcFFVbCLtqEBQbrT4OCwCSKTEv6enCw= @@ -278,16 +292,17 @@ github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8 github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM= github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.2 h1:YwD0ulJSJytLpiaWua0sBDusfsCZohxjxzVTYjwxfV8= -github.com/rivo/uniseg v0.4.2/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= +github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= +github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/samber/lo v1.36.0 h1:4LaOxH1mHnbDGhTVE0i1z8v/lWaQW8AIfOD3HU4mSaw= github.com/samber/lo v1.36.0/go.mod h1:HLeWcJRRyLKp3+/XBJvOrerCQn9mhdKMHyd7IRlgeQ8= github.com/schollz/progressbar/v3 v3.13.1 h1:o8rySDYiQ59Mwzy2FELeHY5ZARXZTVJC7iHD6PEFUiE= @@ -306,22 +321,34 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/thoas/go-funk v0.9.1 h1:O549iLZqPpTUQ10ykd26sZhzD+rmR5pWhuElrhbC20M= github.com/tkuchiki/go-timezone v0.2.2 h1:MdHR65KwgVTwWFQrota4SKzc4L5EfuH5SdZZGtk/P2Q= github.com/tkuchiki/go-timezone v0.2.2/go.mod h1:oFweWxYl35C/s7HMVZXiA19Jr9Y0qJHMaG/J2TES4LY= github.com/tkuchiki/parsetime v0.3.0 h1:cvblFQlPeAPJL8g6MgIGCHnnmHSZvluuY+hexoZCNqc= github.com/tkuchiki/parsetime v0.3.0/go.mod h1:OJkQmIrf5Ao7R+WYIdITPOfDVj8LmnHGCfQ8DTs3LCA= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 h1:SpGay3w+nEwMpfVnbqOLH5gY52/foP8RE8UzTZ1pdSE= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1/go.mod h1:4UoMYEZOC0yN/sPGH76KPkkU7zgiEWYWL9vwmbnTJPE= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 h1:aFJWCqJMNjENlcleuuOkGAPH82y0yULBScfXcIEdS24= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1/go.mod h1:sEGXWArGqc3tVa+ekntsN65DmVbVeW+7lTKTjZF3/Fo= +go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc= +go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= +go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4= +go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM= +go.opentelemetry.io/otel/sdk v1.21.0 h1:FTt8qirL1EysG6sTQRZ5TokkU8d0ugCj8htOgThZXQ8= +go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc= +go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= -golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= +golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI= +golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17 h1:3MTrJm4PyNL9NBqvYDSj3DHl46qQakyfqfWo4jgfaEM= golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17/go.mod h1:lgLbSvA5ygNOMpwM/9anMpWVlVJ7Z+cHWq/eFuinpGE= @@ -331,26 +358,30 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= -golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= +golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.7.0 h1:qe6s0zUXlPX80/dITx3440hWZ7GwMwgDDyrSGTPJG/g= -golang.org/x/oauth2 v0.7.0/go.mod h1:hPLQkd9LyjfXTiRohC/41GhcFqxisoUQ99sCUOHO9x4= +golang.org/x/oauth2 v0.16.0 h1:aDkGMBSYxElaoP81NpoUoz2oo2R2wHdZpGToUxfyQrQ= +golang.org/x/oauth2 v0.16.0/go.mod h1:hqZ+0LWXsiVoZpeld6jVt06P3adbS2Uu911W1SsJv2o= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -362,24 +393,28 @@ golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= -golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8= -golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= +golang.org/x/term v0.21.0 h1:WVXCp+/EBEHOj53Rvu+7KiT/iElMrO8ACK16SMZ3jaA= +golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/time v0.0.0-20220722155302-e5dcc9cfc0b9 h1:ftMN5LMiBFjbzleLqtoBZk7KdJwhuybIU+FckUHgoyQ= -golang.org/x/time v0.0.0-20220722155302-e5dcc9cfc0b9/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= +golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= +golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= +golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= @@ -389,30 +424,35 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -google.golang.org/api v0.114.0 h1:1xQPji6cO2E2vLiI+C/XiFAnsn1WV3mjaEwGLhi3grE= -google.golang.org/api v0.114.0/go.mod h1:ifYI2ZsFK6/uGddGfAD5BMxlnkBqCmqHSDUVi45N5Yg= +google.golang.org/api v0.155.0 h1:vBmGhCYs0djJttDNynWo44zosHlPvHmA0XiN2zP2DtA= +google.golang.org/api v0.155.0/go.mod h1:GI5qK5f40kCpHfPn6+YzGAByIKWv8ujFnmoWm7Igduk= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= -google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= +google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A= -google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= +google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80 h1:KAeGQVN3M9nD0/bQXnr/ClcEMJ968gUXJQ9pwfSynuQ= +google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80/go.mod h1:cc8bqMqtv9gMOr0zHg2Vzff5ULhhL2IXP4sbcn32Dro= +google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80 h1:Lj5rbfG876hIAYFjqiJnPHfhXbv+nzTWfm04Fg/XSVU= +google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80/go.mod h1:4jWUdICTdgc3Ibxmr8nAJiiLHwQBY0UI0XZcEMaFKaA= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 h1:AjyfHzEPEFp/NpvfN5g+KDla3EMojjhRVZc1i7cj+oM= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80/go.mod h1:PAREbraiVEVGVdTZsVWjSbbTtSyGbAgIIvni8a8CD5s= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.56.3 h1:8I4C0Yq1EjstUzUJzpcRVbuYA2mODtEmpWiQoN/b2nc= -google.golang.org/grpc v1.56.3/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -429,7 +469,6 @@ google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHh gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/jsonnet.go b/jsonnet.go new file mode 100644 index 00000000..a7b3d648 --- /dev/null +++ b/jsonnet.go @@ -0,0 +1,56 @@ +package ecspresso + +import ( + "fmt" + "os" + + "github.com/google/go-jsonnet" + "github.com/google/go-jsonnet/ast" +) + +var DefaultJsonnetNativeFuncs = []*jsonnet.NativeFunction{ + JsonnetNativeEnvFunc, + JsonnetNativeMustEnvFunc, +} + +var JsonnetNativeEnvFunc = &jsonnet.NativeFunction{ + Name: "env", + Params: []ast.Identifier{"name", "default"}, + Func: func(args []interface{}) (interface{}, error) { + if len(args) > 2 { + return nil, fmt.Errorf("env: invalid number of arguments") + } + key, ok := args[0].(string) + if !ok { + return nil, fmt.Errorf("env: invalid argument type") + } + switch len(args) { + case 1: + return os.Getenv(key), nil + case 2: + if v := os.Getenv(key); v != "" { + return v, nil + } + return args[1], nil + } + return nil, nil + }, +} + +var JsonnetNativeMustEnvFunc = &jsonnet.NativeFunction{ + Name: "must_env", + Params: []ast.Identifier{"name"}, + Func: func(args []interface{}) (interface{}, error) { + if len(args) > 1 { + return nil, fmt.Errorf("must_env: invalid number of arguments") + } + key, ok := args[0].(string) + if !ok { + return nil, fmt.Errorf("must_env: invalid argument type") + } + if v, ok := os.LookupEnv(key); ok { + return v, nil + } + return nil, fmt.Errorf("must_env: %s is not set", key) + }, +} diff --git a/plugin.go b/plugin.go index e4293a1c..e3530813 100644 --- a/plugin.go +++ b/plugin.go @@ -6,20 +6,22 @@ import ( "fmt" "path/filepath" "strings" + "sync" "text/template" "github.com/fujiwara/cfn-lookup/cfn" + "github.com/fujiwara/ssm-lookup/ssm" "github.com/fujiwara/tfstate-lookup/tfstate" + "github.com/google/go-jsonnet" "github.com/kayac/ecspresso/v2/secretsmanager" - "github.com/kayac/ecspresso/v2/ssm" "github.com/samber/lo" ) var defaultPluginNames = []string{"ssm", "secretsmanager"} type ConfigPlugin struct { - Name string `yaml:"name" json:"name"` - Config map[string]interface{} `yaml:"config" json:"config"` + Name string `yaml:"name" json:"name,omitempty"` + Config map[string]interface{} `yaml:"config" json:"config,omitempty"` FuncPrefix string `yaml:"func_prefix,omitempty" json:"func_prefix,omitempty"` } @@ -57,6 +59,23 @@ func (p ConfigPlugin) AppendFuncMap(c *Config, funcMap template.FuncMap) error { return nil } +func (p ConfigPlugin) AppendJsonnetNativeFuncs(c *Config, funcs []*jsonnet.NativeFunction) error { + for _, f := range funcs { + f.Name = p.FuncPrefix + f.Name + for _, appendedFuncs := range c.jsonnetNativeFuncs { + if appendedFuncs.Name == f.Name { + if lo.Contains(defaultPluginNames, p.Name) { + Log("[DEBUG] jsonnet native function %s already exists by default plugins. skip", f.Name) + continue + } + return fmt.Errorf("jsonnet native function %s already exists. set func_prefix to %s plugin", f.Name, p.Name) + } + } + c.jsonnetNativeFuncs = append(c.jsonnetNativeFuncs, f) + } + return nil +} + func setupPluginTFState(ctx context.Context, p ConfigPlugin, c *Config) error { var loc string if p.Config["path"] != nil { @@ -77,33 +96,51 @@ func setupPluginTFState(ctx context.Context, p ConfigPlugin, c *Config) error { } else { return errors.New("tfstate plugin requires path or url for tfstate location") } - funcs, err := tfstate.FuncMap(ctx, loc) + + lookup, err := tfstate.ReadURL(ctx, loc) if err != nil { return err } - return p.AppendFuncMap(c, funcs) + if err := p.AppendFuncMap(c, lookup.FuncMap(ctx)); err != nil { + return err + } + if err := p.AppendJsonnetNativeFuncs(c, lookup.JsonnetNativeFuncs(ctx)); err != nil { + return err + } + return nil } func setupPluginCFn(ctx context.Context, p ConfigPlugin, c *Config) error { - funcs, err := cfn.FuncMap(ctx, c.awsv2Config) - if err != nil { + cache := sync.Map{} + lookup := cfn.New(c.awsv2Config, &cache) + if err := p.AppendFuncMap(c, lookup.FuncMap(ctx)); err != nil { + return err + } + if err := p.AppendJsonnetNativeFuncs(c, lookup.JsonnetNativeFuncs(ctx)); err != nil { return err } - return p.AppendFuncMap(c, funcs) + return nil } func setupPluginSSM(ctx context.Context, p ConfigPlugin, c *Config) error { - funcs, err := ssm.FuncMap(ctx, c.awsv2Config) - if err != nil { + cache := sync.Map{} + lookup := ssm.New(c.awsv2Config, &cache) + if err := p.AppendFuncMap(c, lookup.FuncMap(ctx)); err != nil { return err } - return p.AppendFuncMap(c, funcs) + if err := p.AppendJsonnetNativeFuncs(c, lookup.JsonnetNativeFuncs(ctx)); err != nil { + return err + } + return nil } func setupPluginSecretsManager(ctx context.Context, p ConfigPlugin, c *Config) error { - funcs, err := secretsmanager.FuncMap(ctx, c.awsv2Config) - if err != nil { + lookup := secretsmanager.NewApp(c.awsv2Config) + if err := p.AppendFuncMap(c, lookup.FuncMap(ctx)); err != nil { return err } - return p.AppendFuncMap(c, funcs) + if err := p.AppendJsonnetNativeFuncs(c, lookup.JsonnetNativeFuncs(ctx)); err != nil { + return err + } + return nil } diff --git a/secretsmanager/export_test.go b/secretsmanager/export_test.go new file mode 100644 index 00000000..215611d2 --- /dev/null +++ b/secretsmanager/export_test.go @@ -0,0 +1,10 @@ +package secretsmanager + +import "sync" + +func MockNewApp(client secretsmanagerClient) *App { + return &App{ + svc: client, + cache: &sync.Map{}, + } +} diff --git a/secretsmanager/funcs.go b/secretsmanager/funcs.go index 69a2805c..99e5c2e8 100644 --- a/secretsmanager/funcs.go +++ b/secretsmanager/funcs.go @@ -8,26 +8,72 @@ import ( "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/service/secretsmanager" + "github.com/google/go-jsonnet" + "github.com/google/go-jsonnet/ast" ) -func FuncMap(ctx context.Context, cfg aws.Config) (template.FuncMap, error) { - smsvc := secretsmanager.NewFromConfig(cfg) - cache := sync.Map{} +type secretsmanagerClient interface { + DescribeSecret(ctx context.Context, input *secretsmanager.DescribeSecretInput, opts ...func(*secretsmanager.Options)) (*secretsmanager.DescribeSecretOutput, error) +} + +type App struct { + svc secretsmanagerClient + cache *sync.Map +} + +func (a *App) ResolveArn(ctx context.Context, id string) (string, error) { + if arn, ok := a.cache.Load(id); ok { + return arn.(string), nil + } + res, err := a.svc.DescribeSecret(ctx, &secretsmanager.DescribeSecretInput{ + SecretId: &id, + }) + if err != nil { + return "", fmt.Errorf("failed to describe secret: %w", err) + } + arn := aws.ToString(res.ARN) + a.cache.Store(id, arn) + return arn, nil +} + +func NewApp(awsCfg aws.Config) *App { + return &App{ + svc: secretsmanager.NewFromConfig(awsCfg), + cache: &sync.Map{}, + } +} + +func FuncMap(ctx context.Context, cfg aws.Config) template.FuncMap { + app := NewApp(cfg) + return app.FuncMap(ctx) +} + +func JsonnetNativeFuncs(ctx context.Context, cfg aws.Config) ([]*jsonnet.NativeFunction, error) { + app := NewApp(cfg) + return app.JsonnetNativeFuncs(ctx), nil +} + +func (a *App) FuncMap(ctx context.Context) template.FuncMap { funcs := template.FuncMap{ "secretsmanager_arn": func(id string) (string, error) { - if arn, ok := cache.Load(id); ok { - return arn.(string), nil - } - res, err := smsvc.DescribeSecret(ctx, &secretsmanager.DescribeSecretInput{ - SecretId: &id, - }) - if err != nil { - return "", fmt.Errorf("failed to describe secret: %w", err) - } - arn := aws.ToString(res.ARN) - cache.Store(id, arn) - return arn, nil + return a.ResolveArn(ctx, id) + }, + } + return funcs +} + +func (a *App) JsonnetNativeFuncs(ctx context.Context) []*jsonnet.NativeFunction { + return []*jsonnet.NativeFunction{ + { + Name: "secretsmanager_arn", + Params: []ast.Identifier{"id"}, + Func: func(args []interface{}) (interface{}, error) { + id, ok := args[0].(string) + if !ok { + return nil, fmt.Errorf("secretsmanager_arn: id must be string") + } + return a.ResolveArn(ctx, id) + }, }, } - return funcs, nil } diff --git a/secretsmanager/funcs_test.go b/secretsmanager/funcs_test.go new file mode 100644 index 00000000..2ec3393c --- /dev/null +++ b/secretsmanager/funcs_test.go @@ -0,0 +1,46 @@ +package secretsmanager_test + +import ( + "context" + "encoding/json" + "fmt" + "strings" + "testing" + + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/service/secretsmanager" + "github.com/google/go-jsonnet" + sm "github.com/kayac/ecspresso/v2/secretsmanager" +) + +type mockSecretsManagerClient struct{} + +var arnFmt = "arn:aws:secretsmanager:us-west-1:123456789012:secret:%s-deadbeef" + +func (m *mockSecretsManagerClient) DescribeSecret(ctx context.Context, input *secretsmanager.DescribeSecretInput, opts ...func(*secretsmanager.Options)) (*secretsmanager.DescribeSecretOutput, error) { + return &secretsmanager.DescribeSecretOutput{ + ARN: aws.String(fmt.Sprintf(arnFmt, *input.SecretId)), + }, nil +} + +func TestJsonnetNativeFuncs(t *testing.T) { + app := sm.MockNewApp(&mockSecretsManagerClient{}) + funcs := app.JsonnetNativeFuncs(context.Background()) + vm := jsonnet.MakeVM() + for _, f := range funcs { + vm.NativeFunction(f) + } + out, err := vm.EvaluateAnonymousSnippet("test.jsonnet", ` + local arn = std.native('secretsmanager_arn'); + arn('my-secret') + `) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + b, _ := json.Marshal(fmt.Sprintf(arnFmt, "my-secret")) + expect := string(b) + + if strings.TrimSuffix(out, "\n") != expect { + t.Fatalf("expected secretsmanager_arn function to return %s, got %s", expect, out) + } +} diff --git a/ssm/export_test.go b/ssm/export_test.go deleted file mode 100644 index 12feb92e..00000000 --- a/ssm/export_test.go +++ /dev/null @@ -1,5 +0,0 @@ -package ssm - -func MockNew(ssm ssmiface) *App { - return &App{ssm: ssm} -} diff --git a/ssm/funcs.go b/ssm/funcs.go deleted file mode 100644 index fbd3c425..00000000 --- a/ssm/funcs.go +++ /dev/null @@ -1,25 +0,0 @@ -package ssm - -import ( - "context" - "fmt" - "sync" - "text/template" - - "github.com/aws/aws-sdk-go-v2/aws" -) - -func FuncMap(ctx context.Context, cfg aws.Config) (template.FuncMap, error) { - cache := sync.Map{} - app := New(cfg, &cache) - - return template.FuncMap{ - "ssm": func(paramName string, index ...int) (string, error) { - value, err := app.Lookup(ctx, paramName, index...) - if err != nil { - return "", fmt.Errorf("failed to lookup ssm parameter: %w", err) - } - return value, nil - }, - }, nil -} diff --git a/ssm/lookup.go b/ssm/lookup.go deleted file mode 100644 index a175a348..00000000 --- a/ssm/lookup.go +++ /dev/null @@ -1,112 +0,0 @@ -package ssm - -import ( - "context" - "fmt" - "strings" - "sync" - - "github.com/aws/aws-sdk-go-v2/aws" - "github.com/aws/aws-sdk-go-v2/service/ssm" - "github.com/aws/aws-sdk-go-v2/service/ssm/types" -) - -// App represents an application -type App struct { - ssm ssmiface - cache *sync.Map -} - -type ssmiface interface { - GetParameter(context.Context, *ssm.GetParameterInput, ...func(*ssm.Options)) (*ssm.GetParameterOutput, error) -} - -// New creates an application instance -func New(cfg aws.Config, cache *sync.Map) *App { - return &App{ - ssm: ssm.NewFromConfig(cfg), - cache: cache, - } -} - -// Lookup lookups a parameter from AWS Systems Manager Parameter Store -func (a *App) Lookup(ctx context.Context, paramName string, index ...int) (outputValue string, err error) { - if len(index) > 1 { - return "", fmt.Errorf("ssm template function accepts at most 2 parameters, but got %d", len(index)+1) - } - - param, err := getParameterWithCache(ctx, a.ssm, paramName, a.cache) - if err != nil { - return "", err - } - - switch param.Parameter.Type { - case types.ParameterTypeStringList: - if len(index) != 1 { - return "", fmt.Errorf("the second argument is required for StringList type parrameter to specify the index") - } - case types.ParameterTypeString, types.ParameterTypeSecureString: - if len(index) != 0 { - return "", fmt.Errorf("the second argument is supported only for StringList type, but the parameter %s is of type %s", *param.Parameter.Name, param.Parameter.Type) - } - } - - return lookupValue(param, index...) -} - -func getParameterWithCache(ctx context.Context, service ssmiface, paramName string, cache *sync.Map) (*ssm.GetParameterOutput, error) { - if cache == nil { - return getParameter(ctx, service, paramName) - } - - if s, found := cache.Load(paramName); found { - return s.(*ssm.GetParameterOutput), nil - } - - if p, err := getParameter(ctx, service, paramName); err != nil { - return nil, err - } else { - cache.Store(paramName, p) - return p, nil - } -} - -func getParameter(ctx context.Context, service ssmiface, paramName string) (*ssm.GetParameterOutput, error) { - res, err := service.GetParameter(ctx, &ssm.GetParameterInput{ - Name: aws.String(paramName), - WithDecryption: aws.Bool(true), - }) - if err != nil { - return nil, fmt.Errorf("something went wrong calling get-parameter API: %w", err) - } - return res, nil -} - -func lookupValue(param *ssm.GetParameterOutput, index ...int) (string, error) { - switch param.Parameter.Type { - case types.ParameterTypeString: - return lookupStringValue(param) - case types.ParameterTypeStringList: - return lookupStringListValue(param, index...) - case types.ParameterTypeSecureString: - return lookupSecureString(param) - } - return "", fmt.Errorf("received unexpected parameter type: %s", param.Parameter.Type) -} - -func lookupStringValue(param *ssm.GetParameterOutput) (string, error) { - return *param.Parameter.Value, nil -} - -func lookupStringListValue(param *ssm.GetParameterOutput, index ...int) (string, error) { - values := strings.Split(*param.Parameter.Value, ",") - if len(values) < index[0]-1 { - return "", fmt.Errorf("StringList values were %v, but the index %d is out of range", values, index[0]) - } - - return values[index[0]], nil -} - -func lookupSecureString(param *ssm.GetParameterOutput) (string, error) { - return *param.Parameter.Value, nil -} diff --git a/ssm/lookup_test.go b/ssm/lookup_test.go deleted file mode 100644 index b2e10543..00000000 --- a/ssm/lookup_test.go +++ /dev/null @@ -1,107 +0,0 @@ -package ssm_test - -import ( - "context" - "fmt" - "testing" - - "github.com/aws/aws-sdk-go-v2/aws" - awsssm "github.com/aws/aws-sdk-go-v2/service/ssm" - "github.com/aws/aws-sdk-go-v2/service/ssm/types" - "github.com/google/go-cmp/cmp" - "github.com/kayac/ecspresso/v2/ssm" -) - -type mockSSM struct { - getParameter func(input *awsssm.GetParameterInput) (*awsssm.GetParameterOutput, error) -} - -func (m mockSSM) GetParameter(ctx context.Context, input *awsssm.GetParameterInput, opts ...func(*awsssm.Options)) (*awsssm.GetParameterOutput, error) { - return m.getParameter(input) -} - -func newMockApp(getParameter func(input *awsssm.GetParameterInput) (*awsssm.GetParameterOutput, error)) *ssm.App { - return ssm.MockNew(mockSSM{getParameter: getParameter}) -} - -func mockGetParameter(input *awsssm.GetParameterInput) (*awsssm.GetParameterOutput, error) { - switch *input.Name { - case "/string": - return &awsssm.GetParameterOutput{ - Parameter: &types.Parameter{ - Name: input.Name, - Type: types.ParameterTypeString, - Value: aws.String("string value"), - }, - }, nil - case "/stringlist": - return &awsssm.GetParameterOutput{ - Parameter: &types.Parameter{ - Name: input.Name, - Type: types.ParameterTypeStringList, - Value: aws.String("stringlist value 1,stringlist value 2"), - }, - }, nil - case "/securestring": - return &awsssm.GetParameterOutput{ - Parameter: &types.Parameter{ - Name: input.Name, - Type: types.ParameterTypeSecureString, - Value: aws.String("securestring value"), - }, - }, nil - } - return nil, fmt.Errorf("unknown parameter") -} - -func TestLookupOk(t *testing.T) { - tests := []struct { - testname string - param string - index []int - want string - }{ - {"String", "/string", nil, "string value"}, - {"StringList 0", "/stringlist", []int{0}, "stringlist value 1"}, - {"StringList 1", "/stringlist", []int{1}, "stringlist value 2"}, - {"SecureString", "/securestring", nil, "securestring value"}, - } - ctx := context.Background() - app := newMockApp(mockGetParameter) - for _, td := range tests { - t.Run(td.testname, func(t *testing.T) { - got, err := app.Lookup(ctx, td.param, td.index...) - if err != nil { - t.Fatalf("got unexpected error: %v", err) - } - if diff := cmp.Diff(td.want, got); diff != "" { - t.Errorf("unexpected result (-want +got):\n%s", diff) - } - }) - } -} - -func TestLookupError(t *testing.T) { - tests := []struct { - testname string - param string - index []int - err string - }{ - {"wrong args count", "/stringlist", []int{0, 1}, "ssm template function accepts at most 2 parameters, but got 3"}, - {"String index", "/string", []int{0}, "the second argument is supported only for StringList type, but the parameter /string is of type String"}, - {"StringList no index", "/stringlist", nil, "the second argument is required for StringList type parrameter to specify the index"}, - {"SecureString index", "/securestring", []int{0}, "the second argument is supported only for StringList type, but the parameter /securestring is of type SecureString"}, - } - - ctx := context.Background() - app := newMockApp(mockGetParameter) - for _, td := range tests { - t.Run(td.testname, func(t *testing.T) { - _, err := app.Lookup(ctx, td.param, td.index...) - if diff := cmp.Diff(err.Error(), td.err); diff != "" { - t.Errorf("got unexpected error %s", diff) - } - }) - } -} From 77dd19033d6dab61e2889b70ce33050ac0de4a10 Mon Sep 17 00:00:00 2001 From: fujiwara Date: Sat, 15 Jun 2024 00:47:34 +0900 Subject: [PATCH 02/12] go mod tidy --- go.sum | 4 ---- 1 file changed, 4 deletions(-) diff --git a/go.sum b/go.sum index 844bedc5..b66be46a 100644 --- a/go.sum +++ b/go.sum @@ -148,8 +148,6 @@ github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/fujiwara/cfn-lookup v1.0.0 h1:oDhBXaEvT27B0dFB4z3zbjuTzA3E6m8t8Sge9mffAzU= -github.com/fujiwara/cfn-lookup v1.0.0/go.mod h1:HI8F4hlW+nN9KRTWNzdwvnOUQFrN8jX9puyfhtAVgwU= github.com/fujiwara/cfn-lookup v1.1.0 h1:wNjMituD/n8XAhBw+L3uqtDCnWr1nrAI7T/YATMwl9A= github.com/fujiwara/cfn-lookup v1.1.0/go.mod h1:yQiC+G7sSTRTic6E8RKv1G36tp+y2Q/9BT6QMQT4yyw= github.com/fujiwara/ecsta v0.4.5 h1:82M3oL6n+eNd3JgPiFOOKkIYq46ggnts2HbuHOtX3rI= @@ -158,8 +156,6 @@ github.com/fujiwara/logutils v1.1.2 h1:nYVRyTj+5SyCvpZUrYIZU4kubqNycGTxFXMKJBKe0 github.com/fujiwara/logutils v1.1.2/go.mod h1:pdb/Uk70rjQWEmFm/OvYH7OG8meZt1fEIqC0qZbvro4= github.com/fujiwara/ssm-lookup v0.1.0 h1:30dFvRurr1cvBq6KZL0QJrN1e5y80p6EUAari6LoL3Y= github.com/fujiwara/ssm-lookup v0.1.0/go.mod h1:ssVwS1FrHAKouOMEmYC6j07XRKqBGdABRmv6gBKewVg= -github.com/fujiwara/tfstate-lookup v1.3.0 h1:3KrHqv1uL3REq2hwQWC+qSkDJN5q6e0wBMDTNP8Cxgo= -github.com/fujiwara/tfstate-lookup v1.3.0/go.mod h1:qYLO+8Ane5hF54BdvLQTbXiHWviq3uGCuW6Lz3fcWCM= github.com/fujiwara/tfstate-lookup v1.3.2 h1:jfPPRecZ9yzPI0epCnK5UCxY3CQAAF0Iq4L3osJ3d58= github.com/fujiwara/tfstate-lookup v1.3.2/go.mod h1:qYLO+8Ane5hF54BdvLQTbXiHWviq3uGCuW6Lz3fcWCM= github.com/fujiwara/tracer v1.0.2 h1:ztstnson+QwOpO69Jir4nkUKlYgse3vJ28FO2eOUPk0= From 4f46cf5cdba94f2567e9b0d879ef8ad8ef611589 Mon Sep 17 00:00:00 2001 From: fujiwara Date: Sat, 15 Jun 2024 00:49:12 +0900 Subject: [PATCH 03/12] use native functions on tests. --- tests/ci/Makefile | 2 +- tests/ci/ecs-service-def.jsonnet | 8 +++++--- tests/ci/ecs-task-def.jsonnet | 23 ++++++++++++++++++++--- tests/ci/ecspresso.jsonnet | 26 ++++++++++++++++++++++++++ tests/ci/ecspresso.yml | 4 ++++ tests/ecspresso.jsonnet | 3 ++- 6 files changed, 58 insertions(+), 8 deletions(-) create mode 100644 tests/ci/ecspresso.jsonnet diff --git a/tests/ci/Makefile b/tests/ci/Makefile index d6c0f01e..7487a692 100644 --- a/tests/ci/Makefile +++ b/tests/ci/Makefile @@ -6,7 +6,7 @@ export SERVICE := nginx export NOW := $(shell date +%Y%m%d%H%M%S) export CLIENT_TOKEN := $(shell uuidgen) export DEPLOYMENT_CONTROLLER ?= ECS -ECSPRESSO := ecspresso --envfile envfile --ext-str DEPLOYMENT_CONTROLLER=$(DEPLOYMENT_CONTROLLER) +ECSPRESSO := ecspresso --envfile envfile help: diff --git a/tests/ci/ecs-service-def.jsonnet b/tests/ci/ecs-service-def.jsonnet index 9cab2fb2..64055138 100644 --- a/tests/ci/ecs-service-def.jsonnet +++ b/tests/ci/ecs-service-def.jsonnet @@ -1,4 +1,6 @@ -local isCodeDeploy = std.extVar('DEPLOYMENT_CONTROLLER') == 'CODE_DEPLOY'; +local env = std.native('env'); +local must_env = std.native('must_env'); +local isCodeDeploy = env('DEPLOYMENT_CONTROLLER', 'ECS') == 'CODE_DEPLOY'; { capacityProviderStrategy: [ { @@ -21,7 +23,7 @@ local isCodeDeploy = std.extVar('DEPLOYMENT_CONTROLLER') == 'CODE_DEPLOY'; minimumHealthyPercent: 100, }, deploymentController: { - type: '{{ env `DEPLOYMENT_CONTROLLER` `ECS` }}', + type: env('DEPLOYMENT_CONTROLLER', 'ECS'), }, desiredCount: 1, enableECSManagedTags: false, @@ -68,7 +70,7 @@ local isCodeDeploy = std.extVar('DEPLOYMENT_CONTROLLER') == 'CODE_DEPLOY'; { managedEBSVolume: { filesystemType: 'ext4', - roleArn: 'arn:aws:iam::{{ must_env `AWS_ACCOUNT_ID` }}:role/ecsInfrastructureRole', + roleArn: 'arn:aws:iam::%s:role/ecsInfrastructureRole' % must_env('AWS_ACCOUNT_ID'), sizeInGiB: 10, tagSpecifications: [ { diff --git a/tests/ci/ecs-task-def.jsonnet b/tests/ci/ecs-task-def.jsonnet index 3600d6a1..271240c2 100644 --- a/tests/ci/ecs-task-def.jsonnet +++ b/tests/ci/ecs-task-def.jsonnet @@ -1,4 +1,9 @@ -local isCodeDeploy = std.extVar('DEPLOYMENT_CONTROLLER') == 'CODE_DEPLOY'; +local env = std.native('env'); +local must_env = std.native('must_env'); +local ssm = std.native('ssm'); +local tfstate = std.native('local_tfstate'); +local secretsmanager_arn = std.native('secretsmanager_arn'); +local isCodeDeploy = env('DEPLOYMENT_CONTROLLER', 'ECS') == 'CODE_DEPLOY'; { containerDefinitions: [ { @@ -8,13 +13,25 @@ local isCodeDeploy = std.extVar('DEPLOYMENT_CONTROLLER') == 'CODE_DEPLOY'; name: 'FOO_ENV', value: '{{ ssm `/ecspresso-test/foo` }}', }, + { + name: 'FOO_ENV_FUNC', + value: ssm('/ecspresso-test/foo'), + }, + { + name: 'OUTPUT_FOO', + value: tfstate('output.foo'), + }, { name: 'BAZ_ARN', value: '{{ secretsmanager_arn `ecspresso-test/baz` }}', }, + { + name: 'BAZ_ARN_FUNC', + value: secretsmanager_arn('ecspresso-test/baz'), + }, ], essential: true, - image: 'nginx:{{ env `NGINX_VERSION` `latest` }}', + image: 'nginx:' + env('NGINX_VERSION', 'latest'), logConfiguration: { logDriver: 'awslogs', options: { @@ -40,7 +57,7 @@ local isCodeDeploy = std.extVar('DEPLOYMENT_CONTROLLER') == 'CODE_DEPLOY'; }, { name: 'BAR', - valueFrom: 'arn:aws:ssm:ap-northeast-1:{{must_env `AWS_ACCOUNT_ID`}}:parameter/ecspresso-test/bar', + valueFrom: 'arn:aws:ssm:ap-northeast-1:%s:parameter/ecspresso-test/bar' % must_env('AWS_ACCOUNT_ID'), }, { name: 'BAZ', diff --git a/tests/ci/ecspresso.jsonnet b/tests/ci/ecspresso.jsonnet new file mode 100644 index 00000000..9e62ca27 --- /dev/null +++ b/tests/ci/ecspresso.jsonnet @@ -0,0 +1,26 @@ +local must_env = std.native("must_env"); +local env = std.native("env"); +{ + region: "ap-northeast-1", + cluster: "ecspresso-test", + service: must_env("SERVICE"), + service_definition: "ecs-service-def.jsonnet", + task_definition: "ecs-task-def.jsonnet", + timeout: "20m0s", + plugins: std.prune([ + { + name: "tfstate", + config: { + url: "./terraform.tfstate", + }, + func_prefix: "local_", + }, + if env("TFSTATE_BUCKET", "") != "" then { + name: "tfstate", + config: { + url: "s3://" + env("TFSTATE_BUCKET") + "/terraform.tfstate", + }, + func_prefix: "s3_", + } else null, + ]) +} diff --git a/tests/ci/ecspresso.yml b/tests/ci/ecspresso.yml index c9a23a91..d5909d94 100644 --- a/tests/ci/ecspresso.yml +++ b/tests/ci/ecspresso.yml @@ -5,6 +5,10 @@ service_definition: ecs-service-def.jsonnet task_definition: ecs-task-def.jsonnet timeout: 20m0s plugins: + - name: tfstate + config: + url: "./terraform.tfstate" + func_prefix: local_ {{ if (env `TFSTATE_BUCKET` ``) }} - name: tfstate config: diff --git a/tests/ecspresso.jsonnet b/tests/ecspresso.jsonnet index 74568b5a..fe6c786b 100644 --- a/tests/ecspresso.jsonnet +++ b/tests/ecspresso.jsonnet @@ -1,5 +1,6 @@ +local must_env = std.native('must_env'); { - region: '{{ must_env `AWS_REGION` }}', + region: must_env('AWS_REGION'), cluster: 'default', service: 'test', service_definition: 'ecs-service-def.json', From 71de828501740367528e11996140ae957d8b2223 Mon Sep 17 00:00:00 2001 From: fujiwara Date: Sat, 15 Jun 2024 01:27:20 +0900 Subject: [PATCH 04/12] more tests --- tests/ci/ecs-service-def.jsonnet | 2 +- tests/ci/ecs-task-def.jsonnet | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/ci/ecs-service-def.jsonnet b/tests/ci/ecs-service-def.jsonnet index 64055138..211eb839 100644 --- a/tests/ci/ecs-service-def.jsonnet +++ b/tests/ci/ecs-service-def.jsonnet @@ -25,7 +25,7 @@ local isCodeDeploy = env('DEPLOYMENT_CONTROLLER', 'ECS') == 'CODE_DEPLOY'; deploymentController: { type: env('DEPLOYMENT_CONTROLLER', 'ECS'), }, - desiredCount: 1, + desiredCount: std.parseInt(env('DESIRED_COUNT', '1')), enableECSManagedTags: false, enableExecuteCommand: true, healthCheckGracePeriodSeconds: 0, diff --git a/tests/ci/ecs-task-def.jsonnet b/tests/ci/ecs-task-def.jsonnet index 271240c2..a0055d6b 100644 --- a/tests/ci/ecs-task-def.jsonnet +++ b/tests/ci/ecs-task-def.jsonnet @@ -61,7 +61,7 @@ local isCodeDeploy = env('DEPLOYMENT_CONTROLLER', 'ECS') == 'CODE_DEPLOY'; }, { name: 'BAZ', - valueFrom: 'arn:aws:secretsmanager:ap-northeast-1:{{must_env `AWS_ACCOUNT_ID`}}:secret:ecspresso-test/baz-06XQOH', + valueFrom: secretsmanager_arn('ecspresso-test/baz'), }, ], volumesFrom: [], From 75090cdf56f777a535792ef6e5a2d1fec0c8973d Mon Sep 17 00:00:00 2001 From: fujiwara Date: Mon, 17 Jun 2024 11:00:08 +0900 Subject: [PATCH 05/12] add tests for jsonnet native funcs --- config.go | 2 +- jsonnet.go | 76 ++++++++++++++++++------------------------- jsonnet_test.go | 86 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 118 insertions(+), 46 deletions(-) create mode 100644 jsonnet_test.go diff --git a/config.go b/config.go index f6ee85e0..83ca79a4 100644 --- a/config.go +++ b/config.go @@ -38,7 +38,7 @@ func newConfigLoader(extStr, extCode map[string]string) *configLoader { for k, v := range extCode { vm.ExtCode(k, v) } - for _, f := range DefaultJsonnetNativeFuncs { + for _, f := range DefaultJsonnetNativeFuncs() { vm.NativeFunction(f) } return &configLoader{ diff --git a/jsonnet.go b/jsonnet.go index a7b3d648..7af0970b 100644 --- a/jsonnet.go +++ b/jsonnet.go @@ -8,49 +8,35 @@ import ( "github.com/google/go-jsonnet/ast" ) -var DefaultJsonnetNativeFuncs = []*jsonnet.NativeFunction{ - JsonnetNativeEnvFunc, - JsonnetNativeMustEnvFunc, -} - -var JsonnetNativeEnvFunc = &jsonnet.NativeFunction{ - Name: "env", - Params: []ast.Identifier{"name", "default"}, - Func: func(args []interface{}) (interface{}, error) { - if len(args) > 2 { - return nil, fmt.Errorf("env: invalid number of arguments") - } - key, ok := args[0].(string) - if !ok { - return nil, fmt.Errorf("env: invalid argument type") - } - switch len(args) { - case 1: - return os.Getenv(key), nil - case 2: - if v := os.Getenv(key); v != "" { - return v, nil - } - return args[1], nil - } - return nil, nil - }, -} - -var JsonnetNativeMustEnvFunc = &jsonnet.NativeFunction{ - Name: "must_env", - Params: []ast.Identifier{"name"}, - Func: func(args []interface{}) (interface{}, error) { - if len(args) > 1 { - return nil, fmt.Errorf("must_env: invalid number of arguments") - } - key, ok := args[0].(string) - if !ok { - return nil, fmt.Errorf("must_env: invalid argument type") - } - if v, ok := os.LookupEnv(key); ok { - return v, nil - } - return nil, fmt.Errorf("must_env: %s is not set", key) - }, +func DefaultJsonnetNativeFuncs() []*jsonnet.NativeFunction { + return []*jsonnet.NativeFunction{ + { + Name: "env", + Params: []ast.Identifier{"name", "default"}, + Func: func(args []interface{}) (interface{}, error) { + key, ok := args[0].(string) + if !ok { + return nil, fmt.Errorf("env: name must be a string") + } + if v := os.Getenv(key); v != "" { + return v, nil + } + return args[1], nil + }, + }, + { + Name: "must_env", + Params: []ast.Identifier{"name"}, + Func: func(args []interface{}) (interface{}, error) { + key, ok := args[0].(string) + if !ok { + return nil, fmt.Errorf("must_env: name must be a string") + } + if v, ok := os.LookupEnv(key); ok { + return v, nil + } + return nil, fmt.Errorf("must_env: %s is not set", key) + }, + }, + } } diff --git a/jsonnet_test.go b/jsonnet_test.go new file mode 100644 index 00000000..efc37c20 --- /dev/null +++ b/jsonnet_test.go @@ -0,0 +1,86 @@ +package ecspresso_test + +import ( + "encoding/json" + "testing" + + "github.com/google/go-cmp/cmp" + "github.com/google/go-jsonnet" + "github.com/kayac/ecspresso/v2" +) + +var testSrcJsonnet = ` +local env = std.native("env"); +local must_env = std.native("must_env"); +{ + foo: env("FOO", "default"), + bar: must_env("BAR"), +} +` + +var testCaseJsonnetNativeFuncs = []struct { + name string + env map[string]string + expected map[string]string + errExpected bool +}{ + { + name: "env FOO not set", + env: map[string]string{ + "BAR": "bar", + }, + expected: map[string]string{ + "foo": "default", + "bar": "bar", + }, + }, + { + name: "env FOO set", + env: map[string]string{ + "FOO": "foo", + "BAR": "bar", + }, + expected: map[string]string{ + "foo": "foo", + "bar": "bar", + }, + }, + { + name: "must_env BAR not set", + env: map[string]string{ + "FOO": "foo", + }, + errExpected: true, + }, +} + +func TestJsonnetNativeFuncs(t *testing.T) { + vm := jsonnet.MakeVM() + for _, f := range ecspresso.DefaultJsonnetNativeFuncs() { + vm.NativeFunction(f) + } + + for _, c := range testCaseJsonnetNativeFuncs { + t.Run(c.name, func(t *testing.T) { + for k, v := range c.env { + t.Setenv(k, v) + } + out, err := vm.EvaluateAnonymousSnippet("test.jsonnet", testSrcJsonnet) + if c.errExpected { + if err == nil { + t.Fatal("expected error") + } + return + } else if err != nil { + t.Fatal(err) + } + var got map[string]string + if err := json.Unmarshal([]byte(out), &got); err != nil { + t.Fatal(err) + } + if diff := cmp.Diff(c.expected, got); diff != "" { + t.Errorf("(-expected, +got)\n%s", diff) + } + }) + } +} From 8b6699de52948681b2e7016b94a4047dccb697bd Mon Sep 17 00:00:00 2001 From: fujiwara Date: Fri, 19 Jul 2024 23:26:01 +0900 Subject: [PATCH 06/12] interface{} -> any --- jsonnet.go | 4 ++-- plugin.go | 6 +++--- secretsmanager/funcs.go | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/jsonnet.go b/jsonnet.go index 7af0970b..43867a92 100644 --- a/jsonnet.go +++ b/jsonnet.go @@ -13,7 +13,7 @@ func DefaultJsonnetNativeFuncs() []*jsonnet.NativeFunction { { Name: "env", Params: []ast.Identifier{"name", "default"}, - Func: func(args []interface{}) (interface{}, error) { + Func: func(args []any) (any, error) { key, ok := args[0].(string) if !ok { return nil, fmt.Errorf("env: name must be a string") @@ -27,7 +27,7 @@ func DefaultJsonnetNativeFuncs() []*jsonnet.NativeFunction { { Name: "must_env", Params: []ast.Identifier{"name"}, - Func: func(args []interface{}) (interface{}, error) { + Func: func(args []any) (any, error) { key, ok := args[0].(string) if !ok { return nil, fmt.Errorf("must_env: name must be a string") diff --git a/plugin.go b/plugin.go index e3530813..933d9504 100644 --- a/plugin.go +++ b/plugin.go @@ -20,9 +20,9 @@ import ( var defaultPluginNames = []string{"ssm", "secretsmanager"} type ConfigPlugin struct { - Name string `yaml:"name" json:"name,omitempty"` - Config map[string]interface{} `yaml:"config" json:"config,omitempty"` - FuncPrefix string `yaml:"func_prefix,omitempty" json:"func_prefix,omitempty"` + Name string `yaml:"name" json:"name,omitempty"` + Config map[string]any `yaml:"config" json:"config,omitempty"` + FuncPrefix string `yaml:"func_prefix,omitempty" json:"func_prefix,omitempty"` } func (p ConfigPlugin) Setup(ctx context.Context, c *Config) error { diff --git a/secretsmanager/funcs.go b/secretsmanager/funcs.go index 99e5c2e8..d0a9d0f6 100644 --- a/secretsmanager/funcs.go +++ b/secretsmanager/funcs.go @@ -67,7 +67,7 @@ func (a *App) JsonnetNativeFuncs(ctx context.Context) []*jsonnet.NativeFunction { Name: "secretsmanager_arn", Params: []ast.Identifier{"id"}, - Func: func(args []interface{}) (interface{}, error) { + Func: func(args []any) (any, error) { id, ok := args[0].(string) if !ok { return nil, fmt.Errorf("secretsmanager_arn: id must be string") From 77be4a699885bc603f61423718890e7034a2eaa9 Mon Sep 17 00:00:00 2001 From: fujiwara Date: Sat, 20 Jul 2024 00:15:34 +0900 Subject: [PATCH 07/12] fix readme for jsonnet funcs --- README.md | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 110 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cff97ea0..47b0a78d 100644 --- a/README.md +++ b/README.md @@ -260,6 +260,8 @@ Configuration files and task/service definition files are read by [go-config](ht ecspresso uses the [text/template standard package in Go](https://pkg.go.dev/text/template) to render template files, and parses as YAML/JSON/Jsonnet. By default, ecspresso provides the following as template functions. +If you are using Jsonnet, consider using ecspresso's [Jsonnet functions](#jsonnet-functions) instead of ecspresso's template functions. + ### `env` ``` @@ -470,6 +472,8 @@ ecspresso v1.7 or later can use [Jsonnet](https://jsonnet.org/) file format for v2.0 or later can use Jsonnet for configuration file too. +v2.4 or later can use [Jsonnet functions](#jsonnet-functions). + If the file extension is .jsonnet, ecspresso will process Jsonnet first, convert it to JSON, and then load it. ```jsonnet @@ -496,6 +500,30 @@ $ ecspresso --ext-str Foo=foo --ext-code "Bar=1+1" ... } ``` +### Jsonnet functions + +v2.4 or later supports Jsonnet native functions in Jsonnet files. + +- At first, define `local func = std.native('func');` in Jsonnet files. +- Then, you can use `func()` in Jsonnet files. + +#### `env`, `must_env` + +`env` and `must_env` functions are the same as template functions in JSON and YAML files. + +```jsonnet +local env = std.native('env'); +local must_env = std.native('must_env'); +{ + foo: env('FOO', 'default value'), + bar: must_env('BAR'), +} +``` + +#### `json_escape` + +TODO + ### Deploy to Fargate If you want to deploy services to Fargate, task definitions and service definitions require some settings. @@ -779,7 +807,7 @@ $ ecspresso exec --port-forward -L 8080:example.com:80 ## Plugins -ecspresso has some plugins to extend template functions. +ecspresso has some plugins to extend template functions and Jsonnet native functions. ### tfstate @@ -823,6 +851,28 @@ ecs-service-def.json {{ tfstatef `aws_subnet.ecs['%s'].id` (must_env `SERVICE`) }} ``` +#### tfstate Jsonnet function + +`tfstate` Jsonnet function is the same as template function in JSON and YAML files. +`tfstatef` Jsonnet function is not provided. Use `std.format()` or interpolation instead. + +```jsonnet +local tfstate = std.native('tfstate'); +{ + networkConfiguration: { + awsvpcConfiguration: { + subnets: [ + tfstate('aws_subnet.private["%s"].id' % 'az-z'), + tfstate(std.format('aws_subnet.private["%s"].id', ['az-b'])), + ], + securityGroups: [ + tfstate('data.aws_security_group.default.id'), + ] + } + } +} +``` + #### Supported tfstate URL format - Local file `file://path/to/terraform.tfstate` @@ -861,6 +911,17 @@ So in templates, functions are called with prefixes. ] ``` +Jsonnet function for multiple tfstate support is available by `func_prefix`. + +```jsonnet +local first_tfstate = std.native('first_tfstate'); // func_prefix: first_ +local second_tfstate = std.native('second_tfstate'); // func_prefix: second_ +[ + first_tfstate('aws_s3_bucket.main.arn'), + second_tfstate('aws_s3_bucket.main.arn'), +] +``` + ### CloudFormation The cloudformation plugin introduces template functions `cfn_output` and `cfn_export`. @@ -909,6 +970,24 @@ ecs-service-def.json } ``` +#### Jsonnet functions `cfn_output`, `cfn_export` + +`cfn_output` and `cfn_export` functions are the same as template functions. + +```jsonnet +local cfn_output = std.native('cfn_output'); +local cfn_export = std.native('cfn_export'); +{ + subnets: [ + cfn_output('ECS-ecspresso', 'SubnetAz1'), + cfn_output('ECS-ecspresso', 'SubnetAz2'), + ], + securityGroups: [ + cfn_export('ECS-ecspresso-EcsSecurityGroupId'), + ], +} +``` + ### Lookups ssm parameter store The template function `ssm` reads parameters from AWS Systems Manager(SSM) Parameter Store. @@ -939,6 +1018,20 @@ will be rendered into this. } ``` +#### Jsonnet functions `ssm`, `ssm_list` + +`ssm` and `ssm_list` functions are the same as template function. + +```jsonnet +local ssm = std.native('ssm'); +local ssm_list = std.native('ssm_list'); +{ + string: ssm('/path/to/string'), + stringlist: ssm_list('/path/to/stringlist', 1), + securestring: ssm('/path/to/securestring'), +} +``` + ### Resolve secretsmanager secret ARN The template function `secretsmanager_arn` resolves secretsmanager secret ARN by secret name. @@ -963,6 +1056,22 @@ will be rendered into this. ] ``` +#### Jsonnet function `secretsmanager_arn` + +`secretsmanager_arn` function is the same as template function. + +```jsonnet +local secretsmanager_arn = std.native('secretsmanager_arn'); +{ + secrets: [ + { + name: "FOO", + valueFrom: secretsmanager_arn('foo'), + } + ] +} +``` + ## LICENSE MIT From 2f236e4016717f1c471851f22932432565add1e2 Mon Sep 17 00:00:00 2001 From: fujiwara Date: Sat, 20 Jul 2024 00:20:18 +0900 Subject: [PATCH 08/12] fix readme --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 47b0a78d..e1f6debd 100644 --- a/README.md +++ b/README.md @@ -524,6 +524,8 @@ local must_env = std.native('must_env'); TODO +Other plugin-provided functions are available in Jsonnet files. See [Plugins](#plugins) section. + ### Deploy to Fargate If you want to deploy services to Fargate, task definitions and service definitions require some settings. @@ -1020,7 +1022,7 @@ will be rendered into this. #### Jsonnet functions `ssm`, `ssm_list` -`ssm` and `ssm_list` functions are the same as template function. +`ssm` function is the same as template function. For string list parameters, use `ssm_list` to specify the index. ```jsonnet local ssm = std.native('ssm'); From 98c06932a1d6ba80f70d945030edefe7d079961e Mon Sep 17 00:00:00 2001 From: fujiwara Date: Sat, 20 Jul 2024 00:48:05 +0900 Subject: [PATCH 09/12] fix --- README.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e1f6debd..fdd03c28 100644 --- a/README.md +++ b/README.md @@ -474,7 +474,9 @@ v2.0 or later can use Jsonnet for configuration file too. v2.4 or later can use [Jsonnet functions](#jsonnet-functions). -If the file extension is .jsonnet, ecspresso will process Jsonnet first, convert it to JSON, and then load it. +If the file extension is .jsonnet, ecspresso will process Jsonnet first, convert it to JSON, and then load it with evaluation template syntax. + +If you use the [Template syntax](#template-syntax) in the Jsonnet file, it may cause a syntax error because it conflicts with Jsonnet syntax. In this case, consider to use [Jsonnet functions](#jsonnet-functions). ```jsonnet { @@ -507,6 +509,8 @@ v2.4 or later supports Jsonnet native functions in Jsonnet files. - At first, define `local func = std.native('func');` in Jsonnet files. - Then, you can use `func()` in Jsonnet files. +The Jsonnet functions are evaluated at the time of rendering Jsonnet files. So you can avoid the conflict with template functions. + #### `env`, `must_env` `env` and `must_env` functions are the same as template functions in JSON and YAML files. @@ -520,11 +524,9 @@ local must_env = std.native('must_env'); } ``` -#### `json_escape` - -TODO +#### Other plugin-provided functions -Other plugin-provided functions are available in Jsonnet files. See [Plugins](#plugins) section. +See [Plugins](#plugins) section. ### Deploy to Fargate @@ -865,7 +867,7 @@ local tfstate = std.native('tfstate'); awsvpcConfiguration: { subnets: [ tfstate('aws_subnet.private["%s"].id' % 'az-z'), - tfstate(std.format('aws_subnet.private["%s"].id', ['az-b'])), + tfstate(std.format('aws_subnet.private["%s"].id', 'az-b')), ], securityGroups: [ tfstate('data.aws_security_group.default.id'), From e00353a419d8928261f56bfe9f5f4bb28d8b084f Mon Sep 17 00:00:00 2001 From: fujiwara Date: Sat, 20 Jul 2024 01:11:36 +0900 Subject: [PATCH 10/12] fix --- README.md | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index fdd03c28..a41bf039 100644 --- a/README.md +++ b/README.md @@ -258,9 +258,11 @@ Configuration files and task/service definition files are read by [go-config](ht ## Template syntax -ecspresso uses the [text/template standard package in Go](https://pkg.go.dev/text/template) to render template files, and parses as YAML/JSON/Jsonnet. By default, ecspresso provides the following as template functions. +ecspresso uses the [text/template standard package in Go](https://pkg.go.dev/text/template) to render template files, and parses as YAML or JSON. -If you are using Jsonnet, consider using ecspresso's [Jsonnet functions](#jsonnet-functions) instead of ecspresso's template functions. +If you use Jsonnet, ecspresso renders Jsonnet files first, then parses them as text/template. So, the template functions can render only string values by `"{{ ... }}"`, because the template function syntax `{{ }}` conflicts with Jsonnet syntax. Consider [Jsonnet functions](#jsonnet-functions) instead of template functions to render non-string values. + +By default, ecspresso provides the following as template functions. ### `env` @@ -506,21 +508,25 @@ $ ecspresso --ext-str Foo=foo --ext-code "Bar=1+1" ... v2.4 or later supports Jsonnet native functions in Jsonnet files. -- At first, define `local func = std.native('func');` in Jsonnet files. -- Then, you can use `func()` in Jsonnet files. +- At first, define `local func = std.native('func');` in a .jsonnet file. +- Then, you can use the `func()` in the .jsonnet file. -The Jsonnet functions are evaluated at the time of rendering Jsonnet files. So you can avoid the conflict with template functions. +The Jsonnet functions are evaluated at the time of rendering Jsonnet files. So you can avoid the conflict with template syntax. #### `env`, `must_env` `env` and `must_env` functions are the same as template functions in JSON and YAML files. +Unlike template functions, Jsonnet functions can render non-string values from environment variables by `std.parseInt()`, `std.parseBool()`, etc. + ```jsonnet local env = std.native('env'); local must_env = std.native('must_env'); { foo: env('FOO', 'default value'), bar: must_env('BAR'), + bazNumber: std.parseInt(env('BAZ_NUMBER', '0')), + booBool: std.parseBool(env('BOO_BOOL', 'false')), } ``` From 325aef2730f50f8526274d11f3b19a876029e7a8 Mon Sep 17 00:00:00 2001 From: fujiwara Date: Sat, 20 Jul 2024 01:16:09 +0900 Subject: [PATCH 11/12] parseJson --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a41bf039..d9884b71 100644 --- a/README.md +++ b/README.md @@ -517,7 +517,7 @@ The Jsonnet functions are evaluated at the time of rendering Jsonnet files. So y `env` and `must_env` functions are the same as template functions in JSON and YAML files. -Unlike template functions, Jsonnet functions can render non-string values from environment variables by `std.parseInt()`, `std.parseBool()`, etc. +Unlike template functions, Jsonnet functions can render non-string values from environment variables by `std.parseInt()`, `std.parseJson()`, etc. ```jsonnet local env = std.native('env'); @@ -526,7 +526,7 @@ local must_env = std.native('must_env'); foo: env('FOO', 'default value'), bar: must_env('BAR'), bazNumber: std.parseInt(env('BAZ_NUMBER', '0')), - booBool: std.parseBool(env('BOO_BOOL', 'false')), + booBool: std.parseJson(env('BOO_BOOL', 'false')), } ``` From 598243bbb4281aa7c3a8bfb4a5cb136e11d246d4 Mon Sep 17 00:00:00 2001 From: fujiwara Date: Sat, 20 Jul 2024 01:22:37 +0900 Subject: [PATCH 12/12] use std.parseJson --- tests/ci/ecs-service-def.jsonnet | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ci/ecs-service-def.jsonnet b/tests/ci/ecs-service-def.jsonnet index 211eb839..65c249d7 100644 --- a/tests/ci/ecs-service-def.jsonnet +++ b/tests/ci/ecs-service-def.jsonnet @@ -27,7 +27,7 @@ local isCodeDeploy = env('DEPLOYMENT_CONTROLLER', 'ECS') == 'CODE_DEPLOY'; }, desiredCount: std.parseInt(env('DESIRED_COUNT', '1')), enableECSManagedTags: false, - enableExecuteCommand: true, + enableExecuteCommand: std.parseJson(env('ENABLE_EXECUTE_COMMAND', 'true')), healthCheckGracePeriodSeconds: 0, loadBalancers: [ {