# Dynatrace, Infrastructure as Code, MonaCo

**URL:** <https://community.dynatrace.com/t/dynatrace-infrastructure-as-code-monaco/38706>\
**Category:** Open Q&A\
**Tags:** monaco\
**Created:** [March 6, 2023, 12:12pm UTC](https://community.dynatrace.com/t/dynatrace-infrastructure-as-code-monaco/38706 "2023-03-06T12:12:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![echwallah](https://avatars.discourse-cdn.com/v4/letter/e/9e8a1a/32.png) [@echwallah](https://community.dynatrace.com/u/echwallah)\
**Post date:** [March 6, 2023, 12:12pm UTC](https://community.dynatrace.com/t/dynatrace-infrastructure-as-code-monaco/38706/1 "2023-03-06T12:12:00Z")

</div>

Has anyone encountered a scenario whereby Monaco can be incorporated within an Orchestration Platform like Terraform such that once a Virtual Machine, EC2 Instance or node is spun up, One Agent is Installed Automatically and necessary Dashboards for Infrastructure usage, Services, Tagging of Services and Discovered Processes are automatically done after installation of the agents on the Host using MonaCo

---

<div class="post-metadata">

**Author:** ![Radoslaw\_Szulgo](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/radoslaw_szulgo/32/1977_2.png) [@Radoslaw\_Szulgo](https://community.dynatrace.com/u/Radoslaw_Szulgo)\
**Post date:** [March 6, 2023, 3:53pm UTC](https://community.dynatrace.com/t/dynatrace-infrastructure-as-code-monaco/38706/2 "2023-03-06T15:53:07Z")

</div>

Configuration-as-code (aka Monaco 2.0) is a binary script that you can call in the Terraform module. For instance using local-exec:

> **[Perform post-apply operations using provisioners | Terraform | HashiCorp...](https://developer.hashicorp.com/terraform/language/provisioners)**
>
> Learn how to run commands and scripts and upload files to prepare resources for service after applying the configuration with provisioners, config-init, and configuration management software.

---

<div class="post-metadata">

**Author:** ![echwallah](https://avatars.discourse-cdn.com/v4/letter/e/9e8a1a/32.png) [@echwallah](https://community.dynatrace.com/u/echwallah)\
**Post date:** [March 7, 2023, 1:22am UTC](https://community.dynatrace.com/t/dynatrace-infrastructure-as-code-monaco/38706/3 "2023-03-07T01:22:04Z")

</div>

Thanks for this&nbsp;[@Radoslaw\_Szulgo](https://community.dynatrace.com/user/25371)&nbsp;. Am quite new to this provisioning and orchestration platforms.

Could you describe for me, How I can spin up a VM or EC2 Instance or any infrastructure, install or deploy one agent inside the host and then run Monaco on the tenant where the host has connected to in order to configure dashboards, tags, Management zones for the host its services and processes in an Automated way?

Just Basically how to Automate this whole process and also run at scale for instance on hundreds of servers. What would be the optimal approach leveraging on Monaco to avoid performing the configuration steps one at a time which can be time-consuming, tedious and error-prone

---

<div class="post-metadata">

**Author:** ![Radoslaw\_Szulgo](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/radoslaw_szulgo/32/1977_2.png) [@Radoslaw\_Szulgo](https://community.dynatrace.com/u/Radoslaw_Szulgo)\
**Post date:** [March 7, 2023, 9:53am UTC](https://community.dynatrace.com/t/dynatrace-infrastructure-as-code-monaco/38706/4 "2023-03-07T09:53:10Z")

</div>

Try with this tutorial:&nbsp;[Terraform AWS Example - Create EC2 instance with Terraform | DevOps Junction](https://www.middlewareinventory.com/blog/terraform-aws-example-ec2/)

This will help you understand how to run a terraform plan to launch an EC2 instance.

With this module you can see how to install OneAgent on the target host:

> **[GitHub - millerkc/template\_integration\_dynatrace: Sample terraform module for deploying Dynatrace...](https://github.com/millerkc/template_integration_dynatrace)**
>
> Sample terraform module for deploying Dynatrace OneAgent using IBM Cloud Automation Manager

and then last 3rd step -

Configuration-as-code (aka Monaco 2.0) is a binary script that you can call in the Terraform module. For instance using local-exec:

> **[Perform post-apply operations using provisioners | Terraform | HashiCorp...](https://developer.hashicorp.com/terraform/language/provisioners)**
>
> Learn how to run commands and scripts and upload files to prepare resources for service after applying the configuration with provisioners, config-init, and configuration management software.

More about Configuration-as-code (aka Monaco 2.0) -&nbsp;[Configuration as Code overview — Dynatrace Docs](https://www.dynatrace.com/support/help/manage/configuration-as-code)

---

<div class="post-metadata">

**Author:** ![echwallah](https://avatars.discourse-cdn.com/v4/letter/e/9e8a1a/32.png) [@echwallah](https://community.dynatrace.com/u/echwallah)\
**Post date:** [March 7, 2023, 10:17am UTC](https://community.dynatrace.com/t/dynatrace-infrastructure-as-code-monaco/38706/5 "2023-03-07T10:17:38Z")

</div>

Thanks a bunch&nbsp;[@Radoslaw\_Szulgo](https://community.dynatrace.com/user/25371)&nbsp;for this

---

<div class="post-metadata">

**Author:** ![dcryansArctiq](https://avatars.discourse-cdn.com/v4/letter/d/2acd7d/32.png) [@dcryansArctiq](https://community.dynatrace.com/u/dcryansArctiq)\
**Post date:** [January 17, 2025, 3:25pm UTC](https://community.dynatrace.com/t/dynatrace-infrastructure-as-code-monaco/38706/6 "2025-01-17T15:25:45Z")

</div>

[@echwallah](https://community.dynatrace.com/user/9193)

This is quite a bit later, but you may be interested in using the Dynatrace Terraform Provider

It is supported by Dynatrace:

> **[Configuration as Code via Terraform overview](https://docs.dynatrace.com/docs/deliver/configuration-as-code/terraform)**
>
> Manage your Dynatrace environment using Dynatrace Configuration as Code via Terraform.

You can also use it’s export functionality to help you get started with .tf files that match your current configs:

Export all:

> **[Terraform Registry](https://registry.terraform.io/providers/dynatrace-oss/dynatrace/latest/docs/guides/export-v2)**

Export specific resource type:

> **[Terraform Registry](https://registry.terraform.io/providers/dynatrace-oss/dynatrace/latest/docs/resources/alerting#export-example-usage)**
