Skip to content

Commit

Permalink
fix: remove null_data_sources (#184)
Browse files Browse the repository at this point in the history
Signed-off-by: Agustín Díaz <[email protected]>
Co-authored-by: Bharath KKB <[email protected]>
  • Loading branch information
AgustinRamiroDiaz and bharathkkb authored Nov 30, 2023
1 parent 48c06c9 commit 0ffb9b2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 22 deletions.
11 changes: 2 additions & 9 deletions examples/automatic-labelling-from-repository/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,6 @@ resource "null_resource" "configure_repository" {
}
}

data "null_data_source" "main" {
inputs = {
source_repository_url = "https://source.developers.google.com/projects/${var.project_id}/repos/${random_pet.main.id}/moveable-aliases/master/paths/"
}

depends_on = [null_resource.configure_repository]
}

module "event_project_log_entry" {
source = "../../modules/event-project-log-entry"

Expand All @@ -71,11 +63,12 @@ module "repository_function" {
name = random_pet.main.id
project_id = var.project_id
region = var.region
source_repository_url = data.null_data_source.main.outputs["source_repository_url"]
source_repository_url = "https://source.developers.google.com/projects/${var.project_id}/repos/${random_pet.main.id}/moveable-aliases/master/paths/"

timeouts = {
update = "10m"
}
depends_on = [null_resource.configure_repository]
}

resource "null_resource" "wait_for_function" {
Expand Down
16 changes: 3 additions & 13 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,13 @@ resource "null_resource" "dependent_files" {
}
}

data "null_data_source" "wait_for_files" {
inputs = {
# This ensures that this data resource will not be evaluated until
# after the null_resource has been created.
dependent_files_id = null_resource.dependent_files.id

# This value gives us something to implicitly depend on
# in the archive_file below.
source_dir = pathexpand(var.source_directory)
}
}

data "archive_file" "main" {
type = "zip"
output_path = pathexpand("${var.source_directory}.zip")
source_dir = data.null_data_source.wait_for_files.outputs["source_dir"]
source_dir = pathexpand(var.source_directory)
excludes = var.files_to_exclude_in_source_dir

depends_on = [null_resource.dependent_files]
}


Expand Down

0 comments on commit 0ffb9b2

Please sign in to comment.