Hi,
I have created terraform modules based on Snowflake provider and published to Jfrog artifactory.
Module will take yaml files as input , decode yaml and create resources. Yaml files location is passed as variable to module.
whle calling module from jfrog and provide yamlfile path variable, i’m getting following error
An argument named "artifactsrootdirectory" is not expected here.
main.tf
locals {
db_sch_files = fileset("${var.artifactsrootdirectory}", "*.yml")
db_sch_data = [ for f in local.db_sch_files : yamldecode(file("${var.artifactsrootdirectory}/${f}")) ]
db_sch_flatten = flatten([ for schemas in local.db_sch_data :
[ for sch in schemas.schema : {
id = upper(sch.name)
name = upper(sch.name)
comment = sch.comment
is_transient = sch.is_transient
data_retention_days = sch.data_retention_days
is_managed = sch.is_managed
}
]
])
}
resource "snowflake_schema" "schema" {
for_each = { for f in local.db_sch_flatten : f.id => f }
database = var.database
name = each.value.name
comment = each.value.comment
is_transient = each.value.is_transient
data_retention_days = each.value.data_retention_days
with_managed_access = each.value.is_managed
}
variables.tf
variable "artifactsrootdirectory" {
type = string
description = "Root folder of snowflake resources yml or json files"
validation {
condition = length(var.artifactsrootdirectory) > 1
error_message = "Root folder conatining artifacts is not provided."
}
}
Terraform call as example
variable "artifactsrootdirectory" {
type = string
default = "./src"
}
module "schema" {
source = "myartifactory.com/Terraform__test/schema/snowflake"
artifactsrootdirectory = "${var.artifactsrootdirectory}/schema"
}
However i have tried publishing modules in git and call them as below and it works fine.
module "schema" {
source = "git::http://github/Snowfall/_git/snowflakerepo//schema?ref=v.0.0.9"
artifactsrootdirectory = "${var.artifactsrootdirectory}/table"
}
Please advise what i’m doing wrong ?