Skip to content

Commit 81d3031

Browse files
authored
Sync main dec 5 feature branch resource identity (#15892)
2 parents 3a378fc + 90804a5 commit 81d3031

File tree

230 files changed

+8985
-1387
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

230 files changed

+8985
-1387
lines changed

.ci/containers/build-environment/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.24-bullseye AS builder
1+
FROM golang:1.25-trixie AS builder
22

33
# Set working directory
44
WORKDIR /app

.ci/containers/go-plus/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Stage 1: Download go module cache for builds
2-
FROM golang:1.24-bullseye AS builder
2+
FROM golang:1.25-trixie AS builder
33
ENV GOCACHE=/go/cache
44

55
RUN apt-get update && apt-get install -y unzip
@@ -12,7 +12,7 @@ WORKDIR /app1/magic-modules-main/.ci/magician
1212
RUN go build -o /dev/null .
1313

1414
# Stage 2: Creating the final image
15-
FROM golang:1.24-bullseye
15+
FROM golang:1.25-trixie
1616
SHELL ["/bin/bash", "-c"]
1717
ENV GOCACHE=/go/cache
1818

@@ -32,4 +32,4 @@ RUN apt-get update && \
3232
RUN wget https://releases.hashicorp.com/terraform/1.11.0/terraform_1.11.0_linux_amd64.zip \
3333
&& unzip terraform_1.11.0_linux_amd64.zip \
3434
&& rm terraform_1.11.0_linux_amd64.zip \
35-
&& mv ./terraform /bin/terraform
35+
&& mv ./terraform /bin/terraform

docs/content/convert/add-new-resource-tgc.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Each of these is discussed in more detail below.
4242
Magic Modules uses a shared code base to generate terraform-google-conversion and the [google](https://github.com/hashicorp/terraform-provider-google) and [google-beta](https://github.com/hashicorp/terraform-provider-google-beta) Terraform providers.
4343
Most Terraform resources are represented as [yaml files which are grouped by product](https://github.com/GoogleCloudPlatform/magic-modules/tree/master/mmv1/products).
4444
Each product has a `product.yaml` file (which defines the basic product information) and Resource.yaml files (which defines any resource-specific information).
45-
A Resource.yaml file can specify `include_in_tgc_next_DO_NOT_USE: true` to enable converters autogeneration, or `exclude_resource: true` to skip autogeneration for both converters and the providers.
45+
A Resource.yaml file can specify `include_in_tgc_next: true` to enable converters autogeneration, or `exclude_resource: true` to skip autogeneration for both converters and the providers.
4646

4747
Auto-generating converters code based on yaml files is strongly preferred.
4848

@@ -246,7 +246,7 @@ make test-integration-local TESTPATH=./test/services/alloydb TESTARGS='-run=Tes
246246

247247
To run one integration test for the added resource locally, run the following from the root of the `terraform-google-conversion` repository:
248248
```
249-
make test-integration-local TESTPATH=./test/services/alloydb TESTARGS='-run=TestAccAlloydbBackup_alloydbBackupBasicTestExample' > alloydbBackup.log
249+
make test-integration-local TESTPATH=./test/services/alloydb TESTARGS='-run=TestAccAlloydbBackup/TestAccAlloydbBackup_alloydbBackupBasicTestExample' > alloydbBackup.log
250250
```
251251

252252
The core integration tests in `terraform-google-conversion` mirror the naming of the corresponding acceptance tests in the Terraform provider. This testing process uses a crucial round-trip validation method:
@@ -267,7 +267,7 @@ The core integration tests in `terraform-google-conversion` mirror the naming of
267267

268268
| File | Content | Conversion Step |
269269
| :---------------------- | :------------------------------------------------------------ | :------------------- |
270-
| File 1 (.tf) | Original Terraform configuration (raw_config) | Start |
270+
| File 1 (.tf) | Original Terraform configuration (raw_config) | |
271271
| File 2 (.json) | CAI Assets exported from the resource (export_assets) | Input for CAI to HCL |
272272
| File 3 (export.tf) | Converted Terraform configuration (export_config) from File 2 | cai2hcl |
273273
| File 4 (roundtrip.json) | CAI Assets (roundtrip_assets) converted from File 3 | tfplan2cai |

docs/content/reference/field.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,36 @@ item_type:
435435
MULTI_LINE_FIELD_DESCRIPTION
436436
```
437437

438+
### `min_size`
439+
Array only. Validates that the array has at least this many items in it.
440+
441+
In many cases, it is better to avoid client-side validation. See [Best practices: Validation]({{< ref "/best-practices/validation" >}}) for more information.
442+
443+
Example:
444+
445+
```yaml
446+
- name: 'fieldOne'
447+
type: Array
448+
item_type:
449+
type: String
450+
min_size: 1
451+
```
452+
453+
### `max_size`
454+
Array only. Validates that the array has at most this many items in it.
455+
456+
In many cases, it is better to avoid client-side validation. See [Best practices: Validation]({{< ref "/best-practices/validation" >}}) for more information.
457+
458+
Example:
459+
460+
```yaml
461+
- name: 'fieldOne'
462+
type: Array
463+
item_type:
464+
type: String
465+
max_size: 10
466+
```
467+
438468
### `item_validation`
439469
Array only. Controls the [`ValidateFunc`](https://developer.hashicorp.com/terraform/plugin/sdkv2/schemas/schema-behaviors#validatefunc)
440470
used to validate individual items in the array. Behaves like [`validation`]({{<ref "#validation" >}}).
@@ -482,7 +512,6 @@ Example: Enum
482512
function: 'customFunction'
483513
```
484514

485-
486515
## `NestedObject` properties
487516

488517
### `properties`

mmv1/api/resource.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ type TGCResource struct {
392392
ExcludeTgc bool `yaml:"exclude_tgc,omitempty"`
393393

394394
// If true, include resource in the new package of TGC (terraform-provider-conversion)
395-
IncludeInTGCNext bool `yaml:"include_in_tgc_next_DO_NOT_USE,omitempty"`
395+
IncludeInTGCNext bool `yaml:"include_in_tgc_next,omitempty"`
396396

397397
// The resource kind in CAI.
398398
// If this is not set, then :name is used instead.

mmv1/products/alloydb/Backup.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ async:
4040
resource_inside_response: false
4141
custom_code:
4242
encoder: 'templates/terraform/encoders/alloydb_backup.tmpl'
43-
include_in_tgc_next_DO_NOT_USE: true
43+
include_in_tgc_next: true
4444
tgc_include_handwritten_tests: true
4545
examples:
4646
- name: 'alloydb_backup_basic'

mmv1/products/alloydb/Cluster.yaml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,10 @@ custom_code:
5959
pre_create: 'templates/terraform/pre_create/alloydb_cluster.go.tmpl'
6060
pre_update: 'templates/terraform/pre_update/alloydb_cluster.go.tmpl'
6161
pre_delete: 'templates/terraform/pre_delete/alloydb_cluster.go.tmpl'
62-
constants: 'templates/terraform/constants/alloydb_cluster.go.tmpl'
6362
tgc_decoder: 'templates/tgc_next/decoders/alloydb_cluster.go.tmpl'
64-
custom_diff:
65-
- 'alloydbClusterCustomizeDiff'
6663
# Skipping the sweeper because we need to force-delete clusters.
6764
exclude_sweeper: true
68-
include_in_tgc_next_DO_NOT_USE: true
65+
include_in_tgc_next: true
6966
tgc_include_handwritten_tests: true
7067
examples:
7168
- name: 'alloydb_cluster_basic'
@@ -326,7 +323,7 @@ properties:
326323
- name: 'initialUser'
327324
type: NestedObject
328325
description: |
329-
Initial user to setup during cluster creation. This must be set for all new Clusters.
326+
Initial user to setup during cluster creation. If unset for new Clusters, a postgres role with null password is created. You will need to create additional users or set the password in order to log in.
330327
ignore_read: true
331328
custom_flatten: 'templates/terraform/custom_flatten/alloydb_cluster_input_user_flatten.go.tmpl'
332329
properties:
@@ -335,13 +332,18 @@ properties:
335332
description: |
336333
The database username.
337334
is_missing_in_cai: true
335+
at_least_one_of:
336+
- 'initial_user.0.user'
337+
- 'initial_user.0.password'
338338
- name: 'password'
339339
type: String
340340
description: |
341341
The initial password for the user.
342-
required: true
343342
sensitive: true
344343
is_missing_in_cai: true
344+
at_least_one_of:
345+
- 'initial_user.0.user'
346+
- 'initial_user.0.password'
345347
- name: 'restoreBackupSource'
346348
type: NestedObject
347349
description: |

mmv1/products/alloydb/Instance.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ custom_code:
5252
custom_import: 'templates/terraform/custom_import/alloydb_instance.go.tmpl'
5353
# Skipping the sweeper because instances will be deleted during cluster sweeps
5454
exclude_sweeper: true
55-
include_in_tgc_next_DO_NOT_USE: true
55+
include_in_tgc_next: true
5656
tgc_include_handwritten_tests: true
5757
examples:
5858
- name: 'alloydb_instance_basic'

mmv1/products/apigee/Instance.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ custom_code:
4747
error_retry_predicates:
4848
- 'transport_tpg.IsApigeeRetryableError'
4949
exclude_sweeper: true
50-
include_in_tgc_next_DO_NOT_USE: true
50+
include_in_tgc_next: true
5151
tgc_include_handwritten_tests: true
5252
examples:
5353
- name: 'apigee_instance_basic'

mmv1/products/apphub/Application.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ custom_code:
4141
constants: 'templates/terraform/constants/apphub_application.go.tmpl'
4242
custom_diff:
4343
- 'apphubApplicationCustomizeDiff'
44-
include_in_tgc_next_DO_NOT_USE: true
44+
include_in_tgc_next: true
4545
tgc_include_handwritten_tests: true
4646
sweeper:
4747
url_substitutions:

0 commit comments

Comments
 (0)