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

Add tags to the provisioned EC deployment #3114

Merged
merged 3 commits into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dev-tools/cloud/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ build-and-push-cloud-image:
.PHONY: cloud-deploy
cloud-deploy: build-and-push-cloud-image ## Create a new cloud deployment
@cd ${TERRAFORM_PATH}; echo 'elastic_agent_docker_image="${CI_ELASTIC_AGENT_DOCKER_IMAGE}:${CUSTOM_IMAGE_TAG}"' > docker_image.auto.tfvars
@cd ${TERRAFORM_PATH}; terraform init; terraform apply -auto-approve
@cd ${TERRAFORM_PATH}; terraform init; terraform apply -auto-approve -var="pull_request=${GITHUB_PR_NUMBER}" -var="creator=${GITHUB_PR_HEAD_USER}" -var="buildkite_id=${BUILDKITE_BUILD_NUMBER}"

.PHONY: cloud-clean
cloud-clean: ## Clean cloud deployment
Expand Down
24 changes: 23 additions & 1 deletion dev-tools/cloud/terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,24 @@ locals {
resource "random_uuid" "name" {
}

variable "pull_request" {
type=string
default=""
description="The github pull request number"
}

variable "buildkite_id" {
type=string
default=""
description="The Buildkite build id associated with this deployment"
}

variable "creator" {
type=string
default=""
description="The Buildkite user who created the job"
}

resource "ec_deployment" "deployment" {
name = format("fleet server PR %s", random_uuid.name.result)
region = "gcp-us-west2"
Expand All @@ -34,7 +52,11 @@ resource "ec_deployment" "deployment" {
tags = {
"created_with_terraform" = "true"
"docker_image_ea" = local.docker_image_ea
}
"provisioner" = "terraform"
"pull_request" = var.pull_request
"buildkite_id" = var.buildkite_id
"creator" = var.creator
}

elasticsearch {}

Expand Down
Loading