Skip to content

Commit

Permalink
Add support IAM policy for the Environment of Apigee X (GoogleCloudPl…
Browse files Browse the repository at this point in the history
…atform#5270)

* Add support IAM policy for the Environment of Apigee X

* Add support IAM policy for the Environment of Apigee X

* Add support IAM policy for the Environment of Apigee X

* Add support IAM policy for the Environment of Apigee X

* Revert all changes to test files.

* Revert all changes to test files.

* Revert all changes to test files.

* Add primary_resource_name to fix tests.

* Update iam_attributes.tf.erb to honor skip_test.

* Don't reject skip_tests when example is nil.

* Update mmv1/products/apigee/api.yaml

Co-authored-by: Stephen Lewis (Burrows) <[email protected]>

* Fix primary_resource_name for apigee organization name.

Co-authored-by: Stephen Lewis (Burrows) <[email protected]>
  • Loading branch information
2 people authored and betsy-lichtenberg committed Apr 25, 2022
1 parent 8cf663d commit e6b1cd4
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 5 deletions.
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 -%>

0 comments on commit e6b1cd4

Please sign in to comment.