Skip to content

Commit

Permalink
update hand written docs to reflect newly required fields (#1382)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored and paddycarver committed Nov 14, 2019
1 parent d9bbb7f commit 54d482b
Show file tree
Hide file tree
Showing 15 changed files with 127 additions and 60 deletions.
64 changes: 43 additions & 21 deletions google-beta/resource_composer_environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,22 @@ var composerEnvironmentReservedEnvVar = map[string]struct{}{
"SQL_USER": {},
}

var composerSoftwareConfigKeys = []string{
"config.0.software_config.0.airflow_config_overrides",
"config.0.software_config.0.pypi_packages",
"config.0.software_config.0.env_variables",
"config.0.software_config.0.image_version",
"config.0.software_config.0.python_version",
}
var (
composerSoftwareConfigKeys = []string{
"config.0.software_config.0.airflow_config_overrides",
"config.0.software_config.0.pypi_packages",
"config.0.software_config.0.env_variables",
"config.0.software_config.0.image_version",
"config.0.software_config.0.python_version",
}

composerConfigKeys = []string{
"config.0.node_count",
"config.0.node_config",
"config.0.software_config",
"config.0.private_environment_config",
}
)

func resourceComposerEnvironment() *schema.Resource {
return &schema.Resource{
Expand Down Expand Up @@ -90,13 +99,15 @@ func resourceComposerEnvironment() *schema.Resource {
Type: schema.TypeInt,
Computed: true,
Optional: true,
AtLeastOneOf: composerConfigKeys,
ValidateFunc: validation.IntAtLeast(3),
},
"node_config": {
Type: schema.TypeList,
Computed: true,
Optional: true,
MaxItems: 1,
Type: schema.TypeList,
Computed: true,
Optional: true,
AtLeastOneOf: composerConfigKeys,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"zone": {
Expand Down Expand Up @@ -205,10 +216,11 @@ func resourceComposerEnvironment() *schema.Resource {
},
},
"software_config": {
Type: schema.TypeList,
Optional: true,
Computed: true,
MaxItems: 1,
Type: schema.TypeList,
Optional: true,
Computed: true,
AtLeastOneOf: composerConfigKeys,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"airflow_config_overrides": {
Expand Down Expand Up @@ -250,21 +262,31 @@ func resourceComposerEnvironment() *schema.Resource {
},
},
"private_environment_config": {
Type: schema.TypeList,
Optional: true,
Computed: true,
MaxItems: 1,
ForceNew: true,
Type: schema.TypeList,
Optional: true,
Computed: true,
AtLeastOneOf: composerConfigKeys,
MaxItems: 1,
ForceNew: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"enable_private_endpoint": {
Type: schema.TypeBool,
Required: true,
Optional: true,
Default: true,
AtLeastOneOf: []string{
"config.0.private_environment_config.0.enable_private_endpoint",
"config.0.private_environment_config.0.master_ipv4_cidr_block",
},
ForceNew: true,
},
"master_ipv4_cidr_block": {
Type: schema.TypeString,
Optional: true,
AtLeastOneOf: []string{
"config.0.private_environment_config.0.enable_private_endpoint",
"config.0.private_environment_config.0.master_ipv4_cidr_block",
},
ForceNew: true,
Default: "172.16.0.0/28",
},
Expand Down
15 changes: 11 additions & 4 deletions google-beta/resource_container_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,10 @@ func resourceContainerCluster() *schema.Resource {
Type: schema.TypeList,

Optional: true,
ExactlyOneOf: []string{
"maintenance_policy.0.daily_maintenance_window",
"maintenance_policy.0.recurring_window",
},

MaxItems: 1,
Elem: &schema.Resource{
Expand All @@ -415,10 +419,13 @@ func resourceContainerCluster() *schema.Resource {
},
},
"recurring_window": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
ConflictsWith: []string{"maintenance_policy.0.daily_maintenance_window"},
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
ExactlyOneOf: []string{
"maintenance_policy.0.daily_maintenance_window",
"maintenance_policy.0.recurring_window",
},
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"start_time": {
Expand Down
16 changes: 8 additions & 8 deletions google-beta/resource_google_organization_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ var schemaOrganizationPolicy = map[string]*schema.Schema{
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"allow": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
ConflictsWith: []string{"list_policy.0.deny"},
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
ExactlyOneOf: []string{"list_policy.0.allow", "list_policy.0.deny"},
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"all": {
Expand All @@ -61,10 +61,10 @@ var schemaOrganizationPolicy = map[string]*schema.Schema{
},
},
"deny": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
ConflictsWith: []string{"list_policy.0.allow"},
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
ExactlyOneOf: []string{"list_policy.0.allow", "list_policy.0.deny"},
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"all": {
Expand Down
25 changes: 19 additions & 6 deletions website/docs/guides/version_3_upgrade.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ In an attempt to avoid allowing empty blocks in config files, at least one of `s

## Resource: `google_composer_environment`

### At least one of `airflow_config_overrides`, `pypi_packages`, `env_variables`, `image_version`, or `python_version` are now required on `google_composer_environment.config.software_config`
### At least one of `airflow_config_overrides`, `pypi_packages`, `env_variables`, `image_version`, or `python_version` is now required on `google_composer_environment.config.software_config`

In an attempt to avoid allowing empty blocks in config files, at least one of `airflow_config_overrides`,
`pypi_packages`, `env_variables`, `image_version`, or `python_version` is now required on the
Expand All @@ -407,10 +407,14 @@ In an attempt to avoid allowing empty blocks in config files, at least one of `a
Previously the default value of `use_ip_aliases` was `true`. In an attempt to avoid allowing empty blocks
in config files, `use_ip_aliases` is now required on the `ip_allocation_policy` block.

### `enable_private_endpoint` is now required on block `google_composer_environment.private_environment_config`
### At least one of `enable_private_endpoint` or `master_ipv4_cidr_block` is now required on `google_composer_environment.config.private_environment_config`

Previously the default value of `enable_private_endpoint` was `true`. In an attempt to avoid allowing empty blocks
in config files, `enable_private_endpoint` is now required on the `private_environment_config` block.
In an attempt to avoid allowing empty blocks in config files, at least one of `enable_private_endpoint` or `master_ipv4_cidr_block` is now required on the
`config.private_environment_config` block.

### At least one of `node_count`, `node_config`, `software_config` or `private_environment_config` required on `google_composer_environment.config`

In an attempt to avoid allowing empty blocks in config files, at least one of `node_count`, `node_config`, `software_config` or `private_environment_config` is now required on the `config` block.

## Resource: `google_compute_backend_bucket`

Expand Down Expand Up @@ -562,7 +566,7 @@ In an attempt to avoid allowing empty blocks in config files, at least one of `a
`disk_encryption_key_raw`, `kms_key_self_link`, `initialize_params`, `mode` or `source` is now required on the
`boot_disk` block.

### At least one of `size`, `type`, `image`, or `labels` are now required on `google_compute_instance.boot_disk.initialize_params`
### At least one of `size`, `type`, `image`, or `labels` is now required on `google_compute_instance.boot_disk.initialize_params`

In an attempt to avoid allowing empty blocks in config files, at least one of `size`, `type`, `image`, or `labels`
is now required on the `initialize_params` block.
Expand Down Expand Up @@ -1041,13 +1045,17 @@ required on the `master_authorized_networks_config` block.
In an attempt to avoid allowing empty blocks in config files, `disabled` is now
required on the different `google_container_cluster.addons_config` blocks.

### Exactly one of `daily_maintenance_window` or `recurring_window` is now required on `google_container_cluster.maintenance_policy`

In an attempt to avoid allowing empty blocks in config files, exactly one of `daily_maintenance_window` or `recurring_window` is now required on the
`maintenance_policy` block.

### At least one of `http_load_balancing`, `horizontal_pod_autoscaling` , `network_policy_config`, `cloudrun_config`, or `istio_config` is now required on `google_container_cluster.addons_config`

In an attempt to avoid allowing empty blocks in config files, at least one of `http_load_balancing`,
`horizontal_pod_autoscaling` , `network_policy_config`, `cloudrun_config`, or `istio_config` is now required on the
`addons_config` block.


### At least one of `username`, `password` or `client_certificate_config` is now required on `google_container_cluster.master_auth`

In an attempt to avoid allowing empty blocks in config files, at least one of `username`, `password`
Expand Down Expand Up @@ -1341,6 +1349,11 @@ required on the `http_check.auth_info` block.
In attempt to be more consistent with the API, exactly one of `list_policy`, `boolean_policy`,
or `restore_policy` is now required on `google_organization_policy`.

### Exactly one of `allow` or `deny` is now required on `google_organization_policy.list_policy`

In an attempt to avoid allowing empty blocks in config files, exactly one of `allow` or `deny` is now
required on the `list_policy` block.

### Exactly one of `all` or `values` is now required on `google_organization_policy.list_policy.allow` and `google_organization_policy.list_policy.deny`

In an attempt to avoid allowing empty blocks in config files, exactly one of `all` or `values` is now
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/app_engine_application.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ The following arguments are supported:

* `feature_settings` - (Optional) A block of optional settings to configure specific App Engine features:

* `split_health_checks` - (Optional) Set to false to use the legacy health check instead of the readiness
* `split_health_checks` - (Required) Set to false to use the legacy health check instead of the readiness
and liveness checks.

## Attributes Reference
Expand Down
7 changes: 4 additions & 3 deletions website/docs/r/bigquery_table.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,14 @@ The `csv_options` block supports:

The `google_sheets_options` block supports:

* `range` (Optional, Beta) - Range of a sheet to query from. Only used when
non-empty.
* `range` (Optional) - Range of a sheet to query from. Only used when
non-empty. At least one of `range` or `skip_leading_rows` must be set.
Typical format: "sheet_name!top_left_cell_id:bottom_right_cell_id"
For example: "sheet1!A1:B20"

* `skip_leading_rows` (Optional) - The number of rows at the top of the sheet
that BigQuery will skip when reading the data.
that BigQuery will skip when reading the data. At least one of `range` or
`skip_leading_rows` must be set.

The `time_partitioning` block supports:

Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/composer_environment.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ The `private_environment_config` block supports:
The `ip_allocation_policy` block supports:

* `use_ip_aliases` -
(Optional)
(Required)
Whether or not to enable Alias IPs in the GKE cluster. If true, a VPC-native cluster is created.
Defaults to true if the `ip_allocation_block` is present in config.

Expand Down
4 changes: 2 additions & 2 deletions website/docs/r/compute_instance.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ resource "google_compute_instance" "default" {
// Local SSD disk
scratch_disk {
interface = "SCSI"
}
network_interface {
Expand Down Expand Up @@ -193,8 +194,7 @@ The `initialize_params` block supports:

The `scratch_disk` block supports:

* `interface` - (Optional) The disk interface to use for attaching this disk; either SCSI or NVME.
Defaults to SCSI.
* `interface` - (Required) The disk interface to use for attaching this disk; either SCSI or NVME.

The `attached_disk` block supports:

Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/compute_instance_template.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ The `disk` block supports:

The `disk_encryption_key` block supports:

* `kms_key_self_link` - (Optional) The self link of the encryption key that is stored in Google Cloud KMS
* `kms_key_self_link` - (Required) The self link of the encryption key that is stored in Google Cloud KMS

The `network_interface` block supports:

Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/compute_router_peer.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ The `advertised_ip_ranges` block supports:
(Optional) User-specified description for the IP range.

* `range` -
(Optional) The IP range to advertise. The value must be a CIDR-formatted string.
(Required) The IP range to advertise. The value must be a CIDR-formatted string.


## Attributes Reference
Expand Down
4 changes: 2 additions & 2 deletions website/docs/r/container_cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ The `network_policy` block supports:

* `provider` - (Optional) The selected network policy provider. Defaults to PROVIDER_UNSPECIFIED.

* `enabled` - (Optional) Whether network policy is enabled on the cluster. Defaults to false.
* `enabled` - (Required) Whether network policy is enabled on the cluster.

The `node_config` block supports:

Expand Down Expand Up @@ -614,7 +614,7 @@ The `sandbox_type` block supports:

The `release_channel` block supports:

* `channel` - (Optional) The selected release channel. Defaults to `UNSPECIFIED`.
* `channel` - (Required) The selected release channel.
Accepted values are:
* UNSPECIFIED: Not set.
* RAPID: Weekly upgrade cadence; Early testers and developers who requires new features.
Expand Down
24 changes: 24 additions & 0 deletions website/docs/r/dataproc_cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ The `cluster_config` block supports:
* `software_config` (Optional) The config settings for software inside the cluster.
Structure defined below.

* `autoscaling_config` (Optional) The autoscaling policy config associated with the cluster.
Structure defined below.

* `initialization_action` (Optional) Commands to execute on each node after config is completed.
You can specify multiple versions of these. Structure defined below.

Expand Down Expand Up @@ -424,6 +427,27 @@ cluster_config {

- - -

The `cluster_config.autoscaling_config` block supports:

```hcl
cluster_config {
# Override or set some custom properties
autoscaling_config {
policy_uri = "projects/projectId/locations/region/autoscalingPolicies/policyId"
}
}
```

* `policy_uri` - (Required) The autoscaling policy used by the cluster.

Only resource names including projectid and location (region) are valid. Examples:

`https://www.googleapis.com/compute/v1/projects/[projectId]/locations/[dataproc_region]/autoscalingPolicies/[policy_id]`
`projects/[projectId]/locations/[dataproc_region]/autoscalingPolicies/[policy_id]`
Note that the policy must be in the same project and Cloud Dataproc region.

- - -

The `initialization_action` block (Optional) can be specified multiple times and supports:

```hcl
Expand Down
Loading

0 comments on commit 54d482b

Please sign in to comment.