Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
b11614a
add test to allow updating pd size and pd disk type
joelkattapuram Jan 29, 2025
75ef317
Adding API Docs for google_workbench_instance for registry (#12872)
NA2047 Jan 29, 2025
67ce2c7
add test to allow updating pd size and pd disk type
joelkattapuram Jan 29, 2025
0e9d4ce
Add support for diffing field sets (#12330)
trodge Jan 29, 2025
ad3ac4d
Merge branch 'updatePdTest' of github.com:joelkattapuram/magic-module…
joelkattapuram Jan 29, 2025
e9e5836
Merge branch 'updatePdTest' of github.com:joelkattapuram/magic-module…
joelkattapuram Jan 29, 2025
f506dcf
Merge branch 'updatePdTest' of github.com:joelkattapuram/magic-module…
joelkattapuram Jan 29, 2025
67558a9
Memorystore Cluster_Disabled : Rename Standalone value in Mode field …
arunsatyarth Jan 29, 2025
5d7d17e
fix
joelkattapuram Jan 29, 2025
ff7f731
Add Security Gateway Application resource (#12837)
Berro321 Jan 29, 2025
b07ab16
Revert "Add Security Gateway Application resource" (#12915)
trodge Jan 29, 2025
2cabee5
Allow parallelization of per instance config deletions by not locking…
askubis Jan 30, 2025
1003475
Call out big refactorings as something that release notes should cove…
rileykarson Jan 30, 2025
204a9be
enable merge-group for downstreams build op (#12920)
ScottSuarez Jan 30, 2025
de41d5d
Update ChatEngine documentation (#12907)
SDonkelaarGDD Jan 30, 2025
a7fb74d
Add notes that label starting with "__" are reserved for internal use…
7mako Jan 30, 2025
dc850c2
Colab execution (#12790)
bcreddy-gcp Jan 30, 2025
da41550
Fix metadata for recent resource changes 20250130 (#12925)
roaks3 Jan 30, 2025
bd40f8d
Revert "Make nodepool concurrent ops scale better (#12488)" (#12916)
Xylosma Jan 30, 2025
49538f3
Add diff suppression for the renewal_plan field in google_bigquery_ca…
wj-chen Jan 30, 2025
a1649f7
Add support for parameter manager parameter version render datasource…
abheda-crest Jan 30, 2025
459a05a
Bump github.com/golang/glog from 1.2.2 to 1.2.4 (#12927)
melinath Jan 31, 2025
a44d29c
Add autogen status to metadata (#12873)
slevenick Jan 31, 2025
cf75865
Unskipped tests for tpg-20574 (#12909)
melinath Jan 31, 2025
7a23ebb
Adding IP Collection To Forwarding Rule (#12914)
dhruv-23101998 Jan 31, 2025
c9d389d
bigquery analyticshub listing subscription (#12820)
c2thorn Jan 31, 2025
43ea874
Support for projects in EgressSource (#12532)
Angelina612 Jan 31, 2025
c4a3080
Updated docs on running single tests (#12801)
wyardley Jan 31, 2025
d8be7da
Add Gemini Logging Setting resource (#12892)
PerlMonker303 Jan 31, 2025
e2de64e
Remove unused test (#12936)
slevenick Jan 31, 2025
383b394
Adding replication field for Filestore Instance (#11897)
NA2047 Jan 31, 2025
e108fe9
Add fields to support configuring new Media CDN features via Terrafor…
nahurfonseca Jan 31, 2025
bc0b2a9
Add Network Firewall Policy Policy Packet Mirroring Rule resource (#1…
mihhalj Jan 31, 2025
a4bd956
update cache package to v4.2.0 (#12935)
ScottSuarez Jan 31, 2025
502f93d
Adding API Docs for google_privileged_access_manager_entitlement for …
NA2047 Jan 31, 2025
09f73d5
ignore labels field
joelkattapuram Feb 1, 2025
c0cff93
Beyondcorp application (#12919)
trodge Feb 1, 2025
0500297
Support Post sart up script on runtime templates (#12929)
bcreddy-gcp Feb 1, 2025
27fd884
Add Gemini Release Channel Setting resource (#12894)
PerlMonker303 Feb 3, 2025
bb83af8
workbench: Fix a bug with instance metadata being removed not working…
bcreddy-gcp Feb 3, 2025
30fcb3c
Make colab runtime startable/stoppable (#12904)
bcreddy-gcp Feb 3, 2025
e1ec69d
Adding API Docs for resource_compute_interconnect_attachment for regi…
NA2047 Feb 3, 2025
e8d99c4
Adding API Docs for google_secure_source_manager_repository and googl…
NA2047 Feb 3, 2025
7cef963
Fixed datastream connection profile test (#12881)
melinath Feb 3, 2025
110b49b
CodeRepositoryIndex promote force_destroy to GA (#12949)
JumiDeluxe Feb 3, 2025
4036e33
Add yaml source to metadata file (#12917)
ScottSuarez Feb 3, 2025
b79356d
Auto-upgrade for colab runtimes (#12931)
bcreddy-gcp Feb 3, 2025
59b47aa
add missing sweeper regions (#12951)
ScottSuarez Feb 3, 2025
3bff238
Adding Mode & Allocatable Prefix Length to PDP for IPv6 Prefixes (#12…
dhruv-23101998 Feb 3, 2025
dea0957
implement hacky workaround so downstreams runs in the merge queue. (#…
ScottSuarez Feb 3, 2025
3fc0269
Fix GKE CPA tests so that cluster creation waits for CA creation. (#1…
tonyzhc Feb 3, 2025
47cf952
Feat add cas custom cdp aia support (#12452)
sophyawu09 Feb 4, 2025
deae311
Add field-level metadata for handwritten resources (#12948)
roaks3 Feb 4, 2025
f79b8e1
Add metadata for container_registry (#12923)
roaks3 Feb 4, 2025
a7e8140
Add Terraform Support for GKE Auto-Monitoring (#12688)
uol-jlin Feb 4, 2025
4dc815e
fix: update apigee_api doc (#12956)
toyopilgrim Feb 4, 2025
87af64a
Colab schedules (#12826)
bcreddy-gcp Feb 4, 2025
97b663d
Fix missing bootstrap IAM for GKE SA to create CPA clusters. (#12962)
tonyzhc Feb 4, 2025
7d21e3a
Migrate google_compute_firewall_policy resource from DCL to MMv1 (#11…
Samir-Cit Feb 4, 2025
89ec7eb
Add support for baseImageUri and buildInfo in Cloud Run V2 Service.te…
akerekes Feb 4, 2025
84cd94c
Added managedkafka api (#12959)
shuyama1 Feb 4, 2025
af25719
Removed google_project_service resources that modified the default pr…
melinath Feb 4, 2025
737a059
Add support for parameter manager regional parameter version render d…
abheda-crest Feb 5, 2025
83f4ba3
Update StandardApVersion.yaml to reflect new default for automaticSca…
sushi15 Feb 5, 2025
70b92ac
Fix google_dns_managed_zone update (#12934)
shuyama1 Feb 5, 2025
5741332
Make scope optional for google_compute_(region_)resize_request so th…
askubis Feb 5, 2025
ca5a16c
Add support for Third Party Identity (#12604)
bcreddy-gcp Feb 5, 2025
15606f5
Revert "Fix google_dns_managed_zone update" (#12976)
shuyama1 Feb 5, 2025
c147b6b
fix: (storage) update doc to link google_storage_bucket_object_conte…
gurusai-voleti Feb 5, 2025
6745807
Fix google_dns_managed_zone update (#12978)
shuyama1 Feb 5, 2025
131d591
Updated AlertPolicy resource to include sql condition types. (#12971)
haustenirving Feb 6, 2025
05d2bc2
Fix google_storage_bucket HNS example (#12983)
caugner Feb 6, 2025
75e910a
Fix error details type on google_database_migration_service_migration…
kjvellajr Feb 6, 2025
b0a90c2
make authz extension wire_format O+C (#12975)
c2thorn Feb 6, 2025
8abd103
Upgrade google.golang.org/api to v0.220.0 (#12977)
VeraQin Feb 6, 2025
6459371
Fix various product headings in the Registry (#12972)
rileykarson Feb 6, 2025
8bb1c80
Add new resource netapp volumes quotaRules (#12665)
Mehul3217 Feb 6, 2025
7025ae2
Removed tags from update tests (#12984)
melinath Feb 6, 2025
68fa2a0
Add Gemini Data Sharing With Google Setting resource (#12905)
PerlMonker303 Feb 6, 2025
ec7b2f8
Adds storage_operation to handle LRO related operations (#12966)
googlyrahman Feb 6, 2025
5519073
Fix TestAccSpannerInstance_spannerInstanceWithAutoscalingExample (#12…
hao-nan-li Feb 7, 2025
aa0365e
Add Gemini Gemini Gcp Enablement Setting resource (#12896)
PerlMonker303 Feb 7, 2025
1526680
Backfill autogen status tag (#12987)
slevenick Feb 7, 2025
69266bb
Change bootstrapped CodeRepositoryIndex debug label (#12964)
JumiDeluxe Feb 7, 2025
cd9398b
Split resource schema diff returned to magician by added/modified/rem…
melinath Feb 7, 2025
0915b2d
log github event metadata to debug canceled workflow (#12998)
ScottSuarez Feb 7, 2025
ee2fbd5
Add title field in directional policy rules. (#12932)
anoopkverma-google Feb 7, 2025
f16f4a3
dlp update test fix - avoid tag collisions (#12988)
c2thorn Feb 7, 2025
32318d4
Fix TestAccContainerCluster_autoprovisioningDefaultsManagement (#13000)
hao-nan-li Feb 7, 2025
ba5ff4e
Marked network scope tests as beta-only and removed network scope fro…
melinath Feb 7, 2025
ed6ea80
Fixed TestAccComposerEnvironment_fixPyPiPackages (#12989)
melinath Feb 7, 2025
410091d
Fix metadata for recent resource changes 20250207 (#12997)
roaks3 Feb 7, 2025
96f6489
Marked colab notebook execution tests that rely on dataform as min_ve…
melinath Feb 7, 2025
54e5a26
remove immutable tag
joelkattapuram Feb 7, 2025
098e842
ignore ImportStateVerify update_time in SecureSourceManagerInstance (…
c2thorn Feb 7, 2025
6b50d7a
Marked gemini/LoggingSetting as beta-only (#13007)
melinath Feb 7, 2025
0641544
make TestAccFilestoreInstance_replication sweepable (#13005)
c2thorn Feb 7, 2025
0a15a64
Implemented exponential backoff for IAM bootstrapping (#13001)
melinath Feb 7, 2025
0c023e3
Added additional logging on repo setup errors (#12961)
melinath Feb 7, 2025
37390d3
Made filestore backup tests use sweepable resources (#13009)
melinath Feb 7, 2025
df81d90
Update resource SCC Mute Config with expiry time field (#12979)
vijaykanthm Feb 7, 2025
52d74e5
fix spacing
joelkattapuram Feb 8, 2025
68ab860
Add support for new flags in Container node_kubelet_config. (#12985)
VeraQin Feb 8, 2025
5eb5698
Fix IAM Policy Datasource header (#12973)
rileykarson Feb 10, 2025
80eaa7b
Migrate google_eventarc_trigger resource from DCL to MMv1 (#12832)
tommyreddad Feb 10, 2025
5646713
fix missing alias for name secret_ref (hashicorp#21272) (#12982)
aprochko Feb 10, 2025
a494af4
Feature gap: add `gracefulShutdown` field for beta (#12963)
Cezarus27 Feb 10, 2025
366c857
Fixed error message when naming disks (#12981)
Dawid212 Feb 10, 2025
08ecbc9
Add location field to google_network_services_mesh (#12991)
AshZhang Feb 10, 2025
4e3c975
add fix for bbdc private tests (#13028)
ihnarayanan Feb 10, 2025
2fa88b2
Fix instances where no items found in region by continuing to next re…
ScottSuarez Feb 10, 2025
15b9d38
Update cluster versions in TestAccContainerNodePool_concurrent (#12955)
bbasata Feb 11, 2025
509063e
Add Gemini Release Channel Setting Binding resource (#12895)
PerlMonker303 Feb 11, 2025
9b3c47f
Update enrolled_teams.yml (#13008)
melinath Feb 11, 2025
c8d4352
Change description of Gemini Data Sharing With Google Setting Resourc…
PerlMonker303 Feb 11, 2025
09e909c
Change description of Gemini Gcp Enablement Setting Resource (#13017)
PerlMonker303 Feb 11, 2025
9e67074
added bbasata as a trusted contributor (#13041)
melinath Feb 11, 2025
6558032
fix formatting
joelkattapuram Feb 11, 2025
6a1306f
add test to allow updating pd size and pd disk type
joelkattapuram Jan 29, 2025
ad35930
add test to allow updating pd size and pd disk type
joelkattapuram Jan 29, 2025
5902728
fix
joelkattapuram Jan 29, 2025
eb76f37
ignore labels field
joelkattapuram Feb 1, 2025
a8664cc
remove immutable tag
joelkattapuram Feb 7, 2025
afd7216
fix spacing
joelkattapuram Feb 8, 2025
61fc5e0
fix formatting
joelkattapuram Feb 11, 2025
b35f3d9
Merge branch 'updatePdTest' of github.com:joelkattapuram/magic-module…
joelkattapuram Feb 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .ci/infra/terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ module "project-services" {
"logging.googleapis.com",
"looker.googleapis.com",
"managedidentities.googleapis.com",
"managedkafka.googleapis.com",
"memcache.googleapis.com",
"memorystore.googleapis.com",
"metastore.googleapis.com",
Expand Down
28 changes: 19 additions & 9 deletions .ci/magician/cmd/generate_comment.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ type diffCommentData struct {
Errors []Errors
}

type simpleSchemaDiff struct {
AddedResources, ModifiedResources, RemovedResources []string
}

const allowBreakingChangesLabel = "override-breaking-change"

var gcEnvironmentVariables = [...]string{
Expand Down Expand Up @@ -204,24 +208,26 @@ func execGenerateComment(prNumber int, ghTokenMagicModules, buildId, buildStep,
repo.Branch = newBranch
repo.Cloned = true
if err := ctlr.Clone(repo); err != nil {
fmt.Println("Failed to clone repo at new branch: ", err)
fmt.Printf("Failed to clone repo %q at branch %q: %s\n", repo.Name, newBranch, err)
errors[repo.Title] = append(errors[repo.Title], "Failed to clone repo at new branch")
repo.Cloned = false
}
if err := ctlr.Fetch(repo, oldBranch); err != nil {
fmt.Println("Failed to fetch old branch: ", err)
fmt.Printf("Failed to fetch branch %q for repo %q: %s\n", oldBranch, repo.Name, err)
errors[repo.Title] = append(errors[repo.Title], "Failed to clone repo at old branch")
repo.Cloned = false
continue
}
if repo.Name == "terraform-provider-google-beta" || repo.Name == "terraform-provider-google" {
if err := ctlr.Checkout(repo, oldBranch); err != nil {
fmt.Printf("Failed to checkout branch %q for repo %q: %s\n", oldBranch, repo.Name, err)
errors[repo.Title] = append(errors[repo.Title], fmt.Sprintf("Failed to checkout branch %s", oldBranch))
repo.Cloned = false
continue
}
rnr.PushDir(repo.Path)
if _, err := rnr.Run("make", []string{"build"}, nil); err != nil {
fmt.Printf("Failed to build branch %q for repo %q: %s\n", oldBranch, repo.Name, err)
errors[repo.Title] = append(errors[repo.Title], fmt.Sprintf("Failed to build branch %s", oldBranch))
repo.Cloned = false
}
Expand Down Expand Up @@ -303,7 +309,7 @@ func execGenerateComment(prNumber int, ghTokenMagicModules, buildId, buildStep,
data.MissingTests = missingTests
}

affectedResources, err := changedSchemaResources(diffProcessorPath, rnr)
affectedResources, err := computeAffectedResources(diffProcessorPath, rnr, repo)
if err != nil {
fmt.Println("computing changed resource schemas: ", err)
errors[repo.Title] = append(errors[repo.Title], "The diff processor crashed while computing changed resource schemas.")
Expand Down Expand Up @@ -460,27 +466,31 @@ func computeBreakingChanges(diffProcessorPath string, rnr ExecRunner) ([]Breakin
return changes, rnr.PopDir()
}

func changedSchemaResources(diffProcessorPath string, rnr ExecRunner) ([]string, error) {
func computeAffectedResources(diffProcessorPath string, rnr ExecRunner, repo source.Repo) ([]string, error) {
if err := rnr.PushDir(diffProcessorPath); err != nil {
return nil, err
}

output, err := rnr.Run("bin/diff-processor", []string{"changed-schema-resources"}, nil)
output, err := rnr.Run("bin/diff-processor", []string{"schema-diff"}, nil)
if err != nil {
return nil, err
}

fmt.Println("Resources with changed schemas: " + output)
fmt.Printf("Schema diff for %q: %s\n", repo.Name, output)

var labels []string
if err = json.Unmarshal([]byte(output), &labels); err != nil {
var simpleDiff simpleSchemaDiff
if err = json.Unmarshal([]byte(output), &simpleDiff); err != nil {
return nil, err
}

if err = rnr.PopDir(); err != nil {
return nil, err
}
return labels, nil
var resources []string
resources = append(resources, simpleDiff.AddedResources...)
resources = append(resources, simpleDiff.ModifiedResources...)
resources = append(resources, simpleDiff.RemovedResources...)
return resources, nil
}

// Run the missing test detector and return the results.
Expand Down
4 changes: 2 additions & 2 deletions .ci/magician/cmd/generate_comment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ func TestExecGenerateComment(t *testing.T) {
{"/mock/dir/tfoics", "git", []string{"diff", "origin/auto-pr-123456-old", "origin/auto-pr-123456", "--shortstat"}, map[string]string(nil)},
{"/mock/dir/magic-modules/tools/diff-processor", "make", []string{"build"}, diffProcessorEnv},
{"/mock/dir/magic-modules/tools/diff-processor", "bin/diff-processor", []string{"breaking-changes"}, map[string]string(nil)},
{"/mock/dir/magic-modules/tools/diff-processor", "bin/diff-processor", []string{"changed-schema-resources"}, map[string]string(nil)},
{"/mock/dir/magic-modules/tools/diff-processor", "bin/diff-processor", []string{"schema-diff"}, map[string]string(nil)},
{"/mock/dir/magic-modules/tools/diff-processor", "make", []string{"build"}, diffProcessorEnv},
{"/mock/dir/magic-modules/tools/diff-processor", "bin/diff-processor", []string{"breaking-changes"}, map[string]string(nil)},
{"/mock/dir/magic-modules/tools/diff-processor", "bin/diff-processor", []string{"detect-missing-tests", "/mock/dir/tpgb/google-beta/services"}, map[string]string(nil)},
{"/mock/dir/magic-modules/tools/diff-processor", "bin/diff-processor", []string{"changed-schema-resources"}, map[string]string(nil)},
{"/mock/dir/magic-modules/tools/diff-processor", "bin/diff-processor", []string{"schema-diff"}, map[string]string(nil)},
},
} {
if actualCalls, ok := mr.Calls(method); !ok {
Expand Down
2 changes: 1 addition & 1 deletion .ci/magician/cmd/mock_runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func NewMockRunner() MockRunner {
"/mock/dir/magic-modules/.ci/magician git [clone -b auto-pr-123456 https://modular-magician:*******@github.com/modular-magician/terraform-provider-google-beta /mock/dir/tpgb] map[]": "",
"/mock/dir/magic-modules/tools/diff-processor bin/diff-processor [breaking-changes] map[]": "",
"/mock/dir/magic-modules/tools/diff-processor make [build] " + sortedEnvString(diffProcessorEnv): "",
"/mock/dir/magic-modules/tools/diff-processor bin/diff-processor [changed-schema-resources] map[]": "[\"google_alloydb_instance\"]",
"/mock/dir/magic-modules/tools/diff-processor bin/diff-processor [schema-diff] map[]": "{\"AddedResources\": [\"google_alloydb_instance\"]}",
"/mock/dir/magic-modules/tools/diff-processor bin/diff-processor [detect-missing-tests /mock/dir/tpgb/google-beta/services] map[]": `{"google_folder_access_approval_settings":{"SuggestedTest":"resource \"google_folder_access_approval_settings\" \"primary\" {\n uncovered_field = # value needed\n}","Tests":["a","b","c"]}}`,
"/mock/dir/tgc git [diff origin/auto-pr-123456-old origin/auto-pr-123456 --shortstat] map[]": " 1 file changed, 10 insertions(+)\n",
"/mock/dir/tgc git [fetch origin auto-pr-123456-old] map[]": "",
Expand Down
4 changes: 3 additions & 1 deletion .ci/magician/github/membership_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,7 @@ var (
}

// This is for new team members who are onboarding
trustedContributors = map[string]struct{}{}
trustedContributors = map[string]struct{}{
"bbasata": struct{}{},
}
)
8 changes: 2 additions & 6 deletions .github/workflows/build-downstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,11 @@ on:
required: true
type: string

concurrency:
group: ${{ inputs.repo }}-${{ github.event_name == 'pull_request' && format('pr-{0}-', github.event.pull_request.number) || format('commit-{0}', github.sha) }}
cancel-in-progress: true

jobs:
generate-repository:
runs-on: ubuntu-22.04
env:
BASE_BRANCH: ${{ github.event.pull_request.base.ref || github.ref_name }}
BASE_BRANCH: ${{ github.event_name == 'merge_group' && github.event.merge_group.base_ref || github.event.pull_request.base.ref || github.ref_name }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout Repository
Expand All @@ -32,7 +28,7 @@ jobs:

# Cache Go modules
- name: Cache Go modules
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/downstreams.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ on:
branches:
- main
- 'FEATURE-BRANCH-*'
merge_group:
types: [checks_requested]
pull_request:

concurrency:
group: ${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || format('commit-{0}', github.sha) }}
group: ${{ github.event_name == 'merge_group' && format('merge-group-{0}', github.event.merge_group.head_sha) || github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || format('commit-{0}', github.sha) }}
cancel-in-progress: true

jobs:
Expand Down
4 changes: 2 additions & 2 deletions docs/content/code-review/create-pr.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ VCR test failures that do not immediately seem related to your PR are most likel
git checkout modular-magician/auto-pr-PR_NUMBER
make test
make lint
make testacc TEST=./google/services/container TESTARGS='-run=TestAccContainerNodePool'
make testacc TEST=./google/services/container TESTARGS='-run=TestAccContainerNodePool_basic$$'
```
Replace PR_NUMBER with your PR's ID.
{{< /tab >}}
Expand All @@ -65,7 +65,7 @@ VCR test failures that do not immediately seem related to your PR are most likel
git checkout modular-magician/auto-pr-PR_NUMBER
make test
make lint
make testacc TEST=./google/services/container TESTARGS='-run=TestAccContainerNodePool'
make testacc TEST=./google/services/container TESTARGS='-run=TestAccContainerNodePool_basic$$'
```
Replace PR_NUMBER with your PR's ID.
{{< /tab >}}
Expand Down
4 changes: 2 additions & 2 deletions docs/content/code-review/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ For each release note block, choose an appropriate type from the following list:
Do | Don't
-- | -----
Use past tense to describe the end state after the change is released. Start with a verb. For example, "added...", "fixed...", or "resolved...". You can use future tense to describe future changes, such as saying that a deprecated field will be removed in a future version. | Don't use present or future tense to describe changes that are included in the pull request.
Write user-focused release notes. For example, reference specific impacted terraform resource and field names, and discuss changes in behavior users will experience. | Avoid API field/resource/feature names. Avoid implementation details. Avoid language that requires understanding of provider internals.
Write user-focused release notes. For example, reference specific impacted terraform resource and field names, and discuss changes in behavior users will experience. | Avoid API field/resource/feature names. Avoid implementation details. Avoid language that requires understanding of provider internals. However, in case of substantial refactorings like API version changes or engine changes (tpgtools/DCL -> MMv1, handwritten <> MMv1) **do** cover the change so users can quickly identify the release if they are affected by the change.
Surround resource or field names with backticks. | Don't use resource or field names without punctuation or with other punctuation like quotation marks.
Use impersonal third person. | Don't use "I", "you", etc.
If the pull request impacts any specific, begin your release note with that product name followed by a colon. Use lower case for the first letter after the colon. For example, `cloudrun: added...` For MMv1 resources, use the folder name that contains the yaml files as the product name; for handwritten or tpgtools resources, use the API subdomain; for broad cross-product changes, use `provider`. | Don't begin your release note with the full resource name. Don't add backticks around the product name. Don't capitalize the first letter after the colon.
If the pull request impacts a specific product, begin your release note with that product name followed by a colon. Use lower case for the first letter after the colon. For example, `cloudrun: added...` For MMv1 resources, use the folder name that contains the yaml files as the product name; for handwritten or tpgtools resources, use the API subdomain; for broad cross-product changes, use `provider`. | Don't begin your release note with the full resource name. Don't add backticks around the product name. Don't capitalize the first letter after the colon.

### Examples

Expand Down
47 changes: 43 additions & 4 deletions docs/content/test/run-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,22 @@ aliases:

1. Run acceptance tests for only modified resources. (Full test runs can take over 9 hours.) See [Go's documentation](https://pkg.go.dev/cmd/go#hdr-Testing_flags) for more information about `-run` and other flags.

```bash
make testacc TEST=./google/services/container TESTARGS='-run=TestAccContainerNodePool_basic$$'
```

To run all tests matching, e.g., `TestAccContainerNodePool*`, omit the trailing `$$`:

```bash
make testacc TEST=./google/services/container TESTARGS='-run=TestAccContainerNodePool'
```

> **Note:** Acceptance tests create actual infrastructure which can incur costs. Acceptance tests may not clean up after themselves if interrupted, so you may want to check for stray resources and / or billing charges.
> **Note:** Acceptance tests create actual infrastructure which can incur costs. Acceptance tests may not clean up after themselves if interrupted, so you may want to check for stray resources and / or billing charges.

1. Optional: Save verbose test output (including API requests and responses) to a file for analysis.

```bash
TF_LOG=DEBUG make testacc TEST=./google/services/container TESTARGS='-run=TestAccContainerNodePool_basic' > output.log
TF_LOG=DEBUG make testacc TEST=./google/services/container TESTARGS='-run=TestAccContainerNodePool_basic$$' > output.log
```

1. Optional: Debug tests with [Delve](https://github.com/go-delve/delve). See [`dlv test` documentation](https://github.com/go-delve/delve/blob/master/Documentation/usage/dlv_test.md) for information about available flags.
Expand All @@ -95,12 +101,19 @@ aliases:
```bash
make testacc TEST=./google-beta/services/container TESTARGS='-run=TestAccContainerNodePool'
```
> **Note:** Acceptance tests create actual infrastructure which can incur costs. Acceptance tests may not clean up after themselves if interrupted, so you may want to check for stray resources and / or billing charges.

To run all tests matching, e.g., `TestAccContainerNodePool*`, omit the trailing `$$`:

```bash
make testacc TEST=./google-beta/services/container TESTARGS='-run=TestAccContainerNodePool'
```

> **Note:** Acceptance tests create actual infrastructure which can incur costs. Acceptance tests may not clean up after themselves if interrupted, so you may want to check for stray resources and / or billing charges.

1. Optional: Save verbose test output to a file for analysis.

```bash
TF_LOG=DEBUG make testacc TEST=./google-beta/services/container TESTARGS='-run=TestAccContainerNodePool_basic' > output.log
TF_LOG=DEBUG make testacc TEST=./google-beta/services/container TESTARGS='-run=TestAccContainerNodePool_basic$$' > output.log
```

1. Optional: Debug tests with [Delve](https://github.com/go-delve/delve). See [`dlv test` documentation](https://github.com/go-delve/delve/blob/master/Documentation/usage/dlv_test.md) for information about available flags.
Expand Down Expand Up @@ -290,6 +303,32 @@ Configure Terraform to use locally-built binaries for `google` and `google-beta`
TF_LOG=DEBUG TF_LOG_PATH=output.log TF_CLI_CONFIG_FILE="$HOME/tf-dev-override.tfrc" terraform apply
```

### Run Tests with VCR Locally

VCR tests record HTTP request/response interactions in cassettes and replay them in future runs without calling the real API.

Running tests in `REPLAYING` mode locally can sometimes be useful. In particular, it can allow you to test more quickly, cheaply, and without spinning up real infrastructure, once you've got an initial recording.

It can also be helpful for debugging tests that seem to work locally, but fail in CI in replaying mode.

VCR is controlled via two variables:
- `VCR_MODE`: `REPLAYING` or `RECORDING` mode
- `VCR_PATH`: Path where recorded cassettes are stored.

Ensure both variables are configured to properly trigger VCR tests locally.

If you don't already have an existing cassette that's up to date, first do a run in `RECORDING` mode:

```bash
VCR_PATH=$HOME/.vcr/ VCR_MODE=RECORDING make testacc TEST=./google/services/alloydb TESTARGS='-run=TestAccContainerNodePool_basic$$'
```

Now run the same test again in `REPLAYING` mode:

```bash
VCR_PATH=$HOME/.vcr/ VCR_MODE=REPLAYING make testacc TEST=./google/services/alloydb TESTARGS='-run=TestAccContainerNodePool_basic$$'
```

### Cleanup

To stop using developer overrides, stop setting `TF_CLI_CONFIG_FILE` in the commands you are executing.
Expand Down
45 changes: 44 additions & 1 deletion mmv1/api/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,8 @@ type Resource struct {
// fine-grained resources and legacy resources.
ApiResourceTypeKind string `yaml:"api_resource_type_kind,omitempty"`

ImportPath string `yaml:"-"`
ImportPath string `yaml:"-"`
SourceYamlFile string `yaml:"-"`
}

func (r *Resource) UnmarshalYAML(unmarshal func(any) error) error {
Expand Down Expand Up @@ -1787,3 +1788,45 @@ func (r Resource) CaiIamAssetNameTemplate(productBackendName string) string {
}
return fmt.Sprintf("//%s.googleapis.com/%s/{{%s}}", productBackendName, caiBaseUrl, r.IamParentResourceName())
}

func urlContainsOnlyAllowedKeys(templateURL string, allowedKeys []string) bool {
// Create regex to match anything between {{ and }}
re := regexp.MustCompile(`{{\s*([^}]+)\s*}}`)

// Find all matches in the template URL
matches := re.FindAllStringSubmatch(templateURL, -1)

// Create a map of allowed keys for O(1) lookup
allowedKeysMap := make(map[string]bool)
for _, key := range allowedKeys {
allowedKeysMap[key] = true
}

// Check each found key against the allowed keys
for _, match := range matches {
if len(match) < 2 {
continue
}

// Trim spaces from the key
key := strings.TrimSpace(match[1])

// If the key isn't in our allowed list, return false
if !allowedKeysMap[key] {
return false
}
}

return true
}

func (r Resource) ShouldGenerateSweepers() bool {
allowedKeys := []string{"project", "region", "location", "zone", "billing_account"}
if !urlContainsOnlyAllowedKeys(r.ListUrlTemplate(), allowedKeys) {
return false
}
if r.ExcludeSweeper || r.CustomCode.CustomDelete != "" || r.CustomCode.PreDelete != "" || r.CustomCode.PostDelete != "" || r.ExcludeDelete {
return false
}
return true
}
6 changes: 3 additions & 3 deletions mmv1/api/resource/sweeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ package resource
type Sweeper struct {
// The field checked by sweeper to determine
// eligibility for deletion for generated resources
SweepableIdentifierField string `yaml:"sweepable_identifier_field"`
Regions []string `yaml:"regions,omitempty"`
Prefixes []string `yaml:"prefixes,omitempty"`
IdentifierField string `yaml:"identifier_field"`
Regions []string `yaml:"regions,omitempty"`
Prefixes []string `yaml:"prefixes,omitempty"`
}
1 change: 1 addition & 0 deletions mmv1/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ func GenerateProduct(productChannel chan string, providerToGenerate provider.Pro

resource := &api.Resource{}
api.Compile(resourceYamlPath, resource, overrideDirectory)
resource.SourceYamlFile = resourceYamlPath

resource.TargetVersionName = *version
resource.Properties = resource.AddLabelsRelatedFields(resource.PropertiesWithExcluded(), nil)
Expand Down
Loading