Skip to content

Commit

Permalink
Sync main branch into FEATURE-BRANCH-provider-functions (#10032) (#665)
Browse files Browse the repository at this point in the history
* fixes: permadiff issue if event trigger region is not specified (#9989)

* fixes: permadiff issue if event trigger region is not specified

- fixes hashicorp/terraform-provider-google#17161

* chore: Updated cloudfunction2 test with no explicit trigger_region

* Fix GKE front matter, bad field docs (#10018)

* Fix GKE front matter, bad field docs

* Update container_cluster.html.markdown

* added default value for minPortsPerVM field at "google_compute_router_nat" (#9712)

* added default value for statis allocation

* setting the default from API

* add newline removal bash command in guidelines (#9734)

* Update hashicorp/terraform-plugin-framework, hashicorp/terraform-plugin-mux, hashicorp/terraform-plugin-sdk/v2 (#10009)

* Adding Data Source Forwarding Rules (#10004)

* Fix broken terraform datasource google_compute_machine_types example (#10020)

* Add check for Environment proto field before accessing in Dataflow provider (#10016)

* Add comments to skipped sweeper (#10023)

* Add comments for skipped sweepers (#10024)

* C3 version schema (#9986)

* add support for build number in composerEnvironmentVersionRegexp and composerImageVersionDiffSuppress

* make build number optional

* regroup regex, cleaner comparison of versions

* correction

* Add Resource Manager Tags support to 'google_container_cluster' (#9531)

* resourceManagerTags added to Cluster Node Config schema

* update beta tag

* add cluster and node proto tests

* add expand and flatten proto

* removed beta tag

* added to documentation

* added resource manager tags to auto pilot

* migrating resourceManagerTags tests

* migrating node_pools test

* migrating additional tests

* minor fixes

* fixing tests

* add in-place update support

* fixed tests

* fixed annotations

* validated clusters and node pools tests. Isolated node pool auto config

* isolated resource manager tags from docs

* fixed permission issue

* fixed spaces

* fixed non determinism on tag keys

* removed auto_pilot rmts

* fixed time_sleep

* add depends_on to IAM policies

* Add volume replication support for Google Cloud NetApp Volumes (#9816)

* Initial replication commit

* Cleanup work

- Renamed a lot of files to make clear which resource the belong to
- Updated documentation for resource fields
- Renamed a few resource fields and changed some types
- Disabled the custom code for now. Needs to be discussed first

* Update example file

* Updated example file

* Major updates

- Reorganisation of block
- Reorganisation of fields to match API documentation
- Updated example parameters
- Added missing API fields
- Improved descriptions
-

* For replication deletion, stop replication first

* Add support for deleting destination volume on replication delete

* Make volumes deletable in presence of snapshots.

This change will be PRed for volume resource independently. Adding it here while it is not in main.

* Improving debug error message

* yaml check and format fix

* Add wait for mirror to initialize.

Required to run destroy shortly after create.

* Wait on destroy, not on create

* Make deleting a replication more robust

- doc improvements
- started to implement stop/resume. More work required.
- renamed a few files to better reflect what they are good for

* adding support for stop/resume

* yamlformat and lint

* Add force delete to delete volumes with nested snapshots

* resource test first version

* More changes to make tests solid

- Introduced new parameter to wait for mirror_status==MIRRORED
- more mirror state reconciliation

* Test updates

* few cleanups

* Make virtual field verifies happy

* Minor test improvements

* More fine tuning

- Remove merge conflict in volume.yaml
- make generated test work
- make output field work
- ignore_read for virtual fields

* Resource name change as suggested by @slevenick

* Remove snapshot code block and fix typo

* Detect manual stop/resume actions

* Remove ignore_read for deletion_policy

* - Made destinationVolumeParameters immutable. It still requires ignore_read.
- removed ignore_read from virtual_fields

* destinationVolumeParameters are only evaluated at create. Make the immutable.

* Name cleanups and comment improvements

* removed comment



* tabs to spaces in resource block



* Updates to address review comments

- make wait_for_mirror also work for stop/resume, additionally to create
- convert tabs in test resource blocks to spaces
- fix typos

* Rewording of comments



---------




* Ensured that beta runs in TeamCity use only beta paths (#10025)

* Ensured that beta runs in TeamCity use only beta paths

* Added tests for sweeper package path

---------















[upstream:566f9489b8186aa106c77573bc6c08d63047523d]

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Feb 22, 2024
1 parent 5d4ca01 commit cb66a2d
Show file tree
Hide file tree
Showing 4 changed files with 155 additions and 0 deletions.
15 changes: 15 additions & 0 deletions netapp_volume_replication_create/backing_file.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# This file has some scaffolding to make sure that names are unique and that
# a region and zone are selected when you try to create your Terraform resources.

locals {
name_suffix = "${random_pet.suffix.id}"
}

resource "random_pet" "suffix" {
length = 2
}

provider "google" {
region = "us-central1"
zone = "us-central1-c"
}
54 changes: 54 additions & 0 deletions netapp_volume_replication_create/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@

data "google_compute_network" "default" {
name = "test-network-${local.name_suffix}"
}

resource "google_netapp_storage_pool" "source_pool" {
name = "source-pool-${local.name_suffix}"
location = "us-central1"
service_level = "PREMIUM"
capacity_gib = 2048
network = data.google_compute_network.default.id
}

resource "google_netapp_storage_pool" "destination_pool" {
name = "destination-pool-${local.name_suffix}"
location = "us-west2"
service_level = "PREMIUM"
capacity_gib = 2048
network = data.google_compute_network.default.id
}

resource "google_netapp_volume" "source_volume" {
location = google_netapp_storage_pool.source_pool.location
name = "source-volume-${local.name_suffix}"
capacity_gib = 100
share_name = "source-volume-${local.name_suffix}"
storage_pool = google_netapp_storage_pool.source_pool.name
protocols = [
"NFSV3"
]
deletion_policy = "FORCE"
}

resource "google_netapp_volume_replication" "test_replication" {
depends_on = [google_netapp_volume.source_volume]
location = google_netapp_volume.source_volume.location
volume_name = google_netapp_volume.source_volume.name
name = "test-replication-${local.name_suffix}"
replication_schedule = "EVERY_10_MINUTES"
description = "This is a replication resource"
destination_volume_parameters {
storage_pool = google_netapp_storage_pool.destination_pool.id
volume_id = "destination-volume-${local.name_suffix}"
# Keeping the share_name of source and destination the same
# simplifies implementing client failover concepts
share_name = "source-volume-${local.name_suffix}"
description = "This is a replicated volume"
}
# WARNING: Setting delete_destination_volume to true, will delete the
# CURRENT destination volume if the replication is deleted. Omit the field
# or set delete_destination_volume=false to avoid accidental volume deletion.
delete_destination_volume = true
wait_for_mirror = true
}
7 changes: 7 additions & 0 deletions netapp_volume_replication_create/motd
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
===

These examples use real resources that will be billed to the
Google Cloud Platform project you use - so make sure that you
run "terraform destroy" before quitting!

===
79 changes: 79 additions & 0 deletions netapp_volume_replication_create/tutorial.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Netapp Volume Replication Create - Terraform

## Setup

<walkthrough-author name="[email protected]" analyticsId="UA-125550242-1" tutorialName="netapp_volume_replication_create" repositoryUrl="https://github.com/terraform-google-modules/docs-examples"></walkthrough-author>

Welcome to Terraform in Google Cloud Shell! We need you to let us know what project you'd like to use with Terraform.

<walkthrough-project-billing-setup></walkthrough-project-billing-setup>

Terraform provisions real GCP resources, so anything you create in this session will be billed against this project.

## Terraforming!

Let's use {{project-id}} with Terraform! Click the Cloud Shell icon below to copy the command
to your shell, and then run it from the shell by pressing Enter/Return. Terraform will pick up
the project name from the environment variable.

```bash
export GOOGLE_CLOUD_PROJECT={{project-id}}
```

After that, let's get Terraform started. Run the following to pull in the providers.

```bash
terraform init
```

With the providers downloaded and a project set, you're ready to use Terraform. Go ahead!

```bash
terraform apply
```

Terraform will show you what it plans to do, and prompt you to accept. Type "yes" to accept the plan.

```bash
yes
```


## Post-Apply

### Editing your config

Now you've provisioned your resources in GCP! If you run a "plan", you should see no changes needed.

```bash
terraform plan
```

So let's make a change! Try editing a number, or appending a value to the name in the editor. Then,
run a 'plan' again.

```bash
terraform plan
```

Afterwards you can run an apply, which implicitly does a plan and shows you the intended changes
at the 'yes' prompt.

```bash
terraform apply
```

```bash
yes
```

## Cleanup

Run the following to remove the resources Terraform provisioned:

```bash
terraform destroy
```
```bash
yes
```

0 comments on commit cb66a2d

Please sign in to comment.