【发布时间】:2020-06-03 12:04:26
【问题描述】:
我对 terraform 很陌生,所以我的问题可能很幼稚,但我仍然不知道如何解决它。
我有一个使用 helm_release (https://www.terraform.io/docs/providers/helm/r/release.html) 的 terraform 脚本,问题是我在单独的 git 存储库中有部署配置。假设:https://project.git/configuration.
我想要实现的是能够添加所有文件,例如https://project.git/configuration/dev(用于开发环境部署)配置映射。
terraform模块的结构是:
+project
+-helm
+--templates
+---configmap.yaml
+---deployment.yaml
+---ingress.yaml
+---service.yaml
+--chart.yaml
+--values.yaml
+-helm.tf
+-other tf files
我需要将配置库中的所有文件放在下面
+project
+-helm
+--configuration
只有这样我才能使用它:
apiVersion: v1
kind: ConfigMap
metadata:
...
data:
{{- (.Files.Glob "configuration/*").AsConfig | nindent 2 }}
在我的 configmap.yaml 中,helm 要求将这些文件放在图表目录中。
【问题讨论】:
-
我也热衷于制作 https://project.git/configuration 一个 terraform 模块。所以我可以将它用作子模块。但是问题还是一样,如何让这些文件在 project/helm/configuration 中可用