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

Add support IAM policy for the Environment of Apigee X #5270

Merged
merged 18 commits into from
Nov 19, 2021
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
7 changes: 7 additions & 0 deletions mmv1/products/apigee/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,13 @@ objects:
message: 'message'
description: |
An `Environment` in Apigee.
iam_policy: !ruby/object:Api::Resource::IamPolicy
exclude: false
method_name_separator: ':'
parent_resource_attribute: 'env_id'
import_format: ["{{%org_id}}/environments/{{name}}", "{{name}}"]
base_url: "{{org_id}}/environments/{{name}}"
self_link: "{{org_id}}/environments/{{name}}"
parameters:
- !ruby/object:Api::Type::String
name: 'orgId'
Expand Down
1 change: 1 addition & 0 deletions mmv1/products/apigee/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ overrides: !ruby/object:Overrides::ResourceOverrides
# the resources needed for the acceptance test.
name: "apigee_environment_basic_test"
primary_resource_id: "apigee_environment"
primary_resource_name: "fmt.Sprintf(\"organizations/tf-test%s\", context[\"random_suffix\"]), fmt.Sprintf(\"tf-test%s\", context[\"random_suffix\"])"
test_env_vars:
org_id: :ORG_ID
billing_account: :BILLING_ACCT
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
obj["name"] = d.Get("project_id").(string)
return obj, nil
return obj, nil
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ resource "google_apigee_organization" "org" {
google_service_networking_connection.apigee_vpc_connection,
google_kms_crypto_key_iam_binding.apigee_sa_keyuser,
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,4 @@ resource "google_apigee_organization" "<%= ctx[:primary_resource_id] %>" {
google_service_networking_connection.apigee_vpc_connection,
google_kms_crypto_key_iam_binding.apigee_sa_keyuser,
]
}
}
9 changes: 7 additions & 2 deletions mmv1/templates/terraform/iam/iam_attributes.tf.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<% example = object.examples.reject(&:skip_test)
.reject { |e| @api.version_obj_or_closest(version) < @api.version_obj_or_closest(e.min_version) }
.first -%>
<% if !example -%>
<% example = object.examples
.reject { |e| @api.version_obj_or_closest(version) < @api.version_obj_or_closest(e.min_version) }
.first -%>
.first -%>
<% end -%>
<% self_link_url = object.iam_policy.self_link || object.self_link_url -%>
<% parent_resource_last_param_name = extract_identifiers(self_link_url).last -%>
<% parent_resource_type_type = object.iam_policy.parent_resource_type || resource_ns -%>
Expand All @@ -11,4 +16,4 @@
<% attribute_val = p.underscore -%>
<% end -%>
<%= attribute_val.underscore -%> = <%= parent_resource_type_type -%>.<%= example.primary_resource_id -%>.<%= p.underscore %>
<% end -%>
<% end -%>