Replies: 2 comments
-
|
this is github action file sample. name: terraform Controls when the workflow will runon: Triggers the workflow on push or pull request events but only for the "main" branchpush: Allows you to run this workflow manually from the Actions tabworkflow_dispatch: env: A workflow run is made up of one or more jobs that can run sequentially or in paralleljobs: This workflow contains a single job called "build"terraform_plan: |
Beta Was this translation helpful? Give feedback.
-
|
Yes. Make the suffix a Terraform variable, then pass it from GitHub Actions with variable "environment" {
type = string
}
resource "azurerm_resource_group" "example" {
name = "rg-${var.environment}"
location = "West Europe"
}env:
TF_VAR_environment: testFor prod/stage, set |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to use github action for terraform multistage deployment. i want to know how to create a custom variable in github action level which will refer the terraform files.
example - i am creating resource group name "rg" in my main.tf file. i have to deploy it to test , prod and stage environment . i want to add some suffix to this name like "rg-test" ," rg-prod" in github action level.
is it possible to create a environment variable in github action level and how it will access the terraform file(rg name).
this is my main.tf file.
resource "azurerm_resource_group" "example" {
name = "rg"
location = "West Europe"
}
Can we set anything on github action level so that whenever github action job for test env runs ,it will add ENV variable in the "name".
example - "rg-test" based on env name.
Beta Was this translation helpful? Give feedback.
All reactions