Skip to content

Commit

Permalink
Set pipeline state as terraform variables
Browse files Browse the repository at this point in the history
  • Loading branch information
martenlindblad committed Dec 4, 2024
1 parent d707e78 commit c5103fb
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion config/config.yaml.tftpl
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ vertex_ai:
use_private_service_access: false
# The `state` defines the state of the pipeline.
# In case you don't want to schedule the pipeline, set the state to `PAUSED`.
state: PAUSED # possible states ACTIVE or PAUSED
state: '${pipeline_configuration.feature-creation-auto-audience-segmentation.execution.schedule.state}'
# The `pipeline_parameters` defines the parameters that are going to be used to compile the pipeline.
# Those values may difer depending on the pipeline type and the pipeline steps being used.
# Make sure you review the python function the defines the pipeline.
Expand Down
1 change: 1 addition & 0 deletions infrastructure/terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ resource "local_file" "feature_store_configuration" {
# TODO: this needs to be specific to environment.
location = var.destination_data_location
time_zone = var.time_zone
pipeline_configuration = var.pipeline_configuration
})
}

Expand Down
30 changes: 30 additions & 0 deletions infrastructure/terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -241,3 +241,33 @@ variable "time_zone" {
type = string
default = "America/New_York"
}

variable "pipeline_configuration" {
description = "Pipeline configuration that will alternate certain settings in the config.yaml.tftpl"
type = map(object({
execution = object({
schedule = object({
state = string
})
})
}))

default = {
feature-creation-auto-audience-segmentation = {
execution = {
schedule = {
state = "PAUSED"
}
}
}
}
validation {
condition = alltrue([
for k in keys(var.pipeline_configuration) : (
var.pipeline_configuration[k].execution.schedule.state == "ACTIVE" ||
var.pipeline_configuration[k].execution.schedule.state == "PAUSED"
)
])
error_message = "The 'state' field must be either 'PAUSED' or 'ACTIVE' for all pipeline configurations."
}
}

0 comments on commit c5103fb

Please sign in to comment.