Cookie Consent by Free Privacy Policy Generator Aktuallisiere deine Cookie Einstellungen ๐Ÿ“Œ Environment Output Variables: Easy and Secure Output Piping


๐Ÿ“š Environment Output Variables: Easy and Secure Output Piping


๐Ÿ’ก Newskategorie: Programmierung
๐Ÿ”— Quelle: dev.to

Sharing information across environments has become even easier and more secure with the introduction of Environment Output Variables. This new feature simplifies sharing outputs of one environment with another in the same project or workflow, storing them securely on the env0 platform.ย 

Using environment outputs enhance our existing Workflows capability, making it even easier to define and manage complex dependencies, enabling you to:

  • Pipe outputs to dependent environments
  • Securely share sensitive values as outputs
  • Avoid complex scripting or data sources

In this post, we'll dig into what options you had before Environment Output Variables, how the new feature works, and how you can get started today.

Whatโ€™s New?

A common practice with Infrastructure-as-Code is to break large configurations into smaller, easier-to-manage environments. However, there will be dependencies between the environments and a need to share information across environments.

For example, an application deployment might require a subnet ID from a network environment and a database connection string from a database environment.

Prior to the introduction of Environment Output Variables, you could share the outputs of one environment with another through a few options. Each option has some potential downsides to consider.

Solutions and downsides

The Import Variable Plugin in particular was the preferred solution on env0 for accessing the outputs of other environments.ย 

However, using the plugin requires the creation and maintenance of an API key. Also, using the plugin ting requires writing a custom flow to add the step into the automation for an environment. Finally, and perhaps more importantly, the plugin couldnโ€™t support sensitive data outputs, meaning you had to select a different solution for sensitive data or mark them as insensitive.

Environment outputs offer a better and more elegant solution, native to env0, which does not require the addition of a custom flow or provisioning an API key.ย 

Moreover, here the output values are stored securely using encryption and secrets management, making support for sensitive data values possible.ย 

Let's dig into how Environment Output Variables work on env0.

How it works

As an example, let's say we have two environments. One deploys a Virtual Network and the other deploys an AKS cluster.ย 

The AKS cluster will need a subnet ID from the network environment. To share this information, we would first define an output in the VPC configuration that has the subnet ID for the AKS cluster to use:

output "aks_subnet_id" {
    value = module.network.vnet_subnets_name_id["aks"]
}

In the AKS environment configuration, there would be an input variable that accepts the subnet ID:

variable "vnet_subnet_id" {
    type = string
}

When setting up the variables for the AKS environment, we can define the value for the vnet_subnet_id input variable as the Environment Output aks_subnet_id from the network environment.

Once the Network environment has been provisioned, the output values will be available, and the AKS environment can be deployed without having to update any variable values.ย 

The output values from the source environment are stored on the env0 platform and secured using AWS Secrets Manager with KMS encryption. This makes Environment Output Variables a safe and secure option even for sensitive values.

Using Outputs with Workflows

Environment Output Variables can be used to share configuration data across environments in a project, but they are especially useful for Workflows. To understand why, let's quickly review what Workflows are.

What are env0 Workflows

Workflows in env0 are a declarative approach to describing the relationships between different environments. Each sub-environment in the workflow can reference an existing template or VCS repository housing a configuration.ย 

The workflow itself is stored as a template that projects can use as a golden path to streamline platform creation.

Workflows vastly simplify expressing the sequence, creation, and maintenance of each sub-environment.ย 

Using the declarative nature of Workflows, you can describe the complex relationships between deployments and initiate partial or full runs to create and update sub-environments.

Inside the workflow, the relationship between sub-environments is described using a needs block, referencing the sub-environments that the current entry is dependent on for deployment.ย 

Not only does this help with the initial deployment of resources in the proper sequence, but subsequent changes to any sub-environment can initiate a workflow run to update any dependent components.

Now, letโ€™s get back to our earlier example of a Virtual Network and AKS cluster.

Rather than having them as two separate environments in a project, workflows enable you to describe the relationship between each environment and the order in which they are deployed.

environments:
  network: 'Virtual Network'
    name: 'AKS Network'
    templateName: 'AppNetwork'
  aks:
    name: 'AKS Cluster'
    templateName: 'AKSCluster'
    needs:
      - network

When provisioning the Workflow, env0 creates a graph showing the relationship between sub-environments in the Workflow.

Workflows are truly a massive step forward in describing and managing complex deployments, but until now they did not share configuration data across the sub-environments. That is where Environment Output Variables come in!

Enter: Environment Output Variables

Workflows define the relationship between sub-environments, codifying what you would have previously expressed through custom scripts or tribal knowledge.ย 

Before Environment Output Variables, passing outputs from one sub-environment needed to be handled by another solution.ย 

This was often accomplished through the Import Variable Plugin or with terraform_remote_state data. Environment outputs replaces the need to use either of those solutions with a native approach that is simpler and more secure.

So how might Environment Output Variables be used in a workflow?

Here are a few examples:

  • Sharing subnet and environment information from a network deployment to an AKS deployment
  • Passing a database connection string from a database deployment to an application deployment
  • Passing the Kubernetes connection information and credentials to a Helm configuration

One especially tricky deployment is the bootstrapping of a Kubernetes cluster with a tool like ArgoCD or Flux after the cluster has been created. Workflows can assist with sequencing tasks and handling dependencies, and output variables can be used to pass the Kubernetes connection information.

Whatโ€™s next

Output variables are a great way to pass configuration data between environments in the same project, but there's more goodness to come.

Importantly, the feature capabilities are not limited to OpenTofu and Terraform. Terragrunt, Pulumi, and CloudFormation are all supported as output sources and all IaC Frameworks on env0 can make use of Environment Output Variables as inputs. Support for Helm and Kubernetes as output sources is coming soon.

For shared infrastructure scenarios, you may want to share output values with environments in different projects or Workflows.ย For instance, sharing Kubernetes cluster information with multiple applications in separate projects.

Coming soon, we will add the ability for Environment Output Variables to reference outputs in other projects.

We're excited for you to try out Environment Output Variables and listen to your feedback!ย 

We invite you to schedule a demo to get a better idea of how Workflows and Environment Output Variables - and env0 in general - could streamline and improve your IaC journey.

...



๐Ÿ“Œ Environment Output Variables: Easy and Secure Output Piping


๐Ÿ“ˆ 87.23 Punkte

๐Ÿ“Œ File Descriptors, Input and Output redirection and Piping Data in Linux shell


๐Ÿ“ˆ 40.8 Punkte

๐Ÿ“Œ The value prop of having a Linux shell with utilities and piping is not easy to articulate, any ideas ?


๐Ÿ“ˆ 36.01 Punkte

๐Ÿ“Œ Blocker: How to load environment variables on broswer environment using webpack.config.js


๐Ÿ“ˆ 32.57 Punkte

๐Ÿ“Œ How to Print Environment Variables in Powershell: 3 Easy Tips


๐Ÿ“ˆ 31.27 Punkte

๐Ÿ“Œ Refactoring instance variables to local variables in Rails controllers


๐Ÿ“ˆ 28.94 Punkte

๐Ÿ“Œ How to Use Piping and Redirection in the Linux Terminal


๐Ÿ“ˆ 28.27 Punkte

๐Ÿ“Œ If I want to pass images around between different programs in realtime, is piping jpegs the standard way to do it?


๐Ÿ“ˆ 26.75 Punkte

๐Ÿ“Œ Linux Essentials For Hackers - #6 - grep & piping


๐Ÿ“ˆ 26.75 Punkte

๐Ÿ“Œ ShellPiper - The Piping Editor!


๐Ÿ“ˆ 26.75 Punkte

๐Ÿ“Œ Piping botnet: Researchers warns of possible cyberattacks against urban water services


๐Ÿ“ˆ 26.75 Punkte

๐Ÿ“Œ Piping incoming TTY serial data into X11 as generic keyboard input?


๐Ÿ“ˆ 26.75 Punkte

๐Ÿ“Œ Piping Hot: The Power of Pipe() in Node.js Streams


๐Ÿ“ˆ 26.75 Punkte

๐Ÿ“Œ Finding and solving a nasty bug with Cloud Run and environment variables


๐Ÿ“ˆ 26.57 Punkte

๐Ÿ“Œ Set Environment Variables for Debug, Launch, and Tools with CMake and Open Folder


๐Ÿ“ˆ 26.57 Punkte

๐Ÿ“Œ New Unix tool to permanently export environment variables, aliases, and sourced shell files


๐Ÿ“ˆ 25.04 Punkte

๐Ÿ“Œ How to Set and Use Environment Variables In Bash Script


๐Ÿ“ˆ 25.04 Punkte

๐Ÿ“Œ Using environment variables in React and Vite


๐Ÿ“ˆ 25.04 Punkte

๐Ÿ“Œ audit full command line AND environment variables


๐Ÿ“ˆ 25.04 Punkte

๐Ÿ“Œ Handling Environment Variables in Nuxt 3: Security Considerations and Best Practices


๐Ÿ“ˆ 25.04 Punkte

๐Ÿ“Œ Hacking with Environment Variables


๐Ÿ“ˆ 23.52 Punkte

๐Ÿ“Œ Shells & Setting Environment Variables Permanently in Linux [Noobs]


๐Ÿ“ˆ 23.52 Punkte

๐Ÿ“Œ Analyzing the Hidden Danger of Environment Variables for Keeping Secrets


๐Ÿ“ˆ 23.52 Punkte

๐Ÿ“Œ AWS Credentials: from Environment Variables to credentials_process


๐Ÿ“ˆ 23.52 Punkte

๐Ÿ“Œ Complete List of Environment Variables in Windows 11


๐Ÿ“ˆ 23.52 Punkte

๐Ÿ“Œ Environment Variables in Python


๐Ÿ“ˆ 23.52 Punkte

๐Ÿ“Œ How To Set Path Environment Variables In Windows 10


๐Ÿ“ˆ 23.52 Punkte

๐Ÿ“Œ How To Set Path Environment Variables In Windows 10


๐Ÿ“ˆ 23.52 Punkte

๐Ÿ“Œ How to recover path environment variables on Windows 10


๐Ÿ“ˆ 23.52 Punkte

๐Ÿ“Œ How to recover path environment variables on Windows 10


๐Ÿ“ˆ 23.52 Punkte

๐Ÿ“Œ Securely store environment variables with GitHub Codespaces


๐Ÿ“ˆ 23.52 Punkte

๐Ÿ“Œ How to Replace Environment Variables Using the envsubst Command


๐Ÿ“ˆ 23.52 Punkte

๐Ÿ“Œ AWS Lambda Cookbook โ€” Elevate your handlerโ€™s code โ€” Part 4 โ€” Environment Variables


๐Ÿ“ˆ 23.52 Punkte

๐Ÿ“Œ How to Pass Environment Variables to a YAML File in a Node.js Application using EJS Templating Engine


๐Ÿ“ˆ 23.52 Punkte











matomo