Closed Kikivsantos closed 1 month ago
Thanks for opening this issue! Please make sure you've followed our guidelines when opening the issue. In short, to help us reproduce the issue we need:
The ticket CLOUDP-250697 was created for internal tracking.
I'm sorry, guys.
The problem was in my code. I'm adding the one that works here to anyone who maybe want this as an example
# ------------------------------------------------------------------------------
# MONGODB CLUSTER
# ------------------------------------------------------------------------------
resource "mongodbatlas_custom_db_role" "default" {
project_id = var.project_id #var.project_id[var.environment]
role_name = var.role_name #"write-dml"
dynamic "actions" {
for_each = var.actionss
content {
action = actions.value["action"]
resources {
collection_name = try(actions.value.resource.collection_name, null)
database_name = try(actions.value.resource.database_name, null)
cluster = try(actions.value.resource.cluster, null)
}
}
}
dynamic "inherited_roles" {
for_each = var.inherited_role == null ? toset([]) : toset(var.inherited_role)
content {
role_name = try(inherited_roles.role_name, null)
database_name = try(inherited_roles.database_name, null)
}
}
}
variable "project_id" {
description = <<HEREDOC
(Required) The ID of the project where the alert configuration will create.
HEREDOC
}
variable "role_name" {
description = <<HEREDOC
(Required) Name of the custom role.
HEREDOC
type = string
}
variable "actionss" {
description = <<HEREDOC
(Required) Each object in the actions array represents an individual privilege action granted by the role.
HEREDOC
type = any
}
variable "inherited_role" {
description = <<HEREDOC
(Optional) Each object in the inheritedRoles array represents a key-value pair indicating the inherited role and the database on which the role is granted.
HEREDOC
type = any
default = null
}
locals {
component_name = "modules/custom-roles"
component_version = "feature/CustomRole"
}
include "root" {
path = "${get_repo_root()}/terragrunt.hcl"
}
dependency "project" {
config_path = "../.."
}
inputs = {
project_id = dependency.project.outputs.project_id
role_name = "writedml"
actionss =[
{
action = "REMOVE"
resource = {
collection_name = ""
database_name = "anyDatabase"
}
}
]
}
I'm closing this ISSUE, as there were NO ISSUE on terraform side
Is there an existing issue for this?
Provider Version
latest
Terraform Version
latest
Terraform Edition
Terraform Open Source (OSS)
Current Behavior
Error when running the apply (The plan goes ok)
Terraform configuration to reproduce the issue
1- main.tf:
2 - variable.tf
3 - terragunt.hcl (that calls the terraform module):
Steps To Reproduce
1 - terragrunt plan (works fine)
2 - terragrun apply (error)
Logs
No response
Code of Conduct