diff --git a/.github/workflows/terraform-apply.yml b/.github/workflows/terraform-apply.yml index e257e27..30bf76f 100644 --- a/.github/workflows/terraform-apply.yml +++ b/.github/workflows/terraform-apply.yml @@ -80,7 +80,7 @@ jobs: - name: Save Public IP if: steps.terraform-operation.outcome == 'success' && github.event.inputs.operation != 'destroy' run: | - echo "public_ip=$(terraform output -raw instance_public_ip)" > public_ip_env.txt + terraform output instance_public_ip > public_ip_env.txt cat public_ip_env.txt working-directory: ./terraform diff --git a/.github/workflows/terraform-plan.yml b/.github/workflows/terraform-plan.yml index bb6f133..d86c022 100644 --- a/.github/workflows/terraform-plan.yml +++ b/.github/workflows/terraform-plan.yml @@ -52,7 +52,10 @@ jobs: - name: Terraform Plan id: plan - run: terraform plan -out=tfplan.out + run: | + terraform plan -out=tfplan.out \ + -var="ami_id=ami-005fc0f236362e99f" \ + -var="instance_type=t2.large" working-directory: ./terraform - name: Save Plan JSON @@ -73,18 +76,22 @@ jobs: - name: Run Infracost run: | - infracost breakdown --path=./terraform --format=json --out-file=/tmp/infracost-base.json + infracost breakdown --path=./terraform --format=json --out-file=/tmp/infracost-base.json # Checkout the current PR branch so we can create a diff. - name: Checkout PR branch uses: actions/checkout@v4 - name: Generate Infracost diff run: | - infracost breakdown --path=./terraform --format=table --out-file=/tmp/infracost-new.txt - infracost diff --path=./terraform \ + infracost breakdown --path=./terraform --format=table --out-file=/tmp/infracost-new.txt \ + --terraform-var "ami_id=ami-005fc0f236362e99f" \ + --terraform-var "instance_type=t2.large" + infracost diff --path=./terraform \ --format=json \ --compare-to=/tmp/infracost-base.json \ - --out-file=/tmp/infracost.json + --out-file=/tmp/infracost.json \ + --terraform-var "ami_id=ami-005fc0f236362e99f" \ + --terraform-var "instance_type=t2.large" - name: Post Infracost Comment run: | diff --git a/ansible/compose.monitoring.yml b/ansible/compose.monitoring.yml index c940288..2012d46 100644 --- a/ansible/compose.monitoring.yml +++ b/ansible/compose.monitoring.yml @@ -88,6 +88,7 @@ services: - monitor-network volumes: - ./monitoring/promtail-config.yml:/etc/promtail/promtail-config.yaml + - /var/log:/var/log depends_on: - loki diff --git a/terraform/ec2.tf b/terraform/ec2.tf index 718e7ab..6a1b191 100644 --- a/terraform/ec2.tf +++ b/terraform/ec2.tf @@ -11,15 +11,4 @@ resource "aws_instance" "ec2" { provisioner "local-exec" { command = "echo 'Instance provisioned: ${self.public_ip}'" } -} - -resource "aws_instance" "ec2-2" { - ami = var.ami_id - instance_type = var.instance_type - key_name = var.key_pair_name - subnet_id = aws_subnet.public_subnet.id - vpc_security_group_ids = [aws_security_group.sg.id] - tags = { - Name = var.ec2_name - } } \ No newline at end of file