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

Apigee environment group attachment #4641

Merged
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
3881d8d
Added code for Apigee Environment
Priyasaxena21 Mar 2, 2021
16ca928
Update api.yaml
priya-saxena21 Mar 2, 2021
3a4dadb
Update api.yaml
priya-saxena21 Mar 2, 2021
9e812b2
Added code for Apigee Environment
Priyasaxena21 Mar 2, 2021
0fb83a5
Added code for Apigee environment groups
Priyasaxena21 Mar 8, 2021
f0807a4
Update api.yaml
priya-saxena21 Mar 8, 2021
2576422
Added code for Apigee Environment
Priyasaxena21 Mar 2, 2021
ded1602
Update api.yaml
priya-saxena21 Mar 2, 2021
dacf037
Update api.yaml
priya-saxena21 Mar 2, 2021
739f7d5
Added code for Apigee Environment
Priyasaxena21 Mar 2, 2021
f408104
Incorporating review comments for Apigee environment groups
Priyasaxena21 Mar 9, 2021
5b94a75
Incorporating review comments for Apigee environment groups
Priyasaxena21 Mar 9, 2021
514f00f
Update reverse_check_membership.sh
priya-saxena21 Mar 9, 2021
dfd3159
Update reverse_check_membership.sh
priya-saxena21 Mar 9, 2021
c499c9d
Update check_membership.sh
priya-saxena21 Mar 9, 2021
0ee64f6
Update mmv1/products/apigee/api.yaml
priya-saxena21 Mar 9, 2021
2167faa
Added code for Apigee Environment
Priyasaxena21 Mar 2, 2021
3432e74
Update api.yaml
priya-saxena21 Mar 2, 2021
e0af3d5
Update api.yaml
priya-saxena21 Mar 2, 2021
bbf67fe
Added code for Apigee Environment
Priyasaxena21 Mar 2, 2021
a2e09a7
Update api.yaml
priya-saxena21 Mar 8, 2021
39a0d83
Added code for Apigee Environment
Priyasaxena21 Mar 2, 2021
76bc59b
Update api.yaml
priya-saxena21 Mar 2, 2021
032df6d
Update api.yaml
priya-saxena21 Mar 2, 2021
78b3a33
Added code for Apigee Environment
Priyasaxena21 Mar 2, 2021
4157103
Update api.yaml
priya-saxena21 Mar 2, 2021
0a43f81
Update api.yaml
priya-saxena21 Mar 2, 2021
c8f89b1
Added code for Apigee Environment
Priyasaxena21 Mar 2, 2021
5fc1b0a
Update api.yaml
priya-saxena21 Mar 8, 2021
5270824
Added code for Apigee Environment
Priyasaxena21 Mar 2, 2021
3c46eb7
Update api.yaml
priya-saxena21 Mar 2, 2021
8ad09f7
Update api.yaml
priya-saxena21 Mar 2, 2021
fa2cf8f
Added code for Apigee Environment
Priyasaxena21 Mar 2, 2021
1884489
Update mmv1/products/apigee/api.yaml
priya-saxena21 Mar 9, 2021
d9672a1
fixing .ci errors
Priyasaxena21 Mar 9, 2021
607467d
added code for instance attachments
Priyasaxena21 Mar 16, 2021
ca4aaa5
Merge remote-tracking branch 'upstream/master'
Priyasaxena21 Mar 30, 2021
34f0fc3
Added new resource for environment groups attachment
Priyasaxena21 Mar 30, 2021
b3dc97b
Incorporating review comments
Priyasaxena21 Apr 6, 2021
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
50 changes: 50 additions & 0 deletions mmv1/products/apigee/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -363,3 +363,53 @@ objects:
'Creating an environment':
'https://cloud.google.com/apigee/docs/api-platform/get-started/create-environment'
api: 'https://cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.instances.attachments/create'
- !ruby/object:Api::Resource
name: 'EnvgroupAttachment'
base_url: '{{envgroup_id}}/attachments'
create_url: '{{envgroup_id}}/attachments'
delete_url: '{{envgroup_id}}/attachments/{{name}}'
self_link: '{{envgroup_id}}/attachments/{{name}}'
async: !ruby/object:Api::OpAsync
operation: !ruby/object:Api::OpAsync::Operation
path: 'name'
base_url: '{{op_id}}'
wait_ms: 1000
result: !ruby/object:Api::OpAsync::Result
path: 'response'
resource_inside_response: true
status: !ruby/object:Api::OpAsync::Status
path: 'done'
complete: True
allowed:
- True
- False
error: !ruby/object:Api::OpAsync::Error
path: 'error'
message: 'message'
input: true
description: |
An `Environment Group attachment` in Apigee.
parameters:
- !ruby/object:Api::Type::String
name: 'envgroupId'
description: |
The Apigee environment group associated with the Apigee environment,
in the format `organisations/{{org_name}}/envgroups/{{envgroup_name}}`.
priya-saxena21 marked this conversation as resolved.
Show resolved Hide resolved
required: true
url_param_only: true
properties:
- !ruby/object:Api::Type::String
name: 'environment'
description: |
The resource ID of the environment.
required: true
- !ruby/object:Api::Type::String
name: 'name'
description: |
The name of the newly created attachment (output parameter).
output: true
references: !ruby/object:Api::Resource::ReferenceLinks
guides:
'Creating an environment':
'https://cloud.google.com/apigee/docs/api-platform/get-started/create-environment'
api: 'https://cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.envgroups.attachments/create'
24 changes: 24 additions & 0 deletions mmv1/products/apigee/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,30 @@ overrides: !ruby/object:Overrides::ResourceOverrides
delete_minutes: 30
custom_code: !ruby/object:Provider::Terraform::CustomCode
custom_import: templates/terraform/custom_import/apigee_instance_attachment.go.erb
EnvgroupAttachment: !ruby/object:Overrides::Terraform::ResourceOverride
autogen_async: true
import_format: ["{{envgroup_id}}/attachments/{{name}}", "{{envgroup_id}}/{{name}}"]
delete_url: '{{envgroup_id}}/attachments/{{name}}'
priya-saxena21 marked this conversation as resolved.
Show resolved Hide resolved
examples:
- !ruby/object:Provider::Terraform::Examples
name: "apigee_environment_group_attachment_basic"
skip_test: true
- !ruby/object:Provider::Terraform::Examples
# This is a more verbose version of the above that creates all
# the resources needed for the acceptance test.
name: "apigee_environment_group_attachment_basic_test"
primary_resource_id: "apigee_environment_group_attachment"
test_env_vars:
org_id: :ORG_ID
billing_account: :BILLING_ACCT
skip_docs: true
# Resource creation race
skip_vcr: true
timeouts: !ruby/object:Api::Timeouts
insert_minutes: 30
delete_minutes: 30
custom_code: !ruby/object:Provider::Terraform::CustomCode
custom_import: templates/terraform/custom_import/apigee_environment_group_attachment.go.erb
files: !ruby/object:Provider::Config::Files
# These files have templating (ERB) code that will be run.
# This is usually to add licensing info, autogeneration notices, etc.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
config := meta.(*Config)

// current import_formats cannot import fields with forward slashes in their value
if err := parseImportId([]string{
"(?P<envgroup_id>.+)/attachments/(?P<name>.+)",
"(?P<envgroup_id>.+)/(?P<name>.+)",
}, d, config); err != nil {
return nil, err
}

// Replace import id for the resource id
id, err := replaceVars(d, config, "{{envgroup_id}}/attachments/{{name}}")
if err != nil {
return nil, fmt.Errorf("Error constructing id: %s", err)
}
d.SetId(id)

return []*schema.ResourceData{d}, nil
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
resource "google_project" "project" {
project_id = "tf-test%{random_suffix}"
name = "tf-test%{random_suffix}"
org_id = "<%= ctx[:test_env_vars]['org_id'] %>"
billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>"
}

resource "google_project_service" "apigee" {
project = google_project.project.project_id
service = "apigee.googleapis.com"
}

resource "google_project_service" "compute" {
project = google_project.project.project_id
service = "compute.googleapis.com"
}

resource "google_project_service" "servicenetworking" {
project = google_project.project.project_id
service = "servicenetworking.googleapis.com"
}

resource "google_compute_network" "apigee_network" {
name = "apigee-network"
project = google_project.project.project_id
depends_on = [google_project_service.compute]
}

resource "google_compute_global_address" "apigee_range" {
name = "apigee-range"
purpose = "VPC_PEERING"
address_type = "INTERNAL"
prefix_length = 16
network = google_compute_network.apigee_network.id
project = google_project.project.project_id
}

resource "google_service_networking_connection" "apigee_vpc_connection" {
network = google_compute_network.apigee_network.id
service = "servicenetworking.googleapis.com"
reserved_peering_ranges = [google_compute_global_address.apigee_range.name]
depends_on = [google_project_service.servicenetworking]
}

resource "google_apigee_organization" "apigee_org" {
analytics_region = "us-central1"
project_id = google_project.project.project_id
authorized_network = google_compute_network.apigee_network.id
depends_on = [
google_service_networking_connection.apigee_vpc_connection,
google_project_service.apigee,
]
}

resource "google_apigee_envgroup" "apigee_envgroup" {
org_id = google_apigee_organization.apigee_org.id
name = "tf-test%{random_suffix}"
hostnames = ["abc.foo.com"]
}

resource "google_apigee_environment" "apigee_env" {
org_id = google_apigee_organization.apigee_org.id
name = "tf-test%{random_suffix}"
description = "Apigee Environment"
display_name = "tf-test%{random_suffix}"
}

resource "google_apigee_envgroup_attachment" "<%= ctx[:primary_resource_id] %>" {
envgroup_id = google_apigee_envgroup.apigee_envgroup.name
environment = google_apigee_environment.apigee_env.name
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
resource "google_project" "project" {
project_id = "tf-test%{random_suffix}"
name = "tf-test%{random_suffix}"
org_id = "<%= ctx[:test_env_vars]['org_id'] %>"
billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>"
}

resource "google_project_service" "apigee" {
project = google_project.project.project_id
service = "apigee.googleapis.com"
}

resource "google_project_service" "compute" {
project = google_project.project.project_id
service = "compute.googleapis.com"
}

resource "google_project_service" "servicenetworking" {
project = google_project.project.project_id
service = "servicenetworking.googleapis.com"
}

resource "google_compute_network" "apigee_network" {
name = "apigee-network"
project = google_project.project.project_id
depends_on = [google_project_service.compute]
}

resource "google_compute_global_address" "apigee_range" {
name = "apigee-range"
purpose = "VPC_PEERING"
address_type = "INTERNAL"
prefix_length = 16
network = google_compute_network.apigee_network.id
project = google_project.project.project_id
}

resource "google_service_networking_connection" "apigee_vpc_connection" {
network = google_compute_network.apigee_network.id
service = "servicenetworking.googleapis.com"
reserved_peering_ranges = [google_compute_global_address.apigee_range.name]
depends_on = [google_project_service.servicenetworking]
}

resource "google_apigee_organization" "apigee_org" {
analytics_region = "us-central1"
project_id = google_project.project.project_id
authorized_network = google_compute_network.apigee_network.id
depends_on = [
google_service_networking_connection.apigee_vpc_connection,
google_project_service.apigee,
]
}

resource "google_apigee_envgroup" "apigee_envgroup" {
org_id = google_apigee_organization.apigee_org.id
name = "tf-test%{random_suffix}"
hostnames = ["abc.foo.com"]
}

resource "google_apigee_environment" "apigee_env" {
org_id = google_apigee_organization.apigee_org.id
name = "tf-test%{random_suffix}"
description = "Apigee Environment"
display_name = "tf-test%{random_suffix}"
}

resource "google_apigee_envgroup_attachment" "<%= ctx[:primary_resource_id] %>" {
envgroup_id = google_apigee_envgroup.apigee_envgroup.id
environment = google_apigee_environment.apigee_env.name
}