Skip to content

Commit

Permalink
they're just files, lets call them as such
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-dull committed Oct 4, 2024
1 parent 7dfd899 commit a67837f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
16 changes: 8 additions & 8 deletions .github/build_tests/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ terraform {
required_version = ">= 1.2.0"
}

resource "local_file" "example_file" {
content = "This is a simulated server configuration."
filename = "${path.module}/example_server.txt"
resource "local_file" "test_file" {
content = "This is a local file."
filename = "${path.module}/test.txt"
}

output "file_path" {
value = local_file.example_file.filename
value = local_file.test_file.filename
}

terraform {
Expand All @@ -20,16 +20,16 @@ terraform {
}
}

resource "null_resource" "simulated_server" {
resource "null_resource" "null_file" {
provisioner "local-exec" {
command = "echo 'Simulated server created at $(date)' > simulated_server.txt"
command = "echo Null resource created at $(date) > null_file.txt"
}

triggers = {
always_run = "${timestamp()}"
}
}

output "simulated_server_file" {
value = null_resource.simulated_server.id
output "null_file_output" {
value = null_resource.null_file.id
}
3 changes: 1 addition & 2 deletions .github/workflows/docker-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,11 @@ jobs:
terraform apply --auto-approve
docker logs ${{ env.INSTANCE_NAME }}
echo TFSTATE=$(curl -sS http://localhost:2442/?env=InT) | tee -a $GITHUB_ENV
cat example_server.txt
- name: Validate Terraform State
run: |
cd .github/build_tests
TF_CONTENT=$(echo '${{ env.TFSTATE }}' | jq -r '.resources[].instances[].attributes.content | select(. != null)')
FILE_CONTENT=$(cat example_server.txt)
FILE_CONTENT=$(cat test.txt.txt)
if [[ ${TF_CONTENT} != ${FILE_CONTENT} ]]; then
echo ${TF_CONTENT} != ${FILE_CONTENT} >&2
exit 1
Expand Down

0 comments on commit a67837f

Please sign in to comment.