Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autogenerate IAM resources for IAP Tunnel Instance #2988

Merged
merged 3 commits into from
Jan 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion build/terraform
2 changes: 1 addition & 1 deletion build/terraform-beta
14 changes: 14 additions & 0 deletions products/iap/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,17 @@ objects:
name: 'name'
description: Name or self link of a backend service.
required: true
# This resource is only used to generate IAM resources. They do not correspond to real
# GCP resources, and should not be used to generate anything other than IAM suppport.
- !ruby/object:Api::Resource
name: 'TunnelInstance'
base_url: 'projects/{{project}}/iap_tunnel/zones/{{zone}}/instances/{{name}}'
self_link: 'projects/{{project}}/iap_tunnel/zones/{{zone}}/instances/{{name}}'
exclude_resource: true
description: |
Only used to generate IAM resources
properties:
- !ruby/object:Api::Type::String
name: 'name'
description: Name of the instance.
required: true
21 changes: 21 additions & 0 deletions products/iap/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,27 @@ overrides: !ruby/object:Overrides::ResourceOverrides
backend_service_name: "backend-service"
http_health_check_name: "health-check"
primary_resource_name: "fmt.Sprintf(\"backend-service%s\", context[\"random_suffix\"])"
TunnelInstance: !ruby/object:Overrides::Terraform::ResourceOverride
iam_policy: !ruby/object:Api::Resource::IamPolicy
exclude: false
method_name_separator: ':'
parent_resource_type: 'google_compute_instance'
parent_resource_attribute: 'instance'
fetch_iam_policy_verb: :POST
allowed_iam_role: 'roles/iap.tunnelResourceAccessor'
iam_conditions_request_type: :REQUEST_BODY
id_format: "projects/{{project}}/iap_tunnel/zones/{{zone}}/instances/{{name}}"
import_format: [
"projects/{{project}}/iap_tunnel/zones/{{zone}}/instances/{{name}}",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently the handwritten has "projects/{{project}}/iap_tunnel/zones/{{zone}}/instances/{{instance}}" for id and "projects/{{project}}/zones/{{zone}}/instances/{{instance}}" for import format, so we're keeping ID format and supporting both import formats

"projects/{{project}}/zones/{{zone}}/instances/{{name}}"
]
examples:
- !ruby/object:Provider::Terraform::Examples
name: "instance_basic"
primary_resource_id: "tunnelvm"
vars:
instance_name: "tf-test-tunnel"
primary_resource_name: "fmt.Sprintf(\"tf-test-tunnel%s\", context[\"random_suffix\"])"
# This is for copying files over
files: !ruby/object:Provider::Config::Files
# These files have templating (ERB) code that will be run.
Expand Down

This file was deleted.

Loading