diff --git a/config/config.hcl b/config/config.hcl index 3c558a0..18f150d 100644 --- a/config/config.hcl +++ b/config/config.hcl @@ -27,6 +27,11 @@ locals { trimsuffix(basename(file_path), ".yaml") => content if startswith(file_path, "remote_generic/") } + remote_gems = { + for file_path, content in local.all_configs : + trimsuffix(basename(file_path), ".yaml") => content + if startswith(file_path, "remote_gems/") + } remote_github_deb = { for file_path, content in local.all_configs : trimsuffix(basename(file_path), ".yaml") => content @@ -87,6 +92,11 @@ locals { trimsuffix(basename(file_path), ".yaml") => content if startswith(file_path, "local_npm/") } + local_gems = { + for file_path, content in local.all_configs : + trimsuffix(basename(file_path), ".yaml") => content + if startswith(file_path, "local_gems/") + } local_docker = { for file_path, content in local.all_configs : trimsuffix(basename(file_path), ".yaml") => content diff --git a/config/local_gems/gems-internal.yaml b/config/local_gems/gems-internal.yaml new file mode 100644 index 0000000..77c5fac --- /dev/null +++ b/config/local_gems/gems-internal.yaml @@ -0,0 +1 @@ +description: "Internal gems" diff --git a/config/remote_gems/rubygems.yaml b/config/remote_gems/rubygems.yaml new file mode 100644 index 0000000..377377c --- /dev/null +++ b/config/remote_gems/rubygems.yaml @@ -0,0 +1,5 @@ +base_url: https://rubygems.org +description: "rubygems.org — public RubyGems source" +immutable_ttl: 0 +mutable_ttl: 300 +stale_on_error: true diff --git a/config/virtual/gems.yaml b/config/virtual/gems.yaml new file mode 100644 index 0000000..dc8c817 --- /dev/null +++ b/config/virtual/gems.yaml @@ -0,0 +1,5 @@ +package_type: gems +description: "Virtual RubyGems source over internal and public gems — member order is priority order for duplicate versions" +members: + - gems-internal + - rubygems diff --git a/environments/artifactapi.k8s.syd1.au.unkin.net/terragrunt.hcl b/environments/artifactapi.k8s.syd1.au.unkin.net/terragrunt.hcl index dab55c2..b273433 100644 --- a/environments/artifactapi.k8s.syd1.au.unkin.net/terragrunt.hcl +++ b/environments/artifactapi.k8s.syd1.au.unkin.net/terragrunt.hcl @@ -21,6 +21,7 @@ inputs = { remote_cargo = local.config.remote_cargo remote_docker = local.config.remote_docker remote_generic = local.config.remote_generic + remote_gems = local.config.remote_gems remote_github_deb = local.config.remote_github_deb remote_github_rpm = local.config.remote_github_rpm remote_goproxy = local.config.remote_goproxy @@ -33,6 +34,7 @@ inputs = { local_rpm = local.config.local_rpm local_helm = local.config.local_helm local_npm = local.config.local_npm + local_gems = local.config.local_gems local_docker = local.config.local_docker local_generic = local.config.local_generic virtual = local.config.virtual diff --git a/modules/artifactapi/main.tf b/modules/artifactapi/main.tf index b1382ac..7f195e4 100644 --- a/modules/artifactapi/main.tf +++ b/modules/artifactapi/main.tf @@ -135,6 +135,19 @@ resource "artifactapi_remote_npm" "this" { stale_on_error = each.value.stale_on_error } +resource "artifactapi_remote_gems" "this" { + for_each = var.remote_gems + + 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 + patterns = each.value.patterns + mutable_patterns = each.value.mutable_patterns + stale_on_error = each.value.stale_on_error +} + resource "artifactapi_remote_pypi" "this" { for_each = var.remote_pypi @@ -183,6 +196,13 @@ resource "artifactapi_local_npm" "this" { description = each.value.description } +resource "artifactapi_local_gems" "this" { + for_each = var.local_gems + + name = each.key + description = each.value.description +} + resource "artifactapi_local_docker" "this" { for_each = var.local_docker diff --git a/modules/artifactapi/variables.tf b/modules/artifactapi/variables.tf index 0c0c3da..d26acf1 100644 --- a/modules/artifactapi/variables.tf +++ b/modules/artifactapi/variables.tf @@ -141,6 +141,20 @@ variable "remote_npm" { default = {} } +variable "remote_gems" { + description = "Map of RubyGems remote repositories" + type = map(object({ + base_url = string + description = optional(string, "") + immutable_ttl = optional(number, 0) + mutable_ttl = optional(number, 3600) + patterns = optional(list(string), []) + mutable_patterns = optional(list(string), []) + stale_on_error = optional(bool, true) + })) + default = {} +} + variable "remote_pypi" { description = "Map of PyPI remote repositories" type = map(object({ @@ -187,6 +201,14 @@ variable "local_npm" { default = {} } +variable "local_gems" { + description = "Map of local gems repositories" + type = map(object({ + description = optional(string, "") + })) + default = {} +} + variable "local_generic" { description = "Map of local generic (raw-file) repositories" type = map(object({