Hello,
I try to pass these variables into this template to create security rules into a rancher2 RKE cluster. These rules has to be overwrighten like that :
rules {
api_groups = ["kibana.k8s.elastic.co"]
resources = ["*"]
verbs = ["create","delete","get","list","patch","update","watch"]
}
So my main.tf is there :
provider "rancher2"{
api_url = "https://k8s.cloud/v3" //api-endpoint
access_key = "token-8jqsr"
secret_key = "vs5qwjjk2rx2kk65p482zbttz5bssxj8fthx5gfphc82vwnd4jwrn9"
}
resource "rancher2_role_template" "bu-crd-right_b" {
rules {
elastic = "${var.elastic}"
}
}
And my variables.tfvars looks like that :
variable "elastic" {
api_groups = ["common.k8s.elastic.co"]
resources = ["*"]
verbs = ["create","delete","get","list","patch","update","watch"]
}
This is the error :
Error: Variable declaration in .tfvars file
on test2/variable.var line 1:
1: variable "elastic" {
A .tfvars file is used to assign values to variables that have already been
declared in .tf files, not to declare new variables. To declare variable
"elastic", place this block in one of your .tf files, such as variables.tf.
To set a value for this variable in test2/variable.var, use the definition
syntax instead:
elastic = <value>