config name randomiser a bit more randomer.
This commit is contained in:
parent
fa3c0ac16f
commit
15b530eee6
3 changed files with 10 additions and 2 deletions
docker/config
|
@ -1,3 +1,7 @@
|
|||
resource "random_id" "randomiser" {
|
||||
byte_length = 2
|
||||
}
|
||||
|
||||
resource "docker_config" "config" {
|
||||
name = local.config_name
|
||||
data = base64encode(var.value)
|
||||
|
|
|
@ -6,8 +6,8 @@ locals {
|
|||
// I will share that into 20 bytes for the stack name, remaining bytes for the config name
|
||||
config_name = join("-", [
|
||||
substr(var.stack_name, 0, 20),
|
||||
substr(local.file_name, 0, 64 - 1 - 7 - 2 - 20),
|
||||
substr(sha1(var.value), 0, 7)
|
||||
substr(local.file_name, 0, 64 - 20 - 1 - (random_id.randomiser.byte_length * 2) - 1),
|
||||
random_id.randomiser.hex
|
||||
])
|
||||
|
||||
// define config labels
|
||||
|
|
|
@ -10,6 +10,10 @@ terraform {
|
|||
source = "hashicorp/local"
|
||||
version = "~>2.1"
|
||||
}
|
||||
random = {
|
||||
source = "hashicorp/random"
|
||||
version = "~>3.3"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue