You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*`ENABLED`: The location is displayed as active in the UI. You can assign monitors to the location.
75
75
*`DISABLED`: The location is displayed as inactive in the UI. You can't assign monitors to the location. Monitors already assigned to the location will stay there and will be executed from the location.
76
76
*`HIDDEN`: The location is not displayed in the UI. You can't assign monitors to the location. You can only set location as `HIDDEN` when no monitor is assigned to it
77
-
-`type` (String) The type of the location. Supported values are `PUBLIC`, `PRIVATE` and `CLUSTER`
77
+
-`type` (String) The type of the location. Supported values are `PUBLIC`, `PRIVATE` and `CLUSTER`
*`./terraform-provider-dynatrace exportv1` downloads all available configuration settings
22
+
*`./terraform-provider-dynatrace exportv1 dynatrace_dashboard` downloads all available dashboards
23
+
*`./terraform-provider-dynatrace exportv1 dynatrace_dashboard dynatrace_slo` downloads all available dashboards and all available SLOs
24
+
*`./terraform-provider-dynatrace exportv1 dynatrace_dashboard=4f5942d4-3450-40a8-818f-c5faeb3563d0` downloads only the dashboard with the id `4f5942d4-3450-40a8-818f-c5faeb3563d0`
25
+
*`./terraform-provider-dynatrace exportv1 dynatrace_dashboard=4f5942d4-3450-40a8-818f-c5faeb3563d0 dynatrace_dashboard=9c4b75f1-9a64-4b44-a8e4-149154fd5325` downloads only the dashboards with the ids `4f5942d4-3450-40a8-818f-c5faeb3563d0` and `9c4b75f1-9a64-4b44-a8e4-149154fd5325`
26
+
*`./terraform-provider-dynatrace exportv1 dynatrace_slo dynatrace_dashboard=4f5942d4-3450-40a8-818f-c5faeb3563d0 dynatrace_dashboard=9c4b75f1-9a64-4b44-a8e4-149154fd5325` downloads all available SLOs and only the dashboards with the ids `4f5942d4-3450-40a8-818f-c5faeb3563d0` and `9c4b75f1-9a64-4b44-a8e4-149154fd5
*`-ref` Enable resources with data sources and dependencies
22
+
*`-id` Enable commented id output in resource files
23
+
*`-migrate` Enable output specific to environment migration
24
+
- Removes node IDs from private synthetic locations
25
+
*`-exclude` Exclude specified resource(s) from export
26
+
27
+
**NOTE:** Dashboards (because there could be thousands of them) are currently excluded from the export unless the resource is directly specified in the command line arguments.
28
+
29
+
### Usage Examples
30
+
*`./terraform-provider-dynatrace -export` downloads all available configuration settings without data sources and dependency references (export similar to previous version)
31
+
*`./terraform-provider-dynatrace -export -ref -id` downloads all available configuration settings with data sources / dependency references and adds commented ids in resource output
32
+
*`./terraform-provider-dynatrace -export -ref dynatrace_dashboard dynatrace_web_application` downloads all available dashboards, web applications and resource dependencies with references
33
+
*`./terraform-provider-dynatrace -export -ref dynatrace_alerting=4f5942d4-3450-40a8-818f-c5faeb3563d0 dynatrace_alerting=9c4b75f1-9a64-4b44-a8e4-149154fd5325` downloads the alerting profiles with the ids `4f5942d4-3450-40a8-818f-c5faeb3563d0` and `9c4b75f1-9a64-4b44-a8e4-149154fd5325`, includes all resource dependencies with references
34
+
*`./terraform-provider-dynatrace -export -ref dynatrace_calculated_service_metric dynatrace_alerting=4f5942d4-3450-40a8-818f-c5faeb3563d0` downloads all available calculated service metrics and also the alerting profile with the id `4f5942d4-3450-40a8-818f-c5faeb3563d0`, includes all resource dependencies with references
35
+
*`./terraform-provider-dynatrace -export -ref -exclude dynatrace_calculated_service_metric dynatrace_alerting` download all available configuration settings except `dynatrace_calculated_service_metric` and `dynatrace_alerting`, includes all resource dependencies with references
36
+
37
+
### Additional Information
38
+
* There may be instances where the exported configuration is deprecated and/or is unable to be used for a create/update. In these instances, the files will be moved into `.flawed` of the output folder and the explanation will be available as a commented output in the resource file.
39
+
- E.g. A dashboard with no tiles can be created and can be retrieved via the export, but the subsequent `terraform apply` would fail without any tiles.
40
+
* There are instances where the returned configuration does not contain all of the required information to run an `terraform apply` due to sensitive data or instances where the files require additional attention. The files that apply to this scenario will be automatically moved to `.requires_attention`, the explanation will be available as a commented output in the resource file.
41
+
- E.g. `dynatrace_credentials` confidential strings are not available via the API.
Copy file name to clipboardExpand all lines: docs/index.md
+72-26Lines changed: 72 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,14 +2,14 @@
2
2
layout: ""
3
3
page_title: "Provider: Dynatrace"
4
4
description: |-
5
-
The Dynatrace Terraform Provider provides resources to interact with the Dynatrace Config REST API.
5
+
The Dynatrace Terraform Provider provides resources to interact with the Dynatrace REST API.
6
6
---
7
7
8
8
# Dynatrace Terraform Provider
9
9
10
-
The Dynatrace Terraform Provider is used to interact with the resources supported by the Dynatrace Config REST API. The provider needs to be configured with the proper credentials before it can be used.
10
+
The Dynatrace Terraform Provider is used to interact with the resources supported by the Dynatrace REST API. The provider needs to be configured with the proper credentials before it can be used.
11
11
12
-
Use the links to the left to learn about the available resources.
12
+
Use the links to the left to learn about the available resources and data sources.
13
13
14
14
## Example
15
15
@@ -18,7 +18,7 @@ Use the links to the left to learn about the available resources.
18
18
terraform {
19
19
required_providers {
20
20
dynatrace = {
21
-
version = "1.14.1"
21
+
version = "1.15.0"
22
22
source = "dynatrace-oss/dynatrace"
23
23
}
24
24
}
@@ -31,32 +31,78 @@ provider "dynatrace" {
31
31
dt_api_token = "################"
32
32
}
33
33
```
34
-
where `dt_env_url` represents the URL of your Dynatrace Environment and `dt_api_token` needs to be an API Token with the permissions `Read configuration` and `Capture request data`.
34
+
where `dt_env_url` represents the URL of your Dynatrace Environment and `dt_api_token` needs to be an API Token with the following permissions:
35
+
*`Read configuration`
36
+
*`Capture request data`
37
+
*`Read SLO`
38
+
*`Read settings`
39
+
*`Read synthetic monitors, locations, and nodes`
35
40
36
41
## Exporting existing configuration from a Dynatrace Environment
37
-
In addition to acting as a Terraform Provider Plugin the executable `terraform-provider-dynatrace` (`terraform-provider-dynatrace.exe` on Windows) can also get directly invoked.
38
-
The utility then reaches out to the Dynatrace Environment specified by the command line arguments and fetches all currently supported configuration items. These results will then automatically get transformed into HCL (the configuration language to be used for `.tf` files) and places each configuration item into its own `.tf` file).
42
+
In addition to acting as a Terraform Provider Plugin, the executable `terraform-provider-dynatrace` (`terraform-provider-dynatrace.exe` on Windows) can be directly invoked.
43
+
The utility reaches out to the Dynatrace Environment specified by the command line arguments and fetches all currently supported configuration items. These results will then automatically get transformed into HCL (the configuration language to be used for `.tf` files) and places each configuration item into its own `.tf` file.
44
+
45
+
With release 1.15.0, a new and improved version of the export utility is now available with various improvements (outlined below).
46
+
* Data source references automatically generated in resources
47
+
* Data source blocks created for dependencies in data_source.tf file(s)
48
+
* Creation of all resources required based off of dependencies
49
+
* Resources organized in modules with preconfigured main.tf based on output
50
+
* Pre-populated providers.tf file in the parent folder and all modules
51
+
* Option to include ID as a commented line in generated resources
52
+
* Option to include/exclude specific resource IDs from export
53
+
* Ability to convert from HCL to JSON formatted files
54
+
55
+
Please provide any feedback of the export utility via [GitHub Issues](https://github.com/dynatrace-oss/terraform-provider-dynatrace/issues). Details on the execution of the export utility is provided below.
56
+
39
57
### Command Line Syntax
40
58
Invoking the export functionality requires
41
-
* The environment varibale `DYNATRACE_ENV_URL` as the URL of your Dynatrace Environment
42
-
* The environment variable `DYNATRACE_API_TOKEN` as the API Token with the following permissions:
43
-
-`Read configuration`
44
-
-`Capture request data`
45
-
-`Read SLO`
46
-
-`Read settings`
47
-
-`Read synthetic monitors, locations, and nodes`
48
-
* Optinonally the environment variable `DYNATRACE_TARGET_FOLDER`. If it's not set, the output folder `./configuration` is assumed
*`./terraform-provider-dynatrace export` downloads all available configuration settings
55
-
*`./terraform-provider-dynatrace export dynatrace_dashboard` downloads all available dashboards
56
-
*`./terraform-provider-dynatrace export dynatrace_dashboard dynatrace_slo` downloads all available dashboards and all available SLOs
57
-
*`./terraform-provider-dynatrace export dynatrace_dashboard=4f5942d4-3450-40a8-818f-c5faeb3563d0` downloads only the dashboard with the id `4f5942d4-3450-40a8-818f-c5faeb3563d0`
58
-
*`./terraform-provider-dynatrace export dynatrace_dashboard=4f5942d4-3450-40a8-818f-c5faeb3563d0 dynatrace_dashboard=9c4b75f1-9a64-4b44-a8e4-149154fd5325` downloads only the dashboards with the ids `4f5942d4-3450-40a8-818f-c5faeb3563d0` and `9c4b75f1-9a64-4b44-a8e4-149154fd5325`
59
-
*`./terraform-provider-dynatrace export dynatrace_slo dynatrace_dashboard=4f5942d4-3450-40a8-818f-c5faeb3563d0 dynatrace_dashboard=9c4b75f1-9a64-4b44-a8e4-149154fd5325` downloads all available SLOs and only the dashboards with the ids `4f5942d4-3450-40a8-818f-c5faeb3563d0` and `9c4b75f1-9a64-4b44-a8e4-149154fd5
59
+
* The environment variable `DYNATRACE_ENV_URL` as the URL of your Dynatrace environment
60
+
* The environment variable `DYNATRACE_API_TOKEN` as the API Token of your Dynatrace environment
61
+
* Optionally the environment variable `DYNATRACE_TARGET_FOLDER`. If it's not set, the output folder `./configuration` is assumed
*`-ref` Enable resources with data sources and dependencies
70
+
*`-id` Enable commented id output in resource files
71
+
*`-migrate` Enable output specific to environment migration
72
+
- Removes node IDs from private synthetic locations
73
+
*`-exclude` Exclude specified resource(s) from export
74
+
75
+
**NOTE:** Dashboards (because there could be thousands of them) are currently excluded from the export unless the resource is directly specified in the command line arguments.
76
+
77
+
### Usage Examples
78
+
*`./terraform-provider-dynatrace -export` downloads all available configuration settings without data sources and dependency references (export similar to previous version)
79
+
*`./terraform-provider-dynatrace -export -ref -id` downloads all available configuration settings with data sources / dependency references and adds commented ids in resource output
80
+
*`./terraform-provider-dynatrace -export -ref dynatrace_dashboard dynatrace_web_application` downloads all available dashboards, web applications and resource dependencies with references
81
+
*`./terraform-provider-dynatrace -export -ref dynatrace_alerting=4f5942d4-3450-40a8-818f-c5faeb3563d0 dynatrace_alerting=9c4b75f1-9a64-4b44-a8e4-149154fd5325` downloads the alerting profiles with the ids `4f5942d4-3450-40a8-818f-c5faeb3563d0` and `9c4b75f1-9a64-4b44-a8e4-149154fd5325`, includes all resource dependencies with references
82
+
*`./terraform-provider-dynatrace -export -ref dynatrace_calculated_service_metric dynatrace_alerting=4f5942d4-3450-40a8-818f-c5faeb3563d0` downloads all available calculated service metrics and also the alerting profile with the id `4f5942d4-3450-40a8-818f-c5faeb3563d0`, includes all resource dependencies with references
83
+
*`./terraform-provider-dynatrace -export -ref -exclude dynatrace_calculated_service_metric dynatrace_alerting` download all available configuration settings except `dynatrace_calculated_service_metric` and `dynatrace_alerting`, includes all resource dependencies with references
84
+
85
+
### Additional Information
86
+
* There may be instances where the exported configuration is deprecated and/or is unable to be used for a create/update. In these instances, the files will be moved into `.flawed` of the output folder and the explanation will be available as a commented output in the resource file.
87
+
- E.g. A dashboard with no tiles can be created and can be retrieved via the export, but the subsequent `terraform apply` would fail without any tiles.
88
+
* There are instances where the returned configuration does not contain all of the required information to run an `terraform apply` due to sensitive data or instances where the files require additional attention. The files that apply to this scenario will be automatically moved to `.requires_attention`, the explanation will be available as a commented output in the resource file.
89
+
- E.g. `dynatrace_credentials` confidential strings are not available via the API.
90
+
91
+
### Known Issues
92
+
* Due to the complexity of dashboards, there may be cases where the `terraform apply` fails after an export. Dashboard validation will be improved in a future release.
*`./terraform-provider-dynatrace exportv1` downloads all available configuration settings
101
+
*`./terraform-provider-dynatrace exportv1 dynatrace_dashboard` downloads all available dashboards
102
+
*`./terraform-provider-dynatrace exportv1 dynatrace_dashboard dynatrace_slo` downloads all available dashboards and all available SLOs
103
+
*`./terraform-provider-dynatrace exportv1 dynatrace_dashboard=4f5942d4-3450-40a8-818f-c5faeb3563d0` downloads only the dashboard with the id `4f5942d4-3450-40a8-818f-c5faeb3563d0`
104
+
*`./terraform-provider-dynatrace exportv1 dynatrace_dashboard=4f5942d4-3450-40a8-818f-c5faeb3563d0 dynatrace_dashboard=9c4b75f1-9a64-4b44-a8e4-149154fd5325` downloads only the dashboards with the ids `4f5942d4-3450-40a8-818f-c5faeb3563d0` and `9c4b75f1-9a64-4b44-a8e4-149154fd5325`
105
+
*`./terraform-provider-dynatrace exportv1 dynatrace_slo dynatrace_dashboard=4f5942d4-3450-40a8-818f-c5faeb3563d0 dynatrace_dashboard=9c4b75f1-9a64-4b44-a8e4-149154fd5325` downloads all available SLOs and only the dashboards with the ids `4f5942d4-3450-40a8-818f-c5faeb3563d0` and `9c4b75f1-9a64-4b44-a8e4-149154fd5
0 commit comments