Skip to content

Commit

Permalink
Update cloud operations tests
Browse files Browse the repository at this point in the history
  • Loading branch information
juliocc committed Feb 10, 2023
1 parent c192d9e commit 87c03b0
Show file tree
Hide file tree
Showing 49 changed files with 175 additions and 882 deletions.
17 changes: 17 additions & 0 deletions blueprints/cloud-operations/adfs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,20 @@ Once done testing, you can clean up resources by running `terraform destroy`.
| [ip_address](outputs.tf#L15) | IP address. | |

<!-- END TFDOC -->

## Test

```hcl
module "test" {
source = "./fabric/blueprints/cloud-operations/adfs"
prefix = "test"
project_create = {
billing_account_id = "12345-12345-12345"
parent = "folders/123456789"
}
project_id = "project-1"
ad_dns_domain_name = "example.com"
adfs_dns_domain_name = "adfs.example.com"
}
# tftest modules=5 resources=18
```
12 changes: 12 additions & 0 deletions blueprints/cloud-operations/dns-fine-grained-iam/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,15 @@ dig app1.svc.example.org +short
| [vms](outputs.tf#L25) | VM names. | |

<!-- END TFDOC -->

## Test

```hcl
module "test1" {
source = "./fabric/blueprints/cloud-operations/dns-fine-grained-iam"
name = "dns-sd-test"
project_create = true
project_id = "test"
}
# tftest modules=9 resources=25
```
14 changes: 14 additions & 0 deletions blueprints/cloud-operations/dns-shared-vpc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,17 @@ Note that Terraform 0.13 at least is required due to the use of `for_each` with
| [teams](outputs.tf#L17) | Team resources. | |

<!-- END TFDOC -->

## Test

```hcl
module "test" {
source = "./fabric/blueprints/cloud-operations/dns-shared-vpc"
billing_account_id = "111111-222222-333333"
folder_id = "folders/1234567890"
prefix = "test"
shared_vpc_link = "https://www.googleapis.com/compute/v1/projects/test-dns/global/networks/default"
teams = ["team1", "team2"]
}
# tftest modules=9 resources=12
```
11 changes: 11 additions & 0 deletions blueprints/cloud-operations/onprem-sa-key-management/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,14 @@ terraform destroy -var project_id=$GOOGLE_CLOUD_PROJECT
| [sa-credentials](outputs.tf#L17) | SA json key templates. | |

<!-- END TFDOC -->

## Test

```hcl
module "test" {
source = "./fabric/blueprints/cloud-operations/onprem-sa-key-management"
project_create = true
project_id = "test"
}
# tftest modules=4 resources=7
```
12 changes: 12 additions & 0 deletions blueprints/cloud-operations/quota-monitoring/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,15 @@ Clone this repository or [open it in cloud shell](https://ssh.cloud.google.com/c
| [schedule_config](variables.tf#L66) | Schedule timer configuration in crontab format. | <code>string</code> | | <code>&#34;0 &#42; &#42; &#42; &#42;&#34;</code> |

<!-- END TFDOC -->

## Test

```hcl
module "test" {
source = "./fabric/blueprints/cloud-operations/quota-monitoring"
name = "name"
project_create = true
project_id = "test"
}
# tftest modules=4 resources=14
```
4 changes: 2 additions & 2 deletions blueprints/cloud-operations/quota-monitoring/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2022 Google LLC
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -55,7 +55,7 @@ module "cf" {
location = var.region
}
bundle_config = {
source_dir = "cf"
source_dir = "${path.module}/cf"
output_path = var.bundle_path
}
# https://github.com/hashicorp/terraform-provider-archive/issues/40
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,29 @@ This is an optional part, created if `cai_gcs_export` is set to `true`. The high
| [cloud-function](outputs.tf#L22) | Cloud Function instance details. | |

<!-- END TFDOC -->

## Test

```hcl
module "test" {
source = "./fabric/blueprints/cloud-operations/scheduled-asset-inventory-export-bq"
billing_account = "1234-ABCD-1234"
cai_config = {
bq_dataset = "my-dataset"
bq_table = "my_table"
bq_table_overwrite = "true"
target_node = "organization/1234567890"
}
cai_gcs_export = true
file_config = {
bucket = "my-bucket"
filename = "my-folder/myfile.json"
format = "NEWLINE_DELIMITED_JSON"
bq_dataset = "my-dataset"
bq_table = "my_table"
}
project_create = true
project_id = "project-1"
}
# tftest modules=8 resources=34
```
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2022 Google LLC
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -94,7 +94,7 @@ module "cf" {
location = var.region
}
bundle_config = {
source_dir = "cf"
source_dir = "${path.module}/cf"
output_path = var.bundle_path
}
service_account = module.service-account.email
Expand All @@ -118,7 +118,7 @@ module "cffile" {
lifecycle_delete_age_days = null
}
bundle_config = {
source_dir = "cffile"
source_dir = "${path.module}/cffile"
output_path = var.bundle_path_cffile
excludes = null
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,30 @@ This sample creates\updates several distinct groups of resources:
| [m4ce_gmanaged_service_account](outputs.tf#L15) | Google managed service account created automatically during the migrate connector registration.. It is used by M4CE to perform activities on target projects. | |

<!-- END TFDOC -->

## Test

```hcl
module "test" {
source = "./fabric/blueprints/cloud-operations/vm-migration/host-target-projects"
project_create = {
billing_account_id = "1234-ABCD-1234"
parent = "folders/1234563"
}
migration_admin_users = ["user:[email protected]"]
migration_viewer_users = ["user:[email protected]"]
migration_target_projects = [module.test-target-project.name]
depends_on = [
module.test-target-project
]
}
module "test-target-project" {
source = "./fabric/modules/project"
billing_account = "1234-ABCD-1234"
name = "test-target-project"
project_create = true
}
# tftest modules=5 resources=24
```
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,39 @@ This sample creates\update several distinct groups of resources:
<!-- END TFDOC -->
## Manual Steps
Once this blueprint is deployed the M4CE [m4ce_gmanaged_service_account](https://cloud.google.com/migrate/compute-engine/docs/5.0/how-to/target-sa-compute-engine#configuring_the_default_service_account) has to be configured to grant the access to the shared VPC and allow the deploy of Compute Engine instances as the result of the migration.

## Test

```hcl
module "test" {
source = "./fabric/blueprints/cloud-operations/vm-migration/host-target-sharedvpc"
project_create = {
billing_account_id = "1234-ABCD-1234"
parent = "folders/1234563"
}
migration_admin_users = ["user:[email protected]"]
migration_viewer_users = ["user:[email protected]"]
migration_target_projects = [module.test-target-project.name]
sharedvpc_host_projects = [module.test-sharedvpc-host-project.name]
depends_on = [
module.test-target-project,
module.test-sharedvpc-host-project,
]
}
module "test-target-project" {
source = "./fabric/modules/project"
billing_account = "1234-ABCD-1234"
name = "test-target-project"
project_create = true
}
module "test-sharedvpc-host-project" {
source = "./fabric/modules/project"
billing_account = "1234-ABCD-1234"
name = "test-sharedvpc-host-project"
project_create = true
}
# tftest modules=7 resources=25
```
15 changes: 15 additions & 0 deletions blueprints/cloud-operations/vm-migration/single-project/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,18 @@ This sample creates several distinct groups of resources:
| [m4ce_gmanaged_service_account](outputs.tf#L15) | Google managed service account created automatically during the migrate connector registration. It is used by M4CE to perform activities on target projects. | |

<!-- END TFDOC -->

## Test

```hcl
module "test" {
source = "./fabric/blueprints/cloud-operations/vm-migration/single-project"
project_create = {
billing_account_id = "1234-ABCD-1234"
parent = "folders/1234563"
}
migration_admin_users = ["user:[email protected]"]
migration_viewer_users = ["user:[email protected]"]
}
# tftest modules=5 resources=20
```
13 changes: 0 additions & 13 deletions tests/blueprints/cloud_operations/__init__.py

This file was deleted.

13 changes: 0 additions & 13 deletions tests/blueprints/cloud_operations/adfs/__init__.py

This file was deleted.

24 changes: 0 additions & 24 deletions tests/blueprints/cloud_operations/adfs/fixture/main.tf

This file was deleted.

Loading

0 comments on commit 87c03b0

Please sign in to comment.