English 中文(简体)
1.Terragrunt界定了拟由另一个档案使用的价值。
原标题:Terragrunt defining a value in .hcl that is to be used by another file

I am trying to create a terragrunt structure (I am a bit of a newbie) for a few "apps", here is how my structure looks like:

├── apps
│   ├── app3
│   │   ├── dev
│   │   │   ├── backend.tf
│   │   │   ├── provider.tf
│   │   │   └── terragrunt.hcl
│   │   └── terragrunt.hcl
│   ├── core-api
│   │   ├── dev
│   │   │   ├── backend.tf
│   │   │   ├── provider.tf
│   │   │   └── terragrunt.hcl
│   │   └── terragrunt.hcl
│   └── terragrunt.hcl
├── envrc
└── terragrunt-configs
    ├── config.hcl
    └── envs
        ├── default.yaml
        ├── dev
        │   └── default.yaml
        └── staging
            └── default.yaml

I run terragrunt from each app/env folder, for instance apps/app3/dev. Now, on one app terragrun I need to define a value that is to be used by another file. I say value, because I do not mind if this is a valiable, locals or other things. Here is how my base file looks like in apps/app3/dev/terragrunt.hcl:

include "config" {
  path = find_in_parent_folders("/terragrunt-configs/config.hcl")
}

include "thisappcommon" {
  path = "../terragrunt.hcl"
  merge_strategy = "deep"
}

include "allappscommon" {
  path = "../../terragrunt.hcl"
  merge_strategy = "deep"
}

inputs = {
  datadog_monitors = {}
}

我试图在这里增加一个当地人,而我却想使用其他东西。 页: 1 然后从另一个档案中将其称为apps/terragrunt.hcl/code>:

terraform {
  source = "git::[email protected]:some-repo//monitors"
}

locals {
  env_dir = "${basename(path_relative_to_include())}"
  location_dir = "${basename(dirname(path_relative_to_include()))}"
  extra_atlantis_dependencies = [
    "${get_parent_terragrunt_dir()}/../terragrunt-configs/envs/default.yaml",
    "${get_parent_terragrunt_dir()}/../terragrunt-configs/envs/${local.env_dir}/default.yaml",
  ]

  env_vars = merge(
    yamldecode(file(local.extra_atlantis_dependencies[0])),
    yamldecode(file(local.extra_atlantis_dependencies[1])),
  )
}

inputs = {
  datadog_monitors = {
    "monitor1" = {
      name                     = "[kubernetes] Monitor Kubernetes Pods Restarting for app ${local.location_dir} on env ${local.env_vars.short_env}"
      type                     = "query alert"
      query                    = "change(sum(last_5m),last_5m):exclude_null(avg:kubernetes.containers.restarts{*} by {kube_cluster_name,pod_name}) > 5"
(...)
      include_tags             = true
      // tags
      tags = {
        app         = "${local.location_dir}"
        type        = "daemon"
        env         = "${local.env_vars.short_env}"
        env_name    = "${local.env_vars.environment}"
        integration = "kubernetes"
        // for instance here I would like to have a service TAG coming from the other file. 
    //something like service = "${local.service}". but it does not work of course.  
        service     = "${local.service}"
      }
      thresholds = {
        warning           = 3
        critical          = 5
      }
      // Optional parameters
(...)
    }
  }
}

我试图在一份档案中添加这一内容,并在其他几个方面使用。

任何想法,如果有可能在<条码>中形成这种变数/地方/价值,则如何使用?

Edit是一些错误,即“未支持的属性;该物体没有被称作“服务”的属性。

问题回答

暂无回答




相关问题
Terra Custom Read

我在做的是按习俗分类的提供者,对标签有选择性的投入,但我发现的挑战是,扼杀使用ValueString()从主要价值中取回。 f,不确定......

Retrieve IDs in Terraform before script execution

I m a freshman and I don t know if I have a general thinking error but how do I get around the issue that when I want to roll out a script that there are some IDs missing that I would only get with ...

The plugin.(*GRPCProvider)

I am trying to deploy a Terraform stack from a Linux EC2 and getting the following error: The plugin.(*GRPCProvider).ApplyResourceChange request was cancelled. and │ The plugin.(*GRPCProvider)....