Skip to content

Commit

Permalink
Make tpgtools generate beta docs into GA as well for parity with mmv1. (
Browse files Browse the repository at this point in the history
#5325) (#10545)

* Make tpgtools generate beta docs into GA as well for parity with mmv1.

Also, minor changes to make sure that the docs are a little bit better - allow overrides of documentation values, for instance.

Also, includes the actual description of the resource, which, at the moment is not acceptable in the DCL.  Will need to implement an override in the DCL.

* Generate reasonable documentation for autogenerated and handwritten tests.

* Default to - instead of _

* Improve documentation further with links and guides.

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Nov 10, 2021
1 parent d076ab2 commit 82e5f7e
Show file tree
Hide file tree
Showing 13 changed files with 158 additions and 41 deletions.
3 changes: 3 additions & 0 deletions .changelog/5325.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
all: fixed an issue where some documentation for new resources was not showing up in the GA provider if it was beta-only.
```
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module github.com/hashicorp/terraform-provider-google
require (
cloud.google.com/go/bigtable v1.10.1
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211021165233-f4f2a757f9e0
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211027225138-ef28ca390518
github.com/apparentlymart/go-cidr v1.1.0
github.com/client9/misspell v0.3.4
github.com/davecgh/go-spew v1.1.1
Expand Down
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1430,3 +1430,9 @@ rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211021165233-f4f2a757f9e0 h1:GQS66Qx0pa9JHrjKyI5AHesSPeFNlHebXlASOXzCJKY=
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211021165233-f4f2a757f9e0/go.mod h1:oEeBHikdF/NrnUy0ornVaY1OT+jGvTqm+LQS0+ZDKzU=
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211026195335-4a6ae4ac04de h1:R7uCfI/yavqO+qK6eZRiJKjDoKJ0yIJh1ni5y933LeA=
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211026195335-4a6ae4ac04de/go.mod h1:oEeBHikdF/NrnUy0ornVaY1OT+jGvTqm+LQS0+ZDKzU=
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211027225138-ef28ca390518 h1:tFdFasG+VDpnn+BfVbZrfGcoH6pw6s7ODYlZlhTO3UM=
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211027225138-ef28ca390518/go.mod h1:oEeBHikdF/NrnUy0ornVaY1OT+jGvTqm+LQS0+ZDKzU=
12 changes: 6 additions & 6 deletions google/resource_assured_workloads_workload_generated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func TestAccAssuredWorkloadsWorkload_FullHandWritten(t *testing.T) {
func testAccAssuredWorkloadsWorkload_BasicHandWritten(context map[string]interface{}) string {
return Nprintf(`
resource "google_assured_workloads_workload" "primary" {
display_name = "workload%{random_suffix}"
display_name = "tf-test-name%{random_suffix}"
labels = {
a = "a"
}
Expand All @@ -105,7 +105,7 @@ resource "google_assured_workloads_workload" "primary" {
}
resource "google_folder" "folder1" {
display_name = "workload%{random_suffix}"
display_name = "tf-test-name%{random_suffix}"
parent = "organizations/%{org_id}"
}
`, context)
Expand All @@ -114,7 +114,7 @@ resource "google_folder" "folder1" {
func testAccAssuredWorkloadsWorkload_BasicHandWrittenUpdate0(context map[string]interface{}) string {
return Nprintf(`
resource "google_assured_workloads_workload" "primary" {
display_name = "workload%{random_suffix}"
display_name = "tf-test-name%{random_suffix}"
labels = {
a = "b"
}
Expand All @@ -126,7 +126,7 @@ resource "google_assured_workloads_workload" "primary" {
}
resource "google_folder" "folder1" {
display_name = "workload%{random_suffix}"
display_name = "tf-test-name%{random_suffix}"
parent = "organizations/%{org_id}"
}
`, context)
Expand All @@ -135,7 +135,7 @@ resource "google_folder" "folder1" {
func testAccAssuredWorkloadsWorkload_FullHandWritten(context map[string]interface{}) string {
return Nprintf(`
resource "google_assured_workloads_workload" "primary" {
display_name = "workload%{random_suffix}"
display_name = "tf-test-name%{random_suffix}"
billing_account = "billingAccounts/%{billing_acct}"
compliance_regime = "FEDRAMP_MODERATE"
organization = "%{org_id}"
Expand All @@ -148,7 +148,7 @@ resource "google_assured_workloads_workload" "primary" {
}
resource "google_folder" "folder1" {
display_name = "workload%{random_suffix}"
display_name = "tf-test-name%{random_suffix}"
parent = "organizations/%{org_id}"
}
Expand Down
24 changes: 12 additions & 12 deletions google/resource_eventarc_trigger_generated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func TestAccEventarcTrigger_BasicHandWritten(t *testing.T) {
func testAccEventarcTrigger_BasicHandWritten(context map[string]interface{}) string {
return Nprintf(`
resource "google_eventarc_trigger" "primary" {
name = "trigger%{random_suffix}"
name = "tf-test-name%{random_suffix}"
location = "europe-west1"
matching_criteria {
attribute = "type"
Expand All @@ -89,11 +89,11 @@ resource "google_eventarc_trigger" "primary" {
}
resource "google_pubsub_topic" "foo" {
name = "topic%{random_suffix}"
name = "tf-test-topic%{random_suffix}"
}
resource "google_cloud_run_service" "default" {
name = "tf-test-service-eventarc%{random_suffix}"
name = "tf_test_event_arc_service%{random_suffix}"
location = "europe-west1"
metadata {
Expand Down Expand Up @@ -121,7 +121,7 @@ resource "google_cloud_run_service" "default" {
func testAccEventarcTrigger_BasicHandWrittenUpdate0(context map[string]interface{}) string {
return Nprintf(`
resource "google_eventarc_trigger" "primary" {
name = "trigger%{random_suffix}"
name = "tf-test-name%{random_suffix}"
location = "europe-west1"
matching_criteria {
attribute = "type"
Expand All @@ -141,11 +141,11 @@ resource "google_eventarc_trigger" "primary" {
}
resource "google_pubsub_topic" "foo" {
name = "topic%{random_suffix}"
name = "tf-test-topic%{random_suffix}"
}
resource "google_cloud_run_service" "default" {
name = "tf-test-service-eventarc%{random_suffix}"
name = "tf_test_event_arc_service%{random_suffix}"
location = "europe-west1"
metadata {
Expand All @@ -169,7 +169,7 @@ resource "google_cloud_run_service" "default" {
}
resource "google_cloud_run_service" "default2" {
name = "tf-test-service-eventarc%{random_suffix}2"
name = "tf_test_event_arc_service%{random_suffix}2"
location = "europe-north1"
metadata {
Expand Down Expand Up @@ -197,7 +197,7 @@ resource "google_cloud_run_service" "default2" {
func testAccEventarcTrigger_BasicHandWrittenUpdate1(context map[string]interface{}) string {
return Nprintf(`
resource "google_eventarc_trigger" "primary" {
name = "trigger%{random_suffix}"
name = "tf-test-name%{random_suffix}"
location = "europe-west1"
matching_criteria {
attribute = "type"
Expand All @@ -221,16 +221,16 @@ resource "google_eventarc_trigger" "primary" {
}
resource "google_service_account" "eventarc-sa" {
account_id = "sa%{random_suffix}"
account_id = "tf_test_service_account%{random_suffix}"
display_name = "Test Service Account"
}
resource "google_pubsub_topic" "foo" {
name = "topic%{random_suffix}"
name = "tf-test-topic%{random_suffix}"
}
resource "google_cloud_run_service" "default" {
name = "tf-test-service-eventarc%{random_suffix}"
name = "tf_test_event_arc_service%{random_suffix}"
location = "europe-west1"
metadata {
Expand All @@ -254,7 +254,7 @@ resource "google_cloud_run_service" "default" {
}
resource "google_cloud_run_service" "default2" {
name = "tf-test-service-eventarc%{random_suffix}2"
name = "tf_test_event_arc_service%{random_suffix}2"
location = "europe-north1"
metadata {
Expand Down
16 changes: 8 additions & 8 deletions google/resource_org_policy_policy_generated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ resource "google_org_policy_policy" "primary" {
}
resource "google_project" "basic" {
project_id = "tf-test-id-test%{random_suffix}"
name = "tf-test-id-test%{random_suffix}"
project_id = "tf-test-id%{random_suffix}"
name = "tf-test-id%{random_suffix}"
org_id = "%{org_id}"
}
Expand All @@ -194,7 +194,7 @@ resource "google_org_policy_policy" "primary" {
resource "google_folder" "basic" {
parent = "organizations/%{org_id}"
display_name = "folder%{random_suffix}"
display_name = "tf-test-folder%{random_suffix}"
}
Expand Down Expand Up @@ -231,7 +231,7 @@ resource "google_org_policy_policy" "primary" {
resource "google_folder" "basic" {
parent = "organizations/%{org_id}"
display_name = "folder%{random_suffix}"
display_name = "tf-test-folder%{random_suffix}"
}
Expand Down Expand Up @@ -300,8 +300,8 @@ resource "google_org_policy_policy" "primary" {
}
resource "google_project" "basic" {
project_id = "tf-test-id-test%{random_suffix}"
name = "tf-test-id-test%{random_suffix}"
project_id = "tf-test-id%{random_suffix}"
name = "tf-test-id%{random_suffix}"
org_id = "%{org_id}"
}
Expand Down Expand Up @@ -337,8 +337,8 @@ resource "google_org_policy_policy" "primary" {
}
resource "google_project" "basic" {
project_id = "tf-test-id-test%{random_suffix}"
name = "tf-test-id-test%{random_suffix}"
project_id = "tf-test-id%{random_suffix}"
name = "tf-test-id%{random_suffix}"
org_id = "%{org_id}"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func testAccPrivatecaCertificateTemplate_BasicCertificateTemplate(context map[st
return Nprintf(`
resource "google_privateca_certificate_template" "primary" {
location = "%{region}"
name = "tf-test-template-test%{random_suffix}"
name = "tf-test-template%{random_suffix}"
description = "An updated sample certificate template"
identity_constraints {
Expand Down Expand Up @@ -149,7 +149,7 @@ func testAccPrivatecaCertificateTemplate_BasicCertificateTemplateUpdate0(context
return Nprintf(`
resource "google_privateca_certificate_template" "primary" {
location = "%{region}"
name = "tf-test-template-test%{random_suffix}"
name = "tf-test-template%{random_suffix}"
description = "A sample certificate template"
identity_constraints {
Expand Down
5 changes: 3 additions & 2 deletions website/docs/r/assured_workloads_workload.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ layout: "google"
page_title: "Google: google_assured_workloads_workload"
sidebar_current: "docs-google-assured-workloads-workload"
description: |-
The AssuredWorkloads Workload resource
---

# google\_assured\_workloads\_workload

The AssuredWorkloads Workload resource

## Example Usage - basic_workload
A basic test of a assuredworkloads api
Expand Down Expand Up @@ -50,7 +51,7 @@ resource "google_assured_workloads_workload" "primary" {
}
resource_settings {
resource_id = "{{ring}}"
resource_id = "ring"
resource_type = "KEYRING"
}
}
Expand Down
7 changes: 4 additions & 3 deletions website/docs/r/eventarc_trigger.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,17 @@ layout: "google"
page_title: "Google: google_eventarc_trigger"
sidebar_current: "docs-google-eventarc-trigger"
description: |-
The Eventarc Trigger resource
---

# google\_eventarc\_trigger

The Eventarc Trigger resource

## Example Usage - basic
```hcl
resource "google_eventarc_trigger" "primary" {
name = "trigger"
name = "name"
location = "europe-west1"
matching_criteria {
attribute = "type"
Expand All @@ -49,7 +50,7 @@ resource "google_pubsub_topic" "foo" {
}
resource "google_cloud_run_service" "default" {
name = "service-eventarc"
name = "event_arc_service"
location = "europe-west1"
metadata {
Expand Down
93 changes: 93 additions & 0 deletions website/docs/r/monitoring_monitored_project.html.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
---
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** Type: DCL ***
#
# ----------------------------------------------------------------------------
#
# This file is managed by Magic Modules (https:#github.com/GoogleCloudPlatform/magic-modules)
# and is based on the DCL (https:#github.com/GoogleCloudPlatform/declarative-resource-client-library).
# Changes will need to be made to the DCL or Magic Modules instead of here.
#
# We are not currently able to accept contributions to this file. If changes
# are required, please file an issue at https:#github.com/hashicorp/terraform-provider-google/issues/new/choose
#
# ----------------------------------------------------------------------------
subcategory: "Cloud (Stackdriver) Monitoring"
layout: "google"
page_title: "Google: google_monitoring_monitored_project"
sidebar_current: "docs-google-monitoring-monitored-project"
description: |-
Beta only: Monitored Project allows you to set a project as monitored by a _metrics scope_, which is a term for a project used to group the metrics of multiple projects, potentially across multiple organizations. This enables you to view these groups in the Monitoring page of the cloud console.
---

# google\_monitoring\_monitored\_project

Beta only: Monitored Project allows you to set a project as monitored by a _metrics scope_, which is a term for a project used to group the metrics of multiple projects, potentially across multiple organizations. This enables you to view these groups in the Monitoring page of the cloud console.

For more information, see:
* [Understanding metrics scopes](https://cloud.google.com/monitoring/settings#concept-scope)
* [API notes](https://cloud.google.com/monitoring/settings/manage-api)
## Example Usage - basic_monitored_project
A basic example of a monitoring monitored project
```hcl
resource "google_monitoring_monitored_project" "primary" {
metrics_scope = "existing-metrics-scope-project"
name = google_project.basic.name
provider = google-beta
}
resource "google_project" "basic" {
project_id = "my-monitored-project"
name = "my-monitored-project"
org_id = "123456789"
provider = google-beta
}
```

## Argument Reference

The following arguments are supported:

* `metrics_scope` -
(Required)
Required. The resource name of the existing Metrics Scope that will monitor this project. Example: locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}

* `name` -
(Required)
Immutable. The resource name of the `MonitoredProject`. On input, the resource name includes the scoping project ID and monitored project ID. On output, it contains the equivalent project numbers. Example: `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`



- - -



## Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

* `id` - an identifier for the resource with format `locations/global/metricsScopes/{{metrics_scope}}/projects/{{name}}`

* `create_time` -
Output only. The time when this `MonitoredProject` was created.

## Timeouts

This resource provides the following
[Timeouts](/docs/configuration/resources.html#timeouts) configuration options:

- `create` - Default is 10 minutes.
- `delete` - Default is 10 minutes.

## Import

MonitoredProject can be imported using any of these accepted formats:

```
$ terraform import google_monitoring_monitored_project.default locations/global/metricsScopes/{{metrics_scope}}/projects/{{name}}
$ terraform import google_monitoring_monitored_project.default {{metrics_scope}}/{{name}}
```



Loading

0 comments on commit 82e5f7e

Please sign in to comment.