-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
generate compute instance and subnetwork iam #2647
Merged
modular-magician
merged 4 commits into
GoogleCloudPlatform:master
from
danawillow:iam-gen
Nov 12, 2019
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
ae6cc70
generate compute instance and subnetwork iam
danawillow 482dce7
newline and better name
danawillow a4e2c82
label zone/region as optional in docs
danawillow 9b16f94
Update tracked submodules -> HEAD on Tue Nov 12 07:27:08 UTC 2019
modular-magician File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Submodule terraform
updated
from b61e5e to 1aaf57
Submodule terraform-beta
updated
from b2e9b4 to 858167
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
resource "google_compute_instance" "<%= ctx[:primary_resource_id] %>" { | ||
name = "<%= ctx[:vars]['instance_name'] %>" | ||
zone = "<%= ctx[:vars]['zone_name'] %>" | ||
machine_type = "n1-standard-1" | ||
|
||
boot_disk { | ||
initialize_params { | ||
image = "debian-cloud/debian-9" | ||
} | ||
} | ||
|
||
network_interface { | ||
network = "default" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -188,7 +188,11 @@ The following arguments are supported: | |
|
||
<% url_properties.each do |param| -%> | ||
<% if param.name == "name" -%> | ||
* `<%= object.name.underscore -%>` - (Required) Used to find the parent resource to bind the IAM policy to | ||
* `<%= object.iam_policy.parent_resource_attribute || object.name.underscore -%>` - (Required) Used to find the parent resource to bind the IAM policy to | ||
<% elsif ["region", "zone"].include?(param.name.underscore) -%> | ||
* `<%= param.name.underscore -%>` - (Optional) <%= param.description -%> Used to find the parent resource to bind the IAM policy to. If not specified, | ||
the value will be parsed from the identifier of the parent resource. If no <%= param.name.underscore -%> is provided in the parent identifier and no | ||
<%= param.name.underscore -%> is specified, it is taken from the provider configuration. | ||
<% else -%> | ||
* `<%= param.name.underscore -%>` - (Required) <%= param.description -%> Used to find the parent resource to bind the IAM policy to | ||
<% end -%> | ||
|
@@ -243,14 +247,29 @@ exported: | |
|
||
## Import | ||
|
||
<%= product_ns -%> <%= object.name.downcase -%> IAM resources can be imported using the project, resource identifiers, role and member. | ||
For all import syntaxes, the "resource in question" can take any of the following forms: | ||
|
||
<% import_id_formats(object).each do |id_format| -%> | ||
* <%= id_format %> | ||
<% end -%> | ||
|
||
Any variables not passed in the import command will be taken from the provider configuration. | ||
|
||
<%= product_ns -%> <%= object.name.downcase -%> IAM resources can be imported using the resource identifiers, role, and member. | ||
|
||
IAM member imports use space-delimited identifiers: the resource in question, the role, and the member identity, e.g. | ||
``` | ||
$ terraform import <% if object.min_version.name == 'beta' %>-provider=google-beta <% end -%><%= resource_ns_iam -%>_member.editor "<%= object.id_format.gsub('{{name}}', "{{#{object.name.underscore}}}") -%> <%= object.iam_policy.allowed_iam_role -%> [email protected]" | ||
``` | ||
$ terraform import <%= resource_ns_iam -%>_policy.editor <%= object.id_format.gsub('{{name}}', "{{#{object.name.underscore}}}") %> | ||
|
||
IAM binding imports use space-delimited identifiers: the resource in question and the role, e.g. | ||
``` | ||
$ terraform import <%= resource_ns_iam -%>_binding.editor "<%= object.id_format.gsub('{{name}}', "{{#{object.name.underscore}}}") -%> <%= object.iam_policy.allowed_iam_role -%>" | ||
``` | ||
|
||
$ terraform import <%= resource_ns_iam -%>_member.editor "<%= object.id_format.gsub('{{name}}', "{{#{object.name.underscore}}}") -%> <%= object.iam_policy.allowed_iam_role -%> [email protected]" | ||
IAM policy imports use the identifier of the resource in question, e.g. | ||
``` | ||
$ terraform import <% if object.min_version.name == 'beta' %>-provider=google-beta <% end -%><%= resource_ns_iam -%>_policy.editor <%= object.id_format.gsub('{{name}}', "{{#{object.name.underscore}}}") %> | ||
``` | ||
|
||
-> If you're importing a resource with beta features, make sure to include `-provider=google-beta` | ||
|
147 changes: 0 additions & 147 deletions
147
third_party/terraform/resources/iam_compute_instance.go
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we don't support partial import ID formats with resource-type qualifiers anymore, right? i.e. regions/reg/instances/X vs projects/proj/regions/reg/instances/X?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We support whatever the parent resource supports, so if we wanted to we could add more into the default formats (or the resource-specific lists), but we don't right now.