Skip to content

Commit

Permalink
more touchups
Browse files Browse the repository at this point in the history
  • Loading branch information
candonov committed Jan 21, 2024
1 parent b38b897 commit f991e45
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 18 deletions.
12 changes: 9 additions & 3 deletions patterns/kubecost/run-me-in-24h/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
provider "aws" {
region = data.terraform_remote_state.main.outputs.region
region = local.region
}
data "aws_caller_identity" "current" {}
data "aws_availability_zones" "available" {}
Expand All @@ -13,6 +13,12 @@ data "terraform_remote_state" "main" {
}
}

locals {
region = data.terraform_remote_state.main.outputs.region
cur_bucket_id = data.terraform_remote_state.main.outputs.cur_bucket_id
s3_cur_report_prefix = data.terraform_remote_state.main.outputs.s3_cur_report_prefix
}

################################################################################
# Athena
################################################################################
Expand All @@ -24,8 +30,8 @@ resource "null_resource" "download_file" {

provisioner "local-exec" {
command = <<EOT
if aws s3 ls s3://${data.terraform_remote_state.main.outputs.cur_bucket_id}/${data.terraform_remote_state.main.outputs.s3_cur_report_prefix}/kubecost/crawler-cfn.yml; then
aws s3 cp s3://${data.terraform_remote_state.main.outputs.cur_bucket_id}/${data.terraform_remote_state.main.outputs.s3_cur_report_prefix}/kubecost/crawler-cfn.yml crawler-cfn.yml
if aws s3 ls s3://${local.cur_bucket_id}/${local.s3_cur_report_prefix}/kubecost/crawler-cfn.yml; then
aws s3 cp s3://${local.cur_bucket_id}/${local.s3_cur_report_prefix}/kubecost/crawler-cfn.yml crawler-cfn.yml
else
echo "The crawler-cfn.yml does not exist yet. Come back and run terraform apply again in 24h."
fi
Expand Down
15 changes: 0 additions & 15 deletions patterns/kubecost/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,5 @@ terraform {
source = "hashicorp/kubernetes"
version = ">= 2.20"
}
random = {
source = "hashicorp/random"
version = ">= 3.5"
}
bcrypt = {
source = "viktorradnai/bcrypt"
version = ">= 0.1.2"
}
}

# ## Used for end-to-end testing on project; update to suit your needs
# backend "s3" {
# bucket = "terraform-ssp-github-actions-state"
# region = "us-west-2"
# key = "e2e/argocd/terraform.tfstate"
# }
}

0 comments on commit f991e45

Please sign in to comment.