From dcaf99dcc1d3f534feafa4073465ada162fff0dd Mon Sep 17 00:00:00 2001 From: Hunter Morris <4218+hntrmrrs@users.noreply.github.com> Date: Fri, 25 Mar 2022 15:50:52 +0000 Subject: [PATCH] client: Add AWS EC2 instance-life-cycle from metadata to client fingerprint (#12371) --- .changelog/12371.txt | 3 +++ client/fingerprint/env_aws.go | 1 + client/fingerprint/env_aws_test.go | 16 ++++++++++++++++ website/content/docs/runtime/interpolation.mdx | 6 ++++++ 4 files changed, 26 insertions(+) create mode 100644 .changelog/12371.txt diff --git a/.changelog/12371.txt b/.changelog/12371.txt new file mode 100644 index 000000000..e621c787f --- /dev/null +++ b/.changelog/12371.txt @@ -0,0 +1,3 @@ +```release-note:improvement +client: fingerprint AWS instance life cycle option +``` diff --git a/client/fingerprint/env_aws.go b/client/fingerprint/env_aws.go index 95af1cf87..b39317d1a 100644 --- a/client/fingerprint/env_aws.go +++ b/client/fingerprint/env_aws.go @@ -91,6 +91,7 @@ func (f *EnvAWSFingerprint) Fingerprint(request *FingerprintRequest, response *F "ami-id": false, "hostname": true, "instance-id": true, + "instance-life-cycle": false, "instance-type": false, "local-hostname": true, "local-ipv4": true, diff --git a/client/fingerprint/env_aws_test.go b/client/fingerprint/env_aws_test.go index caca5f4ba..c346b788d 100644 --- a/client/fingerprint/env_aws_test.go +++ b/client/fingerprint/env_aws_test.go @@ -52,6 +52,7 @@ func TestEnvAWSFingerprint_aws(t *testing.T) { "platform.aws.ami-id", "unique.platform.aws.hostname", "unique.platform.aws.instance-id", + "platform.aws.instance-life-cycle", "platform.aws.instance-type", "unique.platform.aws.local-hostname", "unique.platform.aws.local-ipv4", @@ -334,6 +335,11 @@ var awsStubs = []endpoint{ ContentType: "text/plain", Body: "i-b3ba3875", }, + { + Uri: "/latest/meta-data/instance-life-cycle", + ContentType: "text/plain", + Body: "on-demand", + }, { Uri: "/latest/meta-data/instance-type", ContentType: "text/plain", @@ -387,6 +393,11 @@ var unknownInstanceType = []endpoint{ ContentType: "text/plain", Body: "i-b3ba3875", }, + { + Uri: "/latest/meta-data/instance-life-cycle", + ContentType: "text/plain", + Body: "on-demand", + }, { Uri: "/latest/meta-data/instance-type", ContentType: "text/plain", @@ -417,6 +428,11 @@ var noNetworkAWSStubs = []endpoint{ ContentType: "text/plain", Body: "i-b3ba3875", }, + { + Uri: "/latest/meta-data/instance-life-cycle", + ContentType: "text/plain", + Body: "on-demand", + }, { Uri: "/latest/meta-data/instance-type", ContentType: "text/plain", diff --git a/website/content/docs/runtime/interpolation.mdx b/website/content/docs/runtime/interpolation.mdx index 31da7917f..a1c28f1c7 100644 --- a/website/content/docs/runtime/interpolation.mdx +++ b/website/content/docs/runtime/interpolation.mdx @@ -235,6 +235,12 @@ Below is a table documenting common node properties:
{'${attr.platform.aws.instance-life-cycle}'}
+ {'${attr.platform.aws.instance-type}'}