variable "docker_registry_url" {
description = "Address of ACR container registry."
type = string
}
variable "docker_registry_username" {
description = "Username for authenticating with the container registry. Required if docker_config_file_path is not set."
type = string
default = ""
}
variable "docker_registry_password" {
description = "Password for authenticating with the container registry. Required if docker_config_file_path is not set."
type = string
default = ""
sensitive = true
}
variable "docker_config_file_path" {
description = "Path to config.json containing docker configuration."
type = string
default = ""
}
variable "docker_image_name" {
description = "Name of docker image to build."
type = string
}
variable "docker_image_tag" {
description = "Tag to use for the docker image."
type = string
default = "latest"
}
variable "source_path" {
description = "Path to folder containing application code"
type = string
default = null
}
variable "docker_file_path" {
description = "Path to Dockerfile in source package"
type = string
}
variable "build_args" {
description = "A map of Docker build arguments."
type = map(string)
default = {}
}
variable "keep_remotely" {
description = "Whether to keep Docker image in the remote registry on destroy operation."
type = bool
default = false
}
3条答案
按热度按时间luaexgnf1#
您可以使用Terraform资源
null_resource
并在Terraform中执行自己的逻辑。示例:
bmvo0sr52#
这一点,我在docker_registry_image资源中找到了答案。我不喜欢使用空资源,因为它需要依赖于本地系统包。此外,我使它既可以使用本地身份验证进行部署,也可以使用在Github存储库中存储为秘密的凭证进行身份验证。
main.tf
variables.tf
gcuhipw93#
我尝试使用Terraform将存储在GitHub中的Dockerfile推送到Azure容器注册表(ACR),并遇到以下错误消息:
在我拥有Dockerfile的存储库中从GitActions运行Terraform apply。