Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
db1c688
Update ManagedZone.yaml to include iam_conditions_request_type: 'QUER…
shellyvilenko Feb 25, 2026
786d577
Create dns_managed_zone_iam_condition.tf.tmpl
shellyvilenko Feb 25, 2026
75e7f4f
Merge branch 'main' into managed-zones-conditions
shellyvilenko Feb 25, 2026
b772b6f
Update ManagedZone.yaml
shellyvilenko Feb 25, 2026
a85d40c
Update ManagedZone.yaml
shellyvilenko Feb 25, 2026
3eea375
Update dns_managed_zone_iam_condition.tf.tmpl
shellyvilenko Feb 25, 2026
96e4e5f
Update ManagedZone.yaml
shellyvilenko Feb 25, 2026
8570a2c
Update dns_managed_zone_iam_condition.tf.tmpl
shellyvilenko Feb 25, 2026
0434c21
Update ManagedZone.yaml
shellyvilenko Feb 25, 2026
b859ffd
Merge branch 'GoogleCloudPlatform:main' into managed-zones-conditions
shellyvilenko Mar 10, 2026
7071389
Merge branch 'GoogleCloudPlatform:main' into managed-zones-conditions
shellyvilenko Mar 10, 2026
c87b796
Update ManagedZone.yaml and add update_mask: true to allow version 3 …
shellyvilenko Mar 10, 2026
3b71b7c
Update ManagedZone.yaml remove update_mask - at the resource level it…
shellyvilenko Mar 10, 2026
bb5d1a0
Update the API Endpoint in ManagedZone.yaml
shellyvilenko Mar 10, 2026
84d1e1f
Update ManagedZone.yaml remove the base_url override
shellyvilenko Mar 11, 2026
2f881b5
Update iam_policy.go
shellyvilenko Mar 11, 2026
f34cbff
Update iam_policy.go.tmpl
shellyvilenko Mar 11, 2026
643e281
Update ManagedZone.yaml
shellyvilenko Mar 11, 2026
7062595
Update ManagedZone.yaml
shellyvilenko Mar 11, 2026
89f432b
Update dns_managed_zone_iam_condition.tf.tmpl
shellyvilenko Mar 11, 2026
b9f03af
Update dns_managed_zone_iam_condition.tf.tmpl
shellyvilenko Mar 11, 2026
7a9f7b4
Update iam_policy.go try to fix formatting
shellyvilenko Mar 12, 2026
d2a68dd
Merge branch 'GoogleCloudPlatform:main' into managed-zones-conditions
shellyvilenko Mar 17, 2026
6a22bdd
Merge branch 'GoogleCloudPlatform:main' into managed-zones-conditions
shellyvilenko Apr 18, 2026
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
4 changes: 4 additions & 0 deletions mmv1/api/resource/iam_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ type IamPolicy struct {
// How the API supports IAM conditions
IamConditionsRequestType string `yaml:"iam_conditions_request_type,omitempty"`

// [Optional] Whether to include an updateMask in the setIamPolicy request.
// Mandatory for older APIs like DNS to support IAM conditions.
UpdateMask bool `yaml:"update_mask,omitempty"`

// Allows us to override the base_url of the resource. This is required for Cloud Run as the
// IAM resources use an entirely different base URL from the actual resource
BaseUrl string `yaml:"base_url,omitempty"`
Expand Down
10 changes: 10 additions & 0 deletions mmv1/products/dns/ManagedZone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ iam_policy:
method_name_separator: ':'
fetch_iam_policy_verb: 'POST'
parent_resource_attribute: 'managed_zone'
iam_conditions_request_type: 'QUERY_PARAM_NESTED'
allowed_iam_role: 'roles/dns.admin'
update_mask: true
import_format:
- 'projects/{{project}}/managedZones/{{managed_zone}}'
- '{{project}}/{{managed_zone}}'
Expand Down Expand Up @@ -126,6 +129,13 @@ examples:
dns_name: 'services.example.com.'
test_vars_overrides:
'dns_name': '"services.example.com-" + acctest.RandString(t, 10) + "."'
- name: 'dns_managed_zone_iam_condition'
primary_resource_id: 'default'
vars:
dns_name: 'example.com.'
managed_zone_name: 'example-zone'
test_vars_overrides:
'dns_name': '"conditions.example.com-" + acctest.RandString(t, 10) + "."'
virtual_fields:
- name: 'force_destroy'
description: 'Set this true to delete all records in the zone.'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
resource "google_dns_managed_zone" "default" {
name = "{{index $.Vars "managed_zone_name"}}"
dns_name = "{{index $.Vars "dns_name"}}"
description = "Example zone for IAM conditions"
}

resource "google_dns_managed_zone_iam_member" "condition_test" {
project = google_dns_managed_zone.default.project
managed_zone = google_dns_managed_zone.default.name
role = "roles/dns.admin"
member = "user:admin@hashicorptest.com"

condition {
title = "Exact Record Match"
description = "Allow modifying only api.example.com. A records"
# Mandatory pass-through clause for parent Managed Zone checks
expression = "(resource.type == 'dns.googleapis.com/ResourceRecordSet' && resource.name.endsWith('/rrsets/api.{{index $.Vars "dns_name"}}/A')) || (resource.type != 'dns.googleapis.com/ResourceRecordSet')"
}
}
6 changes: 5 additions & 1 deletion mmv1/templates/terraform/iam_policy.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,10 @@ func (u *{{ $.ResourceName }}IamUpdater) SetResourceIamPolicy(policy *cloudresou
{{ if and $.IamPolicy $.IamPolicy.WrappedPolicyObj -}}
obj := make(map[string]interface{})
obj["policy"] = json
{{- if $.IamPolicy.UpdateMask }}
// Core APIs require the mask to acknowledge policy version 3 (conditions)
obj["updateMask"] = "bindings,etag,version"
{{- end }}
{{- else }}
obj := json
{{- end }}
Expand Down Expand Up @@ -351,4 +355,4 @@ func (u *{{ $.ResourceName }}IamUpdater) GetMutexKey() string {

func (u *{{ $.ResourceName }}IamUpdater) DescribeResource() string {
return fmt.Sprintf("{{ lower $.ProductMetadata.Name }} {{ lower $.Name }} %q", u.GetResourceId())
}
}
Loading