Release Channels
Creating a Release Channel named my-release-channel
in an existing Application named my-app
can be accomplished with the following config:
resource "prodvana_release_channel" "example" {
name = "my-release-channel"
application = "my-app"
}
See the Terraform Provider docs for an up-to-date list of configuration options.
Common Examples
Creating Application and Release Channels in the same module
You can create an Application and its Release Channels together in the same Terraform module:
resource "prodvana_application" "app" {
name = "my-app"
}
resource "prodvana_release_channel" "staging" {
name = "staging"
application = prodvana_application.app.name
}
resource "prodvana_release_channel" "prod" {
name = "prod"
application = prodvana_application.app.name
}
You may want to do this when your cloud infrastructure IaC all lives within one module.
This makes it easy to reference and pass details of your infrastructure to the Release Channel configuration. For example, if you wanted to pass a different default environment value to each Release Channel.
For example, let's imagine you have separate staging
and prod
environments that each get their own s3 bucket. We can pass the s3 bucket name as an environment variable like this:
resource "prodvana_application" "app" {
name = "my-app"
}
resource "aws_s3_bucket" "staging" {
bucket = "staging-bucket"
}
resource "prodvana_release_channel" "staging" {
name = "staging"
application = prodvana_application.app.name
policy = {
default_env = {
"S3_BUCKET" = {
value = aws_s3_bucket.staging.bucket
}
}
}
}
resource "aws_s3_bucket" "prod" {
bucket = "prod-bucket"
}
resource "prodvana_release_channel" "prod" {
name = "prod"
application = prodvana_application.app.name
policy = {
default_env = {
"S3_BUCKET" = {
value = aws_s3_bucket.prod.bucket
}
}
}
}
Creating Application and Release Channels in the different modules
Another common Terraform setup is to have separate modules per environment (like staging
and prod
) and a common module where non-environment specific resources are configured.
In this kind of setup you might have an infra
module that abstracts out the common environment resources like the environment S3 bucket and Release Channel:
resource "aws_s3_bucket" "staging" {
bucket = "${var.env}-bucket"
}
resource "prodvana_release_channel" "infra_bucket" {
name = var.env
application = var.pvn_app
policy = {
default_env = {
"S3_BUCKET" = {
value = aws_s3_bucket.infra_bucket.bucket
}
}
}
}
variable "env" {
type = string
}
variable "pvn_app" {
type = string
}
output "infra_bucket" {
value = "${aws_s3_bucket.infra_bucket.name"
}
And then a common module that creates the Prodvana Application and creates the two Release Channels.
resource "prodvana_application" "app" {
name = "my-app"
}
module "infra" {
source = "../modules/infra"
env = "staging"
pvn_app = prodvana_application.app.name
}
module "infra" {
source = "../modules/infra"
env = "prod"
pvn_app = prodvana_application.app.name
}
Updated 9 months ago