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) (#3848)

* 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 <magic-modules@google.com>
  • Loading branch information
modular-magician authored Nov 10, 2021
1 parent 13969f9 commit b0fa3b5
Show file tree
Hide file tree
Showing 13 changed files with 72 additions and 48 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-beta
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=
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-beta/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
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ resource "google_monitoring_monitored_project" "primary" {
provider = google-beta
}
resource "google_project" "basic" {
project_id = "id%{random_suffix}"
name = "id%{random_suffix}"
project_id = "tf-test-id%{random_suffix}"
name = "tf-test-id%{random_suffix}"
org_id = "%{org_id}"
provider = google-beta
}
Expand Down
16 changes: 8 additions & 8 deletions google-beta/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
14 changes: 9 additions & 5 deletions website/docs/r/monitoring_monitored_project.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,27 @@ layout: "google"
page_title: "Google: google_monitoring_monitored_project"
sidebar_current: "docs-google-monitoring-monitored-project"
description: |-
Beta only
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
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 = "my-project-name"
metrics_scope = "existing-metrics-scope-project"
name = google_project.basic.name
provider = google-beta
}
resource "google_project" "basic" {
project_id = "id"
name = "id"
project_id = "my-monitored-project"
name = "my-monitored-project"
org_id = "123456789"
provider = google-beta
}
Expand Down
15 changes: 10 additions & 5 deletions website/docs/r/org_policy_policy.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,17 @@ layout: "google"
page_title: "Google: google_org_policy_policy"
sidebar_current: "docs-google-org-policy-policy"
description: |-
An organization policy gives you programmatic control over your organization's cloud resources. Using Organization Policies, you will be able to configure constraints across your entire resource hierarchy.
---

# google\_org\_policy\_policy

An organization policy gives you programmatic control over your organization's cloud resources. Using Organization Policies, you will be able to configure constraints across your entire resource hierarchy.

For more information, see:
* [Understanding Org Policy concepts](https://cloud.google.com/resource-manager/docs/organization-policy/overview)
* [The resource hierarchy](https://cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy)
* [All valid constraints](https://cloud.google.com/resource-manager/docs/organization-policy/org-policy-constraints)
## Example Usage - enforce_policy
A test of an enforce orgpolicy policy for a project
```hcl
Expand All @@ -39,8 +44,8 @@ resource "google_org_policy_policy" "primary" {
}
resource "google_project" "basic" {
project_id = "id-test"
name = "id-test"
project_id = "id"
name = "id"
org_id = "123456789"
}
Expand Down Expand Up @@ -112,8 +117,8 @@ resource "google_org_policy_policy" "primary" {
}
resource "google_project" "basic" {
project_id = "id-test"
name = "id-test"
project_id = "id"
name = "id"
org_id = "123456789"
}
Expand Down
Loading

0 comments on commit b0fa3b5

Please sign in to comment.