diff --git a/Makefile b/Makefile index ad068af..1bf9707 100644 --- a/Makefile +++ b/Makefile @@ -25,11 +25,8 @@ export TF_VAR_MATURITY=${MATURITY} export TF_VAR_DEPLOY_NAME=${DEPLOY_NAME} PYTHON_VER ?= python3 - -CIRRUS_DAAC_BRANCH := $(shell git -C $(DAAC_DIR) rev-parse --abbrev-ref HEAD) -CIRRUS_CORE_BRANCH := $(shell git rev-parse --abbrev-ref HEAD) -CIRRUS_DAAC_TAG := $(shell git -C $(DAAC_DIR) describe --tags --abbrev=0) -CIRRUS_CORE_TAG := $(shell git describe --tags --abbrev=0) +CIRRUS_CORE_VERSION := $(or $(shell git tag --points-at HEAD | head -n1),$(shell git rev-parse --short HEAD)) +CIRRUS_DAAC_VERSION := $(or $(shell git -C $(DAAC_DIR) tag --points-at HEAD | head -n1),$(shell git -C $(DAAC_DIR) rev-parse --short HEAD)) # --------------------------- SELF_DIR := $(dir $(realpath $(firstword $(MAKEFILE_LIST)))) @@ -65,10 +62,8 @@ container-shell: --env AWS_CONFIG_DIR="/" \ --env PS1='\s-\v:\w\$$ ' \ --env HISTFILE="/CIRRUS-core/.container_bash_history" \ - --env TF_VAR_CIRRUS_CORE_BRANCH=${CIRRUS_CORE_BRANCH} \ - --env TF_VAR_CIRRUS_DAAC_BRANCH=${CIRRUS_DAAC_BRANCH} \ - --env TF_VAR_CIRRUS_CORE_TAG=${CIRRUS_CORE_TAG} \ - --env TF_VAR_CIRRUS_DAAC_TAG=${CIRRUS_DAAC_TAG} \ + --env TF_VAR_CIRRUS_CORE_VERSION=${CIRRUS_CORE_VERSION} \ + --env TF_VAR_CIRRUS_DAAC_VERSION=${CIRRUS_DAAC_VERSION} \ -v ${PWD}:/CIRRUS-core \ -v ${DAAC_DIR}:/CIRRUS-DAAC \ -v ${HOME}/.aws:/.aws \ diff --git a/cumulus/outputs.tf b/cumulus/outputs.tf index 17b77a5..6144941 100644 --- a/cumulus/outputs.tf +++ b/cumulus/outputs.tf @@ -143,3 +143,11 @@ output "background_job_queue_url" { output "vpc" { value = data.aws_vpc.application_vpcs.id } + +output "cirrus_core_version" { + value = var.CIRRUS_CORE_VERSION +} + +output "cirrus_daac_version" { + value = var.CIRRUS_DAAC_VERSION +} diff --git a/cumulus/variables.tf b/cumulus/variables.tf index 0e131dd..de23110 100644 --- a/cumulus/variables.tf +++ b/cumulus/variables.tf @@ -8,6 +8,14 @@ variable "MATURITY" { default = "dev" } +variable "CIRRUS_CORE_VERSION" { + type = string +} + +variable "CIRRUS_DAAC_VERSION" { + type = string +} + variable "cmr_environment" { type = string } diff --git a/data-persistence/outputs.tf b/data-persistence/outputs.tf index c58365c..c80ca45 100644 --- a/data-persistence/outputs.tf +++ b/data-persistence/outputs.tf @@ -25,3 +25,11 @@ output "rds_security_group_id" { output "rds_user_access_secret_arn" { value = data.terraform_remote_state.rds.outputs.rds_user_access_secret_arn } + +output "cirrus_core_version" { + value = var.CIRRUS_CORE_VERSION +} + +output "cirrus_daac_version" { + value = var.CIRRUS_DAAC_VERSION +} diff --git a/data-persistence/variables.tf b/data-persistence/variables.tf index 46c64f1..bf59290 100644 --- a/data-persistence/variables.tf +++ b/data-persistence/variables.tf @@ -7,6 +7,14 @@ variable "MATURITY" { default = "dev" } +variable "CIRRUS_CORE_VERSION" { + type = string +} + +variable "CIRRUS_DAAC_VERSION" { + type = string +} + variable "include_elasticsearch" { type = bool default = true diff --git a/tf/locals.tf b/tf/locals.tf index a885fbb..0ae79ff 100644 --- a/tf/locals.tf +++ b/tf/locals.tf @@ -3,9 +3,6 @@ locals { aws_account_id = data.aws_caller_identity.current.account_id aws_account_id_last4 = substr(data.aws_caller_identity.current.account_id, -4, 4) - cirrus_core_version = var.CIRRUS_CORE_BRANCH == "HEAD" ? var.CIRRUS_CORE_TAG: var.CIRRUS_CORE_BRANCH - cirrus_daac_version = var.CIRRUS_DAAC_BRANCH == "HEAD" ? var.CIRRUS_DAAC_TAG: var.CIRRUS_DAAC_BRANCH - default_tags = { Deployment = local.prefix } diff --git a/tf/main.tf b/tf/main.tf index 82f0840..b96c888 100644 --- a/tf/main.tf +++ b/tf/main.tf @@ -26,18 +26,3 @@ resource "aws_dynamodb_table" "backend-tf-locks-table" { } tags = local.default_tags } - -resource "aws_s3_object" "cirrus-versions" { - bucket = aws_s3_bucket.backend-tf-state-bucket.id - key = "cirrus-versions.json" - content_type = "application/json" - - content = <