Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update hand written docs to reflect newly required fields #2682

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/terraform
2 changes: 1 addition & 1 deletion build/terraform-beta
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,23 @@ 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 @@ -91,13 +101,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 @@ -206,10 +218,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 @@ -251,23 +264,33 @@ 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,
ForceNew: true,
Type: schema.TypeBool,
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,
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",
Default: "172.16.0.0/28",
},
},
},
Expand Down
17 changes: 12 additions & 5 deletions third_party/terraform/resources/resource_container_cluster.go.erb
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,11 @@ func resourceContainerCluster() *schema.Resource {
<% if version == 'ga' -%>
Required: true,
<% else %>
Optional: true,
Optional: true,
ExactlyOneOf: []string{
"maintenance_policy.0.daily_maintenance_window",
"maintenance_policy.0.recurring_window",
},
<% end %>
MaxItems: 1,
Elem: &schema.Resource{
Expand All @@ -442,10 +446,13 @@ func resourceContainerCluster() *schema.Resource {
},
<% unless version == 'ga' -%>
"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
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
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
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
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
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
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
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
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
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
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