Skip to content

Commit

Permalink
Introduced dynatrace_appsec_vulnerability_settings resource
Browse files Browse the repository at this point in the history
  • Loading branch information
kishikawa12 committed Jul 28, 2023
1 parent abad25b commit ecf689b
Show file tree
Hide file tree
Showing 13 changed files with 603 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@ jobs:
env:
GOPROXY: "https://proxy.golang.org"
run: go build .
- name: TestAppSecVulnerabilitySettings
if: success() || failure()
env:
GOPROXY: "https://proxy.golang.org"
TF_ACC: true
DYNATRACE_DEBUG: true
DT_NO_REPAIR_INPUT: true
DYNATRACE_ENV_URL: ${{ secrets.DYNATRACE_ENV_URL }}
DYNATRACE_API_TOKEN: ${{ secrets.DYNATRACE_API_TOKEN }}
IAM_CLIENT_ID: ${{ secrets.IAM_CLIENT_ID }}
IAM_ACCOUNT_ID: ${{ secrets.IAM_ACCOUNT_ID }}
IAM_CLIENT_SECRET: ${{ secrets.IAM_CLIENT_SECRET }}
run: go test -v ./dynatrace/api/builtin/appsec/runtimevulnerabilitydetection
- name: TestDatabaseAnomalyDetection
if: success() || failure()
env:
Expand Down
224 changes: 224 additions & 0 deletions dynatrace/api/builtin/appsec/runtimevulnerabilitydetection/schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,224 @@
{
"allowedScopes": [
"environment"
],
"description": "Automated [Runtime Vulnerability Analytics](https://dt-url.net/c010iio) helps you quickly and completely understand each detected vulnerability in your environment and how to remediate it, allowing you to prioritize which vulnerabilities to fix first. Note: Enabling Third-party or Code-level Vulnerability Analytics consumes Application Security units. For details, see the [Application Security Monitoring documentation](https://dt-url.net/wq031ql).",
"displayName": "Vulnerability Analytics: General settings",
"documentation": "",
"dynatrace": "1",
"enums": {
"MonitoringMode": {
"description": "",
"displayName": "MonitoringMode",
"documentation": "",
"items": [
{
"description": "Code-level vulnerabilities will be ignored ",
"displayName": "Do not monitor",
"value": "MONITORING_OFF"
},
{
"description": "Code-level vulnerabilities will be recorded",
"displayName": "Monitor",
"value": "MONITORING_ON"
}
],
"type": "enum"
}
},
"maxObjects": 1,
"multiObject": false,
"properties": {
"enableCodeLevelVulnerabilityDetection": {
"default": false,
"description": "",
"displayName": "Enable Code-level Vulnerability Analytics",
"documentation": "",
"maxObjects": 1,
"modificationPolicy": "DEFAULT",
"nullable": false,
"type": "boolean"
},
"enableRuntimeVulnerabilityDetection": {
"default": false,
"description": "",
"displayName": "Enable Third-party Vulnerability Analytics",
"documentation": "",
"maxObjects": 1,
"modificationPolicy": "DEFAULT",
"nullable": false,
"type": "boolean"
},
"globalMonitoringModeJava": {
"default": "MONITORING_ON",
"description": "Global Java code-level vulnerability detection control defines the default for all process groups. You can use monitoring rules to override the default for certain process groups.",
"displayName": "Global Java code-level vulnerability detection control",
"documentation": "Code-level vulnerability detection for Java has been recently released as early access version. It has been designed to carry a production-ready performance footprint. The overhead is depending on your application, but should be negligible in most cases. You have to enable the OneAgent feature \"Java code-level vulnerability evaluation\" to get started.",
"maxObjects": 1,
"metadata": {
"sortItems": "disabled"
},
"modificationPolicy": "DEFAULT",
"nullable": false,
"type": {
"$ref": "#/enums/MonitoringMode"
}
},
"technologies": {
"description": "Vulnerability Analytics can be enabled/disabled per supported technology.",
"displayName": "Technologies",
"documentation": "",
"maxObjects": 1,
"modificationPolicy": "DEFAULT",
"nullable": false,
"type": {
"$ref": "#/types/Technology"
}
}
},
"schemaGroups": [
"group:appsec.vulnerability-analytics",
"group:appsec"
],
"schemaId": "builtin:appsec.runtime-vulnerability-detection",
"types": {
"Technology": {
"description": "",
"displayName": "Technology",
"documentation": "",
"properties": {
"enableDotNet": {
"default": true,
"description": "",
"displayName": ".NET",
"documentation": "",
"maxObjects": 1,
"modificationPolicy": "DEFAULT",
"nullable": false,
"type": "boolean"
},
"enableDotNetRuntime": {
"default": true,
"description": "",
"displayName": ".NET runtimes",
"documentation": "",
"maxObjects": 1,
"modificationPolicy": "DEFAULT",
"nullable": false,
"precondition": {
"expectedValue": true,
"property": "enableDotNet",
"type": "EQUALS"
},
"type": "boolean"
},
"enableGo": {
"default": true,
"description": "",
"displayName": "Go",
"documentation": "",
"maxObjects": 1,
"modificationPolicy": "DEFAULT",
"nullable": false,
"type": "boolean"
},
"enableJava": {
"default": true,
"description": "",
"displayName": "Java",
"documentation": "",
"maxObjects": 1,
"modificationPolicy": "DEFAULT",
"nullable": false,
"type": "boolean"
},
"enableJavaRuntime": {
"default": true,
"description": "",
"displayName": "Java runtimes",
"documentation": "",
"maxObjects": 1,
"modificationPolicy": "DEFAULT",
"nullable": false,
"precondition": {
"expectedValue": true,
"property": "enableJava",
"type": "EQUALS"
},
"type": "boolean"
},
"enableKubernetes": {
"default": true,
"description": "",
"displayName": "Kubernetes",
"documentation": "",
"maxObjects": 1,
"modificationPolicy": "DEFAULT",
"nullable": false,
"type": "boolean"
},
"enableNodeJs": {
"default": true,
"description": "",
"displayName": "Node.js",
"documentation": "",
"maxObjects": 1,
"modificationPolicy": "DEFAULT",
"nullable": false,
"type": "boolean"
},
"enableNodeJsRuntime": {
"default": true,
"description": "",
"displayName": "Node.js runtimes",
"documentation": "",
"maxObjects": 1,
"modificationPolicy": "DEFAULT",
"nullable": false,
"precondition": {
"expectedValue": true,
"property": "enableNodeJs",
"type": "EQUALS"
},
"type": "boolean"
},
"enablePhp": {
"default": true,
"description": "",
"displayName": "PHP",
"documentation": "",
"maxObjects": 1,
"modificationPolicy": "DEFAULT",
"nullable": false,
"type": "boolean"
}
},
"summaryPattern": "",
"type": "object",
"version": "0",
"versionInfo": ""
}
},
"uiCustomization": {
"tabs": {
"groups": [
{
"displayName": "Third-party Vulnerability Analytics",
"properties": [
"enableRuntimeVulnerabilityDetection",
"technologies"
]
},
{
"displayName": "Code-level Vulnerability Analytics",
"properties": [
"enableCodeLevelVulnerabilityDetection",
"globalMonitoringModeJava",
"globalMonitoringModeDotNet"
]
}
]
}
},
"version": "3.0.1"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* @license
* Copyright 2020 Dynatrace LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package runtimevulnerabilitydetection

import (
runtimevulnerabilitydetection "github.com/dynatrace-oss/terraform-provider-dynatrace/dynatrace/api/builtin/appsec/runtimevulnerabilitydetection/settings"
"github.com/dynatrace-oss/terraform-provider-dynatrace/dynatrace/settings"
"github.com/dynatrace-oss/terraform-provider-dynatrace/dynatrace/settings/services/settings20"
)

const SchemaVersion = "3.0.1"
const SchemaID = "builtin:appsec.runtime-vulnerability-detection"

func Service(credentials *settings.Credentials) settings.CRUDService[*runtimevulnerabilitydetection.Settings] {
return settings20.Service[*runtimevulnerabilitydetection.Settings](credentials, SchemaID, SchemaVersion)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* @license
* Copyright 2020 Dynatrace LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package runtimevulnerabilitydetection_test

import (
"testing"

"github.com/dynatrace-oss/terraform-provider-dynatrace/dynatrace/api/builtin/appsec/runtimevulnerabilitydetection"
"github.com/dynatrace-oss/terraform-provider-dynatrace/dynatrace/testing/api"
)

func TestAppSecVulnerabilitySettings(t *testing.T) {
api.TestService(t, runtimevulnerabilitydetection.Service)
}

func TestAccAppSecVulnerabilitySettings(t *testing.T) {
api.TestAcc(t)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* @license
* Copyright 2020 Dynatrace LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package runtimevulnerabilitydetection

type MonitoringMode string

var MonitoringModes = struct {
MonitoringOff MonitoringMode
MonitoringOn MonitoringMode
}{
"MONITORING_OFF",
"MONITORING_ON",
}
Loading

0 comments on commit ecf689b

Please sign in to comment.