# Terraform script execution error

**URL:** <https://community.dynatrace.com/t/terraform-script-execution-error/49561>\
**Category:** Automations\
**Tags:** terraform, automations\
**Created:** [January 3, 2025, 9:31am UTC](https://community.dynatrace.com/t/terraform-script-execution-error/49561 "2025-01-03T09:31:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Manoharsomi](https://avatars.discourse-cdn.com/v4/letter/m/aeb1de/32.png) [@Manoharsomi](https://community.dynatrace.com/u/Manoharsomi)\
**Post date:** [January 3, 2025, 9:31am UTC](https://community.dynatrace.com/t/terraform-script-execution-error/49561/1 "2025-01-03T09:31:43Z")

</div>

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](https://global.discourse-cdn.com/dynatrace/original/3X/3/4/34c5ba26c3f40714d146defba06439e0b2be1a1e.png)

Please fine the Terraform code below:

resource “dynatrace\_hub\_extension\_config” “test” {&nbsp; name &nbsp;= “com.dynatrace.extension.snmp-generic-cisco-device”&nbsp; value = jsonencode(&nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; “description”: “Cisco device configuration”,&nbsp; &nbsp; &nbsp; “version”: “2.1.4”,&nbsp; &nbsp; &nbsp; “value”: {&nbsp; &nbsp; &nbsp; &nbsp; “enabled”: true,&nbsp; &nbsp; &nbsp; &nbsp; “description”: “test”,&nbsp; &nbsp; &nbsp; &nbsp; “snmp”: {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; “devices”: [&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; “ip”: “0.0.0.0”,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; “port”: 161,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; “authentication”: {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; “type”: “SNMPv3”,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; “userName”: “user”,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; “securityLevel”: “AUTH\_PRIV”,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; “authPassword”: “password”,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; “authProtocol”: “SHA”,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; “privPassword”: “password”,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; “privProtocol”: “AES256C”&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;]&nbsp; &nbsp; &nbsp; &nbsp; },&nbsp; &nbsp; &nbsp; &nbsp; “featureSets”: [&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; “BGP”,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; “Health”,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; “High availability”,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; “Interfaces”,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; “Interfaces 32-bit”,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; “Interfaces 64-bit”,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; “Memory pools”,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; “Power supply”,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; “Sensors”,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; “Traffic”&nbsp; &nbsp; &nbsp; &nbsp;]&nbsp; &nbsp; &nbsp; },&nbsp; &nbsp; &nbsp; “scope”: “ag\_group-default”&nbsp; &nbsp; }&nbsp; )}

Note: I am having full platform access.

#terraform

---

<div class="post-metadata">

**Author:** ![reinhard\_pilz](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/reinhard_pilz/32/27935_2.png) [@reinhard\_pilz](https://community.dynatrace.com/u/reinhard_pilz)\
**Post date:** [January 7, 2025, 10:50am UTC](https://community.dynatrace.com/t/terraform-script-execution-error/49561/2 "2025-01-07T10:50:53Z")

</div>

Hello&nbsp;[@Manoharsomi](https://community.dynatrace.com/user/84418)

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:

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

```

---

<div class="post-metadata">

**Author:** ![Manoharsomi](https://avatars.discourse-cdn.com/v4/letter/m/aeb1de/32.png) [@Manoharsomi](https://community.dynatrace.com/u/Manoharsomi)\
**Post date:** [January 7, 2025, 11:56am UTC](https://community.dynatrace.com/t/terraform-script-execution-error/49561/3 "2025-01-07T11:56:21Z")

</div>

Thank you so much&nbsp;[@reinhard\_pilz](https://community.dynatrace.com/user/6337)&nbsp;. provided solution is working perfectly​👏👏

---

<div class="post-metadata">

**Author:** ![Manoharsomi](https://avatars.discourse-cdn.com/v4/letter/m/aeb1de/32.png) [@Manoharsomi](https://community.dynatrace.com/u/Manoharsomi)\
**Post date:** [February 12, 2025, 5:48am UTC](https://community.dynatrace.com/t/terraform-script-execution-error/49561/4 "2025-02-12T05:48:05Z")

</div>

Hi&nbsp;[@reinhard\_pilz](https://community.dynatrace.com/user/6337)&nbsp;,

Could you please provide the Terraform script to modify the host group name through API?

---

<div class="post-metadata">

**Author:** ![AntonPineiro](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antonpineiro/32/49_2.png) [@AntonPineiro](https://community.dynatrace.com/u/AntonPineiro)\
**Post date:** [February 12, 2025, 7:46am UTC](https://community.dynatrace.com/t/terraform-script-execution-error/49561/5 "2025-02-12T07:46:14Z")

</div>

Hi,

No idea about Terraform, I only use Monaco but, I think you can download an existing configuration to check how config files should be created.

Best regards

---

<div class="post-metadata">

**Author:** ![Manoharsomi](https://avatars.discourse-cdn.com/v4/letter/m/aeb1de/32.png) [@Manoharsomi](https://community.dynatrace.com/u/Manoharsomi)\
**Post date:** [February 14, 2025, 9:45am UTC](https://community.dynatrace.com/t/terraform-script-execution-error/49561/6 "2025-02-14T09:45:40Z")

</div>

Hi&nbsp;[@reinhard\_pilz](https://community.dynatrace.com/user/6337)

Any update on Terraform script to modify the host group name through API?

your assistance is highly appreciated.

Thank you,  
Manohar
