Skip to content

Commit

Permalink
Merge pull request #3 from sgtoj/dev
Browse files Browse the repository at this point in the history
feat: allow user to provide dst dir
  • Loading branch information
sgtoj committed Jul 12, 2023
2 parents ab6fbe4 + 73d45b7 commit b3be0de
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 14 deletions.
1 change: 1 addition & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
}
},
"extensions": [
"darkriszty.markdown-table-prettify",
"dbaeumer.vscode-eslint",
"editorconfig.editorconfig",
"github.copilot",
Expand Down
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,15 @@ for more details on these variables.

## Inputs

| Name | Description | Type | Default | Required |
|------------------------|------------------------------------------------------------------------------------|:-------------:|:-------:|:--------:|
| `docker_build_context` | The context to use when building the Docker image. | `string` | n/a | yes |
| `docker_build_target` | The target to use when building the Docker image. | `string` | n/a | yes |
| `docker_build_args` | Additional arguments to pass to Docker during the build process. | `map(string)` | `{}` | no |
| `artifact_src_path` | The path in the Docker container from which to copy the artifact. | `string` | n/a | yes |
| `force_rebuild_id` | A unique identifier that, when changed, will force the Docker image to be rebuilt. | `string` | "" | no |
| `os_compatibility` | The operating system of Terrafrom environment. Accepts 'unix' or 'windows'. | `string` | `unix` | no |
| Name | Description | Type | Default | Required |
|--------------------------|-------------------------------------------------------------------------------------|:-------------:|:-------:|:--------:|
| `docker_build_context` | The context to use when building the Docker image. | `string` | n/a | yes |
| `docker_build_target` | The target to use when building the Docker image. | `string` | n/a | yes |
| `docker_build_args` | Additional arguments to pass to Docker during the build process. | `map(string)` | `{}` | no |
| `artifact_dst_directory` | The destination directory on the host machine to which the artifact will be copied. | `string` | "" | no |
| `artifact_src_path` | The path in the Docker container from which to copy the artifact. | `string` | n/a | yes |
| `force_rebuild_id` | A unique identifier that, when changed, will force the Docker image to be rebuilt. | `string` | "" | no |
| `os_compatibility` | The operating system of Terrafrom environment. Accepts 'unix' or 'windows'. | `string` | `unix` | no |

## Outputs

Expand Down
3 changes: 2 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ locals {
source_path = local.docker_build_context

artifact_id = try(random_string.this[0].id, "unknown")
artifact_dst_path = abspath("${path.module}/dist/${module.artifact_label.id}-${local.artifact_id}.zip")
artifact_dst_dir = var.artifact_dst_directory == "" ? "${path.module}/dist" : var.artifact_dst_directory
artifact_dst_path = abspath("${local.artifact_dst_dir}/${module.artifact_label.id}-${local.artifact_id}.zip")
artifact_src_path = var.artifact_src_path

os_script_map = {
Expand Down
16 changes: 11 additions & 5 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -1,27 +1,33 @@
variable "artifact_src_path" {
type = string
description = "The path in the Docker container from which to copy the artifact"
description = "The path in the Docker container from which to copy the artifact."
}

variable "artifact_dst_directory" {
type = string
description = "The destination directory on the host machine to which the artifact will be copied."
default = ""
}

variable "docker_build_context" {
type = string
description = "The context to use when building the Docker image"
description = "The context to use when building the Docker image."
}

variable "docker_build_target" {
type = string
description = "The target to use when building the Docker image"
description = "The target to use when building the Docker image."
}

variable "docker_build_args" {
type = map(string)
description = "Additional arguments to pass to Docker during the build process"
description = "Additional arguments to pass to Docker during the build process."
default = {}
}

variable "force_rebuild_id" {
type = string
description = "A unique identifier that, when changed, will force the Docker image to be rebuilt"
description = "A unique identifier that, when changed, will force the Docker image to be rebuilt."
default = ""
}

Expand Down

0 comments on commit b3be0de

Please sign in to comment.