diff --git a/config/config.hcl b/config/config.hcl index d188a51..66e6f0a 100644 --- a/config/config.hcl +++ b/config/config.hcl @@ -62,6 +62,11 @@ locals { trimsuffix(basename(file_path), ".yaml") => content if startswith(file_path, "remote_npm/") } + remote_puppet = { + for file_path, content in local.all_configs : + trimsuffix(basename(file_path), ".yaml") => content + if startswith(file_path, "remote_puppet/") + } remote_pypi = { for file_path, content in local.all_configs : trimsuffix(basename(file_path), ".yaml") => content @@ -107,6 +112,11 @@ locals { trimsuffix(basename(file_path), ".yaml") => content if startswith(file_path, "local_ansible/") } + local_puppet = { + for file_path, content in local.all_configs : + trimsuffix(basename(file_path), ".yaml") => content + if startswith(file_path, "local_puppet/") + } local_gems = { for file_path, content in local.all_configs : trimsuffix(basename(file_path), ".yaml") => content diff --git a/config/local_puppet/puppet-internal.yaml b/config/local_puppet/puppet-internal.yaml new file mode 100644 index 0000000..2f65f22 --- /dev/null +++ b/config/local_puppet/puppet-internal.yaml @@ -0,0 +1 @@ +description: "Internal Puppet modules" diff --git a/config/remote_puppet/forge.yaml b/config/remote_puppet/forge.yaml new file mode 100644 index 0000000..f1dba34 --- /dev/null +++ b/config/remote_puppet/forge.yaml @@ -0,0 +1,5 @@ +base_url: https://forgeapi.puppet.com +description: "forgeapi.puppet.com — public Puppet Forge modules" +immutable_ttl: 0 +mutable_ttl: 300 +stale_on_error: true diff --git a/config/virtual/puppet.yaml b/config/virtual/puppet.yaml new file mode 100644 index 0000000..83cfb84 --- /dev/null +++ b/config/virtual/puppet.yaml @@ -0,0 +1,5 @@ +package_type: puppet +description: "Virtual Puppet Forge over internal and public modules — member order is priority order for duplicate versions" +members: + - puppet-internal + - forge diff --git a/environments/artifactapi.k8s.syd1.au.unkin.net/terragrunt.hcl b/environments/artifactapi.k8s.syd1.au.unkin.net/terragrunt.hcl index db0ffd8..14379b7 100644 --- a/environments/artifactapi.k8s.syd1.au.unkin.net/terragrunt.hcl +++ b/environments/artifactapi.k8s.syd1.au.unkin.net/terragrunt.hcl @@ -28,6 +28,7 @@ inputs = { remote_goproxy = local.config.remote_goproxy remote_helm = local.config.remote_helm remote_npm = local.config.remote_npm + remote_puppet = local.config.remote_puppet remote_pypi = local.config.remote_pypi remote_rpm = local.config.remote_rpm local_terraform = local.config.local_terraform @@ -38,6 +39,7 @@ inputs = { local_goproxy = local.config.local_goproxy local_gems = local.config.local_gems local_ansible = local.config.local_ansible + local_puppet = local.config.local_puppet 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 0ae974a..2a6cbe3 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_puppet" "this" { + for_each = var.remote_puppet + + 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_ansible" "this" { for_each = var.remote_ansible @@ -223,6 +236,13 @@ resource "artifactapi_local_gems" "this" { description = each.value.description } +resource "artifactapi_local_puppet" "this" { + for_each = var.local_puppet + + name = each.key + description = each.value.description +} + resource "artifactapi_local_ansible" "this" { for_each = var.local_ansible diff --git a/modules/artifactapi/variables.tf b/modules/artifactapi/variables.tf index ff380b8..bc3760a 100644 --- a/modules/artifactapi/variables.tf +++ b/modules/artifactapi/variables.tf @@ -141,6 +141,20 @@ variable "remote_npm" { default = {} } +variable "remote_puppet" { + description = "Map of Puppet Forge 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_ansible" { description = "Map of Ansible Galaxy remote repositories" type = map(object({ @@ -231,6 +245,14 @@ variable "local_gems" { default = {} } +variable "local_puppet" { + description = "Map of local Puppet Forge repositories" + type = map(object({ + description = optional(string, "") + })) + default = {} +} + variable "local_ansible" { description = "Map of local Ansible Galaxy repositories" type = map(object({