From a706c599a06e8622914ef302c13d38f10bf792bd Mon Sep 17 00:00:00 2001 From: "simeon.zhekov" Date: Mon, 27 May 2024 15:21:36 +0300 Subject: [PATCH] [GDB-10293] Added support for custom owner ID for the AMIs and changed default owner ID --- .terraform.lock.hcl | 3 +++ README.md | 1 + main.tf | 5 +++-- modules/graphdb/main.tf | 2 +- modules/graphdb/variables.tf | 5 +++++ variables.tf | 6 ++++++ 6 files changed, 19 insertions(+), 3 deletions(-) diff --git a/.terraform.lock.hcl b/.terraform.lock.hcl index 964cad7..2736aa1 100644 --- a/.terraform.lock.hcl +++ b/.terraform.lock.hcl @@ -6,6 +6,7 @@ provider "registry.terraform.io/hashicorp/aws" { constraints = "~> 5.15, ~> 5.49" hashes = [ "h1:FxPN9X3/R9y952y4c4aLKB7CAHIvMTtfE9Gkmn780Sk=", + "h1:Y3xvYjzBIwYSbcnZDcs6moiy30uxRoY5oT2ExQHKG5A=", "zh:0979b07cdeffb868ea605e4bbc008adc7cccb5f3ba1d3a0b794ea3e8fff20932", "zh:2121a0a048a1d9419df69f3561e524b7e8a6b74ba0f57bd8948799f12b6ad3a1", "zh:573362042ba0bd18e98567a4f45d91b09eb0d223513518ba04f16a646a906403", @@ -27,6 +28,7 @@ provider "registry.terraform.io/hashicorp/aws" { provider "registry.terraform.io/hashicorp/cloudinit" { version = "2.3.4" hashes = [ + "h1:cVIIhnXweOHavu1uV2bdKScTjLbM1WnKM/25wqYBJWo=", "h1:iDq03pOzp/UsXya2h+32VOOrvGdJgI9L2/EZJoN9t4A=", "zh:09f1f1e1d232da96fbf9513b0fb5263bc2fe9bee85697aa15d40bb93835efbeb", "zh:381e74b90d7a038c3a8dcdcc2ce8c72d6b86da9f208a27f4b98cabe1a1032773", @@ -48,6 +50,7 @@ provider "registry.terraform.io/hashicorp/random" { constraints = "~> 3.6.0" hashes = [ "h1:0WIdXFjSCwDr4nwWPYOlaJXselSTwMaKRC4lHDJ1FUE=", + "h1:1OlP753r4lOKlBprL0HdZGWerm5DCabD5Mli8k8lWAg=", "zh:2a0ec154e39911f19c8214acd6241e469157489fc56b6c739f45fbed5896a176", "zh:57f4e553224a5e849c99131f5e5294be3a7adcabe2d867d8a4fef8d0976e0e52", "zh:58f09948c608e601bd9d0a9e47dcb78e2b2c13b4bda4d8f097d09152ea9e91c5", diff --git a/README.md b/README.md index c87569f..b937527 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,7 @@ Before you begin using this Terraform module, ensure you meet the following prer | common\_tags | (Optional) Map of common tags for all taggable AWS resources. | `map(string)` | `{}` | no | | resource\_name\_prefix | Resource name prefix used for tagging and naming AWS resources | `string` | n/a | yes | | aws\_region | AWS region to deploy resources into | `string` | n/a | yes | +| aws\_custom\_owner\_id | Define custom owner ID for AMI images | `string` | `null` | no | | deploy\_backup | Deploy backup module | `bool` | `true` | no | | backup\_schedule | Cron expression for the backup job. | `string` | `"0 0 * * *"` | no | | backup\_retention\_count | Number of backups to keep. | `number` | `7` | no | diff --git a/main.tf b/main.tf index 2837bf2..aa52b11 100644 --- a/main.tf +++ b/main.tf @@ -175,8 +175,9 @@ module "graphdb" { # VM Image - ami_id = var.ami_id - graphdb_version = var.graphdb_version + ami_id = var.ami_id + graphdb_version = var.graphdb_version + override_owner_id = var.override_owner_id # Managed Disks diff --git a/modules/graphdb/main.tf b/modules/graphdb/main.tf index ebdcd81..07faf01 100644 --- a/modules/graphdb/main.tf +++ b/modules/graphdb/main.tf @@ -11,7 +11,7 @@ data "aws_caller_identity" "current" {} data "aws_ami" "graphdb" { count = var.ami_id != null ? 0 : 1 - owners = ["770034820396"] # Ontotext + owners = var.override_owner_id != null ? [var.override_owner_id] : ["679593333241"] most_recent = true filter { diff --git a/modules/graphdb/variables.tf b/modules/graphdb/variables.tf index 54395ed..4bebe27 100644 --- a/modules/graphdb/variables.tf +++ b/modules/graphdb/variables.tf @@ -20,6 +20,11 @@ variable "aws_subscription_id" { type = string } +variable "override_owner_id" { + description = "Override the default owner ID used for the AMI images" + type = string +} + # GraphDB Parameters variable "graphdb_admin_password" { diff --git a/variables.tf b/variables.tf index 54fbfd0..a78dfa7 100644 --- a/variables.tf +++ b/variables.tf @@ -16,6 +16,12 @@ variable "aws_region" { type = string } +variable "override_owner_id" { + description = "Override the default owner ID used for the AMI images" + type = string + default = null +} + # Backup configurations variable "deploy_backup" { description = "Deploy backup module"