diff --git a/config/config.hcl b/config/config.hcl index 8e4b0c8..f1075e8 100644 --- a/config/config.hcl +++ b/config/config.hcl @@ -12,6 +12,11 @@ locals { trimsuffix(basename(file_path), ".yaml") => content if startswith(file_path, "remote_alpine/") } + remote_cargo = { + for file_path, content in local.all_configs : + trimsuffix(basename(file_path), ".yaml") => content + if startswith(file_path, "remote_cargo/") + } remote_docker = { for file_path, content in local.all_configs : trimsuffix(basename(file_path), ".yaml") => content diff --git a/environments/artifactapi.k8s.syd1.au.unkin.net/terragrunt.hcl b/environments/artifactapi.k8s.syd1.au.unkin.net/terragrunt.hcl index d0c4f83..887f819 100644 --- a/environments/artifactapi.k8s.syd1.au.unkin.net/terragrunt.hcl +++ b/environments/artifactapi.k8s.syd1.au.unkin.net/terragrunt.hcl @@ -18,6 +18,7 @@ terraform { inputs = { remote_alpine = local.config.remote_alpine + remote_cargo = local.config.remote_cargo remote_docker = local.config.remote_docker remote_generic = local.config.remote_generic remote_github_deb = local.config.remote_github_deb diff --git a/modules/artifactapi/main.tf b/modules/artifactapi/main.tf index 5b4cc8d..48d0bf5 100644 --- a/modules/artifactapi/main.tf +++ b/modules/artifactapi/main.tf @@ -13,6 +13,20 @@ resource "artifactapi_remote_alpine" "this" { mirror_strategy = each.value.mirror_strategy } +resource "artifactapi_remote_cargo" "this" { + for_each = var.remote_cargo + + name = each.key + base_url = each.value.base_url + description = each.value.description + immutable_ttl = each.value.immutable_ttl + mutable_ttl = each.value.mutable_ttl + check_mutable = each.value.check_mutable + patterns = each.value.patterns + mutable_patterns = each.value.mutable_patterns + stale_on_error = each.value.stale_on_error +} + resource "artifactapi_remote_docker" "this" { for_each = var.remote_docker diff --git a/modules/artifactapi/variables.tf b/modules/artifactapi/variables.tf index 8408986..16ba039 100644 --- a/modules/artifactapi/variables.tf +++ b/modules/artifactapi/variables.tf @@ -14,6 +14,21 @@ variable "remote_alpine" { default = {} } +variable "remote_cargo" { + description = "Map of cargo (crates.io sparse index) remote repositories" + type = map(object({ + base_url = string + description = optional(string, "") + immutable_ttl = optional(number, 0) + mutable_ttl = optional(number, 3600) + check_mutable = optional(bool, true) + patterns = optional(list(string), []) + mutable_patterns = optional(list(string), []) + stale_on_error = optional(bool, true) + })) + default = {} +} + variable "remote_docker" { description = "Map of Docker remote repositories" type = map(object({