diff --git a/README.md b/README.md
index c81cf8a..354c99a 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,6 @@
| Name | Version |
|------|---------|
-| [local](#provider\_local) | ~> 2.5 |
| [null](#provider\_null) | ~> 3.0 |
## Modules
@@ -25,7 +24,6 @@ No modules.
| Name | Type |
|------|------|
| [null_resource.create_cluster](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource |
-| [local_file.cluster_output](https://registry.terraform.io/providers/hashicorp/local/latest/docs/data-sources/file) | data source |
## Inputs
diff --git a/locals.tf b/locals.tf
index 0080a13..acf62fc 100644
--- a/locals.tf
+++ b/locals.tf
@@ -73,5 +73,24 @@ locals {
)
)
+
output_file = "${path.module}/cluster_output.txt"
+
+ # Safely read the output file if it exists
+ raw_output = try(
+ fileexists(local.output_file) ? file(local.output_file) : "",
+ ""
+ )
+
+ # Parse the output lines safely
+ output_lines = compact(split("\n", local.raw_output))
+
+ # Create the output map with proper error handling
+ output_map = {
+ for line in local.output_lines :
+ split("::", line)[0] => split("::", line)[1]
+ if length(split("::", line)) == 2
+ }
}
+
+
diff --git a/main.tf b/main.tf
index 4714250..3184216 100644
--- a/main.tf
+++ b/main.tf
@@ -18,21 +18,3 @@ resource "null_resource" "create_cluster" {
}
}
-data "local_file" "cluster_output" {
- filename = local.output_file
- depends_on = [null_resource.create_cluster]
-}
-
-locals {
- output_lines = try(
- compact(split("\n", data.local_file.cluster_output.content)),
- []
- )
- output_map = try(
- { for line in local.output_lines :
- split("::", line)[0] => split("::", line)[1]
- if length(split("::", line)) == 2
- },
- {}
- )
-}