cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Terraform script execution error

Manoharsomi
Frequent Guest

I am trying to configure the Cisco network device configuration through the Terraform script. I downloaded the Extension from Hub, and init, plan commands are successfully executed and after executing apply command, I am getting an error of No write access for scope class tenant. In API token I given the all the scopes, till it is giving the same error.
Manoharsomi_0-1735895795239.png

Please fine the Terraform code below:

resource "dynatrace_hub_extension_config" "test" {
  name  = "com.dynatrace.extension.snmp-generic-cisco-device"
  value = jsonencode(
    {
      "description": "Cisco device configuration",
      "version": "2.1.4",
      "value": {
        "enabled": true,
        "description": "test",
        "snmp": {
          "devices": [
            {
              "ip": "0.0.0.0",
              "port": 161,
              "authentication": {
                "type": "SNMPv3",
                "userName": "user",
                "securityLevel": "AUTH_PRIV",
                "authPassword": "password",
                "authProtocol": "SHA",
                "privPassword": "password",
                "privProtocol": "AES256C"
              }
            }
          ]
        },
        "featureSets": [
          "BGP",
          "Health",
          "High availability",
          "Interfaces",
          "Interfaces 32-bit",
          "Interfaces 64-bit",
          "Memory pools",
          "Power supply",
          "Sensors",
          "Traffic"
        ]
      },
      "scope": "ag_group-default"
    }
  )
}


Note: I am having full platform access. 

#terraform

2 REPLIES 2

reinhard_pilz
Dynatrace Helper
Dynatrace Helper

Hello @Manoharsomi 

The syntax for how to configure these settings via Terraform is not exactly the same as the JSON code presented in the WebUI suggests. What makes matters worse here is that the error message thrown back from the REST API leads you down the (wrong) rabbit hole of permissions.

You should be able to apply the monitoring configuration using this code:

resource "dynatrace_hub_extension_config" "test" {
name = "com.dynatrace.extension.snmp-generic-cisco-device"
active_gate_group = "default"
value = jsonencode(
{
"description" : "Cisco device configuration",
"version" : "2.1.4",
"enabled" : true,
"description" : "test",
"snmp" : {
"devices" : [
{
"ip" : "0.0.0.0",
"port" : 161,
"authentication" : {
"type" : "SNMPv3",
"userName" : "user",
"securityLevel" : "AUTH_PRIV",
"authPassword" : "password",
"authProtocol" : "SHA",
"privPassword" : "password",
"privProtocol" : "AES256C"
}
}
]
},
"featureSets" : [
"BGP",
"Health",
"High availability",
"Interfaces",
"Interfaces 32-bit",
"Interfaces 64-bit",
"Memory pools",
"Power supply",
"Sensors",
"Traffic"
]
}
)
}

 

Thank you so much @reinhard_pilz . provided solution is working perfectly👏👏

Featured Posts