我正在尝试创建带有镜像容器的google_compute_instance_template。
在GUI的实例模板下,您必须选中复选框:"Deploy a container image to this VM instance“
在此之后,我可以添加容器镜像URI,在高级选项上,我可以添加环境参数、参数等……
不幸的是,我不知道如何在Terraform中使用它。
谢谢你的帮助。
发布于 2019-05-08 02:32:49
我想这个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"
}https://stackoverflow.com/questions/56025986
复制相似问题