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

smoke: Fix smoke test Terraform issue #15901

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ericywl
Copy link
Contributor

@ericywl ericywl commented Feb 27, 2025

Motivation/summary

Fix smoke test issue:

-> Adding tfvar integrations_server="false"
-> Applying terraform configuration...

Error: Invalid index

  on ../../infra/terraform/modules/ec_deployment/outputs.tf line 53, in output "apm_component_id":
  53:   value       = ec_deployment.deployment.integrations_server[0].resource_id
    ├────────────────
    │ ec_deployment.deployment.integrations_server is empty list of object

The given key does not identify an element in this collection value: the
collection has no elements.

Error: Invalid index

  on ../../infra/terraform/modules/ec_deployment/outputs.tf line 58, in output "fleet_component_id":
  58:   value       = ec_deployment.deployment.integrations_server[0].resource_id
    ├────────────────
    │ ec_deployment.deployment.integrations_server is empty list of object

The given key does not identify an element in this collection value: the
collection has no elements.

How to test these changes

Run smoke test again.

Test run: https://github.com/elastic/apm-server/actions/runs/13560141549, it seems the usual ones are passing again.

@ericywl ericywl requested a review from a team as a code owner February 27, 2025 05:09
description = "APM Cloud component ID"
}

output "fleet_component_id" {
value = ec_deployment.deployment.integrations_server[0].resource_id
value = var.integrations_server ? ec_deployment.deployment.integrations_server[0].resource_id : ""
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[For reviewers] Not sure what this should fallback to

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@endorama Do you have any idea?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the distinction between integrations_server and apm resource even bleeding into our code? Having one variable defined in terraform that abstracts this sound the right path forward. @ericywl you are on a good path here already, adding the fallback for apm resource. @endorama is there any reason why apm_component_id and fleet_component_id would be needed? (Given that they currently point to the same resource I would not think so).

Quick recap: in cloud the old resource was apm, and the newer one (introduced in 8.0) is integrations_server. Currently both can exist, for deployments created in 7.x the resource will be apm, for newer deployments resource will be integrations_server (if not explicitly migrated, which we don't do here).

Copy link
Contributor

mergify bot commented Feb 27, 2025

This pull request does not have a backport label. Could you fix it @ericywl? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-7.17 is the label to automatically backport to the 7.17 branch.
  • backport-8./d is the label to automatically backport to the 8./d branch. /d is the digit.
  • backport-9./d is the label to automatically backport to the 9./d branch. /d is the digit.
  • backport-8.x is the label to automatically backport to the 8.x branch.
  • backport-active-all is the label that automatically backports to all active branches.
  • backport-active-8 is the label that automatically backports to all active minor branches for the 8 major.
  • backport-active-9 is the label that automatically backports to all active minor branches for the 9 major.

@ericywl ericywl changed the title Fix smoke test issue Fix smoke test Terraform issue Feb 27, 2025
@ericywl ericywl changed the title Fix smoke test Terraform issue fix: Smoke test Terraform issue Feb 27, 2025
@ericywl ericywl changed the title fix: Smoke test Terraform issue smoke: Fix smoke test Terraform issue Feb 27, 2025
@ericywl
Copy link
Contributor Author

ericywl commented Feb 27, 2025

Seems like there is still this issue (which is from before?):

Error: failed tracking create progress: 2 errors occurred:
	* found deployment plan errors: deployment [2ae8abcda33623d520648761a5f7b15a] - [apm][15bf782c863f4d8886efe95cc106e386]: caught error: "Plan change failed: Some instances were not running"
	* set "request_id" to "h8e5sbnwngz1qquqj7wm0a8emq4pqj9n4sgcwryug2ga41ljtkobsc49l4d7ruuy" to recreate the deployment resources

  with module.ec_deployment.ec_deployment.deployment,
  on ../../infra/terraform/modules/ec_deployment/deployment.tf line 17, in resource "ec_deployment" "deployment":
  17: resource "ec_deployment" "deployment" {

@ericywl ericywl added the backport-skip Skip notification from the automated backport with mergify label Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-skip Skip notification from the automated backport with mergify
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants