Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(perf): use $Latest launch template #257

Merged
merged 5 commits into from
Aug 17, 2023
Merged

fix(perf): use $Latest launch template #257

merged 5 commits into from
Aug 17, 2023

Conversation

mxinden
Copy link
Member

@mxinden mxinden commented Aug 14, 2023

Our perf terraform setup differentiates in long lived and short lived resources.

On CI, our long lived resources are spun up once and our short lived resources are spun up on each CI run. From time to time we have to adjust the long lived resources. End result is a new launch template that needs to be referenced in the short lived resources by version.

Next to our CI, the perf terraform setup can as well be used on personal AWS accounts. Their long lived launch template version likely doesn't match the configured launch template version of the short lived aws_instance.

Instead of specifying a specific version, instruct terraform to use the latest, thus supporting both our CI and personal AWS account use-case.

See also terraform aws_instance specification.

https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/instance#launch-template-specification

Our perf terraform setup differentiates in long lived and short lived resources.
On CI, our long lived resources are spun up once and our short lived resources
are spun up on each CI run. From time to time we have to adjust the long lived
resources. End result is a new launch template that needs to be referenced in
the short lived resources by version.

Next to our CI, the perf terraform setup can as well be used on personal AWS
accounts. Their long lived launch template version likely doesn't match the
configured launch template version of the short lived aws_instance.

Instead of specifying a specific version, instruct terraform to use the latest,
thus supporting both our CI and personal AWS account use-case.

See also terraform `aws_instance` specification.

https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/instance#launch-template-specification
@mxinden
Copy link
Member Author

mxinden commented Aug 14, 2023

//CC @marten-seemann this would make your life a bit easier, i.e. not require the diff below:

modified   perf/terraform/modules/short_lived/main.tf
@@ -19,7 +19,7 @@ resource "aws_instance" "perf" {
 
   launch_template {
     name = "perf-node"
-    version = "4"
+    version = "1"
   }
 
   key_name = aws_key_pair.perf.key_name

@mxinden
Copy link
Member Author

mxinden commented Aug 14, 2023

@galargh do you have alternative suggestions?

@mxinden mxinden requested a review from galargh August 14, 2023 07:39
@mxinden
Copy link
Member Author

mxinden commented Aug 14, 2023

@mxinden mxinden changed the title fix(perf): use latest launch template fix(perf): use $Latest launch template Aug 14, 2023
@galargh
Copy link
Contributor

galargh commented Aug 16, 2023

I see it was added here #241 and before that we were defaulting to the $Default version (as per https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/instance#launch-template-specification).

The other option would be to set update_default_version to true on aws_launch_template.perf, and then use the $Default here again.

It'd be pretty much the same thing though so it's just a matter of preference.

@mxinden
Copy link
Member Author

mxinden commented Aug 17, 2023

Today I learned about update_default_version. Changed to it. Thank you @galargh.

Triggered run: https://github.com/libp2p/test-plans/actions/runs/5889989158/job/15974217657

@mxinden mxinden merged commit e5b7e0e into master Aug 17, 2023
@mxinden mxinden deleted the perf-launch-latest branch August 17, 2023 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants