From ab8eb240e843fd82d93bebd8523d782d7df777f7 Mon Sep 17 00:00:00 2001 From: Edward Sun Date: Thu, 18 Jun 2020 16:52:49 +0000 Subject: [PATCH 1/3] add desc to schema for logging resources --- ...e_logging_billing_account_bucket_config.go | 7 ++-- .../resource_logging_billing_account_sink.go | 7 ++-- .../resource_logging_bucket_config.go | 38 +++++++++++-------- .../resources/resource_logging_exclusion.go | 22 ++++++----- .../resource_logging_folder_bucket_config.go | 7 ++-- .../resources/resource_logging_folder_sink.go | 16 ++++---- ...urce_logging_organization_bucket_config.go | 7 ++-- .../resource_logging_organization_sink.go | 14 ++++--- .../resource_logging_project_bucket_config.go | 7 ++-- .../resource_logging_project_sink.go | 18 +++++---- .../resources/resource_logging_sink.go | 32 +++++++++------- 11 files changed, 101 insertions(+), 74 deletions(-) diff --git a/third_party/terraform/resources/resource_logging_billing_account_bucket_config.go b/third_party/terraform/resources/resource_logging_billing_account_bucket_config.go index ef78c3c8eb19..d476b86f9569 100644 --- a/third_party/terraform/resources/resource_logging_billing_account_bucket_config.go +++ b/third_party/terraform/resources/resource_logging_billing_account_bucket_config.go @@ -9,9 +9,10 @@ import ( var loggingBillingAccountBucketConfigSchema = map[string]*schema.Schema{ "billing_account": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: `The parent resource that contains the logging bucket.`, }, } diff --git a/third_party/terraform/resources/resource_logging_billing_account_sink.go b/third_party/terraform/resources/resource_logging_billing_account_sink.go index 9d13505e7c03..e272ea60d489 100644 --- a/third_party/terraform/resources/resource_logging_billing_account_sink.go +++ b/third_party/terraform/resources/resource_logging_billing_account_sink.go @@ -18,9 +18,10 @@ func resourceLoggingBillingAccountSink() *schema.Resource { }, } schm.Schema["billing_account"] = &schema.Schema{ - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: `The billing account exported to the sink.`, } return schm } diff --git a/third_party/terraform/resources/resource_logging_bucket_config.go b/third_party/terraform/resources/resource_logging_bucket_config.go index 1cbd6f440934..b552ead02373 100644 --- a/third_party/terraform/resources/resource_logging_bucket_config.go +++ b/third_party/terraform/resources/resource_logging_bucket_config.go @@ -11,32 +11,38 @@ import ( var loggingBucketConfigSchema = map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: `The resource name of the bucket`, }, "location": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: `The location of the bucket. The supported locations are: "global" "us-central1"`, }, "bucket_id": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: `The name of the logging bucket. Logging automatically creates two log buckets: _Required and _Default.`, }, "description": { - Type: schema.TypeString, - Optional: true, - Computed: true, + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: `Describes this bucket.`, }, "retention_days": { - Type: schema.TypeInt, - Optional: true, - Default: 30, + Type: schema.TypeInt, + Optional: true, + Default: 30, + Description: `Logs will be retained by default for this amount of time, after which they will automatically be deleted. The minimum retention period is 1 day. If this value is set to zero at bucket creation time, the default time of 30 days will be used.`, }, "lifecycle_state": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: `The bucket's lifecycle such as active or deleted.`, }, } diff --git a/third_party/terraform/resources/resource_logging_exclusion.go b/third_party/terraform/resources/resource_logging_exclusion.go index ab7d63c9d3ad..14c5169c57e5 100644 --- a/third_party/terraform/resources/resource_logging_exclusion.go +++ b/third_party/terraform/resources/resource_logging_exclusion.go @@ -11,21 +11,25 @@ import ( var LoggingExclusionBaseSchema = map[string]*schema.Schema{ "filter": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: `The filter to apply when excluding logs. Only log entries that match the filter are excluded.`, }, "name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: `The name of the logging exclusion.`, }, "description": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + Description: `A human-readable description.`, }, "disabled": { - Type: schema.TypeBool, - Optional: true, + Type: schema.TypeBool, + Optional: true, + Description: `Whether this exclusion rule should be disabled or not. This defaults to false.`, }, } diff --git a/third_party/terraform/resources/resource_logging_folder_bucket_config.go b/third_party/terraform/resources/resource_logging_folder_bucket_config.go index 40603fdd9d3f..d1697696294a 100644 --- a/third_party/terraform/resources/resource_logging_folder_bucket_config.go +++ b/third_party/terraform/resources/resource_logging_folder_bucket_config.go @@ -9,9 +9,10 @@ import ( var loggingFolderBucketConfigSchema = map[string]*schema.Schema{ "folder": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: `The parent resource that contains the logging bucket.`, }, } diff --git a/third_party/terraform/resources/resource_logging_folder_sink.go b/third_party/terraform/resources/resource_logging_folder_sink.go index 4d23e790c891..72af44ac6b3c 100644 --- a/third_party/terraform/resources/resource_logging_folder_sink.go +++ b/third_party/terraform/resources/resource_logging_folder_sink.go @@ -19,18 +19,20 @@ func resourceLoggingFolderSink() *schema.Resource { }, } schm.Schema["folder"] = &schema.Schema{ - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: `The folder to be exported to the sink. Note that either [FOLDER_ID] or "folders/[FOLDER_ID]" is accepted.`, StateFunc: func(v interface{}) string { return strings.Replace(v.(string), "folders/", "", 1) }, } schm.Schema["include_children"] = &schema.Schema{ - Type: schema.TypeBool, - Optional: true, - ForceNew: true, - Default: false, + Type: schema.TypeBool, + Optional: true, + ForceNew: true, + Default: false, + Description: `Whether or not to include children folders in the sink export. If true, logs associated with child projects are also exported; otherwise only logs relating to the provided folder are included.`, } return schm diff --git a/third_party/terraform/resources/resource_logging_organization_bucket_config.go b/third_party/terraform/resources/resource_logging_organization_bucket_config.go index 6efd0429ebf2..3ecd0f1c59cd 100644 --- a/third_party/terraform/resources/resource_logging_organization_bucket_config.go +++ b/third_party/terraform/resources/resource_logging_organization_bucket_config.go @@ -9,9 +9,10 @@ import ( var loggingOrganizationBucketConfigSchema = map[string]*schema.Schema{ "organization": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: `The parent resource that contains the logging bucket.`, }, } diff --git a/third_party/terraform/resources/resource_logging_organization_sink.go b/third_party/terraform/resources/resource_logging_organization_sink.go index cbc93a41aac0..e58fe931ece9 100644 --- a/third_party/terraform/resources/resource_logging_organization_sink.go +++ b/third_party/terraform/resources/resource_logging_organization_sink.go @@ -19,17 +19,19 @@ func resourceLoggingOrganizationSink() *schema.Resource { }, } schm.Schema["org_id"] = &schema.Schema{ - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: `The numeric ID of the organization to be exported to the sink.`, StateFunc: func(v interface{}) string { return strings.Replace(v.(string), "organizations/", "", 1) }, } schm.Schema["include_children"] = &schema.Schema{ - Type: schema.TypeBool, - Optional: true, - ForceNew: true, - Default: false, + Type: schema.TypeBool, + Optional: true, + ForceNew: true, + Default: false, + Description: `Whether or not to include children organizations in the sink export. If true, logs associated with child projects are also exported; otherwise only logs relating to the provided organization are included.`, } return schm diff --git a/third_party/terraform/resources/resource_logging_project_bucket_config.go b/third_party/terraform/resources/resource_logging_project_bucket_config.go index b0bf6a89e3ff..97b291e05bb0 100644 --- a/third_party/terraform/resources/resource_logging_project_bucket_config.go +++ b/third_party/terraform/resources/resource_logging_project_bucket_config.go @@ -9,9 +9,10 @@ import ( var loggingProjectBucketConfigSchema = map[string]*schema.Schema{ "project": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: `The parent resource that contains the logging bucket.`, }, } diff --git a/third_party/terraform/resources/resource_logging_project_sink.go b/third_party/terraform/resources/resource_logging_project_sink.go index 2c7e3351e76e..40c377f0b8cd 100644 --- a/third_party/terraform/resources/resource_logging_project_sink.go +++ b/third_party/terraform/resources/resource_logging_project_sink.go @@ -20,16 +20,18 @@ func resourceLoggingProjectSink() *schema.Resource { }, } schm.Schema["project"] = &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - ForceNew: true, + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + Description: `The ID of the project to create the sink in. If omitted, the project associated with the provider is used.`, } schm.Schema["unique_writer_identity"] = &schema.Schema{ - Type: schema.TypeBool, - Optional: true, - Default: false, - ForceNew: true, + Type: schema.TypeBool, + Optional: true, + Default: false, + ForceNew: true, + Description: `Whether or not to create a unique identity associated with this sink. If false (the default), then the writer_identity used is serviceAccount:cloud-logs@system.gserviceaccount.com. If true, then a unique service account is created and used for this sink. If you wish to publish logs across projects, you must set unique_writer_identity to true.`, } return schm } diff --git a/third_party/terraform/resources/resource_logging_sink.go b/third_party/terraform/resources/resource_logging_sink.go index 21b8370f9d94..0fd881a30038 100644 --- a/third_party/terraform/resources/resource_logging_sink.go +++ b/third_party/terraform/resources/resource_logging_sink.go @@ -10,37 +10,43 @@ import ( func resourceLoggingSinkSchema() map[string]*schema.Schema { return map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: `The name of the logging sink.`, }, "destination": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: `The destination of the sink (or, in other words, where logs are written to). Can be a Cloud Storage bucket, a PubSub topic, or a BigQuery dataset. Examples: "storage.googleapis.com/[GCS_BUCKET]" "bigquery.googleapis.com/projects/[PROJECT_ID]/datasets/[DATASET]" "pubsub.googleapis.com/projects/[PROJECT_ID]/topics/[TOPIC_ID]" The writer associated with the sink must have access to write to the above resource.`, }, "filter": { Type: schema.TypeString, Optional: true, DiffSuppressFunc: optionalSurroundingSpacesSuppress, + Description: `The filter to apply when exporting logs. Only log entries that match the filter are exported.`, }, "writer_identity": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: `The identity associated with this sink. This identity must be granted write access to the configured destination.`, }, "bigquery_options": { - Type: schema.TypeList, - Optional: true, - Computed: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + Computed: true, + MaxItems: 1, + Description: `Options that affect sinks exporting data to BigQuery.`, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "use_partitioned_tables": { - Type: schema.TypeBool, - Required: true, + Type: schema.TypeBool, + Required: true, + Description: `Whether to use BigQuery's partition tables. By default, Logging creates dated tables based on the log entries' timestamps, e.g. syslog_20170523. With partitioned tables the date suffix is no longer present and special query syntax has to be used instead. In both cases, tables are sharded based on UTC timezone.`, }, }, }, From e86cb847f7d8627eb9f65e678333fff5728ba92f Mon Sep 17 00:00:00 2001 From: Edward Sun <42220489+edwardmedia@users.noreply.github.com> Date: Tue, 23 Jun 2020 17:32:02 -0700 Subject: [PATCH 2/3] Update third_party/terraform/resources/resource_logging_project_bucket_config.go Co-authored-by: emily --- .../resources/resource_logging_project_bucket_config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/terraform/resources/resource_logging_project_bucket_config.go b/third_party/terraform/resources/resource_logging_project_bucket_config.go index 97b291e05bb0..8bf40339afaf 100644 --- a/third_party/terraform/resources/resource_logging_project_bucket_config.go +++ b/third_party/terraform/resources/resource_logging_project_bucket_config.go @@ -12,7 +12,7 @@ var loggingProjectBucketConfigSchema = map[string]*schema.Schema{ Type: schema.TypeString, Required: true, ForceNew: true, - Description: `The parent resource that contains the logging bucket.`, + Description: `The parent project that contains the logging bucket.`, }, } From fb7fd461412fd7826ed017758bcee2c9af88cbd3 Mon Sep 17 00:00:00 2001 From: Edward Sun <42220489+edwardmedia@users.noreply.github.com> Date: Tue, 23 Jun 2020 17:32:13 -0700 Subject: [PATCH 3/3] Update third_party/terraform/resources/resource_logging_bucket_config.go Co-authored-by: emily --- .../terraform/resources/resource_logging_bucket_config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/terraform/resources/resource_logging_bucket_config.go b/third_party/terraform/resources/resource_logging_bucket_config.go index b552ead02373..2305e660bcf0 100644 --- a/third_party/terraform/resources/resource_logging_bucket_config.go +++ b/third_party/terraform/resources/resource_logging_bucket_config.go @@ -31,7 +31,7 @@ var loggingBucketConfigSchema = map[string]*schema.Schema{ Type: schema.TypeString, Optional: true, Computed: true, - Description: `Describes this bucket.`, + Description: `An optional description for this bucket.`, }, "retention_days": { Type: schema.TypeInt,