Lio*_*osi 5 google-cloud-platform terraform
我正在尝试使用图像容器创建 google_compute_instance_template 。
在实例模板下的 GUI 上,您必须选中复选框:“将容器映像部署到此 VM 实例”
之后,我可以添加容器映像 URI,并且在高级选项上,我可以添加环境参数、参数等...
不幸的是,我没有找到如何从 Terraform 中做到这一点。
感谢帮助。
我认为这个 terraform 模块就是您正在寻找的 - https://github.com/terraform-google-modules/terraform-google-container-vm
用法示例:
module "gce-container" {
source = "github.com/terraform-google-modules/terraform-google-container-vm"
version = "0.1.0"
container = {
image="gcr.io/google-samples/hello-app:1.0"
env = [
{
name = "TEST_VAR"
value = "Hello World!"
}
],
volumeMounts = [
{
mountPath = "/cache"
name = "tempfs-0"
readOnly = "false"
},
{
mountPath = "/persistent-data"
name = "data-disk-0"
readOnly = "false"
},
]
}
volumes = [
{
name = "tempfs-0"
emptyDir = {
medium = "Memory"
}
},
{
name = "data-disk-0"
gcePersistentDisk = {
pdName = "data-disk-0"
fsType = "ext4"
}
},
]
restart_policy = "Always"
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1746 次 |
| 最近记录: |