Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add from_env_var HCL function #20

Closed
traut opened this issue Jan 2, 2024 · 0 comments
Closed

Add from_env_var HCL function #20

traut opened this issue Jan 2, 2024 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@traut
Copy link
Member

traut commented Jan 2, 2024

Background

Hard-coding credentials in .fabric files is a bad practice, so there should be a way to load credentials during execution dynamically.

Design

Provide HCL function from_env_variable() that will take the name of the environment variable and load the value from it during execution (if the variable is set)

Important

Related issue: #4

Usage example:

// plugin configuration
config data elasticsearch "clusterB" {
    cloud_id = from_env_var("CLUSTER_B_CLOUD_ID")
    api_key = from_env_var("CLUSTER_B_API_KEY")
}

or for the inline config block

data elasticsearch "critical_alerts" {
  config {
    cloud_id = from_env_var("CLUSTER_B_CLOUD_ID")
    api_key  = from_env_var("CLUSTER_B_API_KEY")
  }

  index        = ".alerts-security.alerts-*"
  query_string = "kibana.alert.severity:critical AND @timestamp:[now-1d/d TO now]"
  size         = 10
}

Deliverables

  • from_env_var() function, to be executed during parsing of the templates
  • unit tests for the function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant