Skip to content

Commit 41756e6

Browse files
displagueCopilot
andcommitted
feat(apigee): add 19 missing Apigee resources to provider
Add support for the following Google Apigee resources: - google_apigee_api: API proxy management - google_apigee_api_product: API product configuration - google_apigee_app_group: Application group management - google_apigee_control_plane_access: Control plane access config - google_apigee_developer: Developer account management - google_apigee_dns_zone: DNS zone configuration - google_apigee_environment_addons_config: Environment addons - google_apigee_environment_iam_binding: Environment IAM bindings - google_apigee_environment_iam_policy: Environment IAM policies - google_apigee_environment_keyvaluemaps: Key-value map storage - google_apigee_environment_keyvaluemaps_entries: KVM entries - google_apigee_flowhook: Flow hook management - google_apigee_keystores_aliases_pkcs12: PKCS12 keystore aliases - google_apigee_keystores_aliases_self_signed_cert: Self-signed cert aliases - google_apigee_security_action: Security action configuration - google_apigee_security_monitoring_condition: Security monitoring - google_apigee_security_profile_v2: Security profiles v2 - google_apigee_sharedflow: Shared flow management - google_apigee_sharedflow_deployment: Shared flow deployments Configuration changes: - config/generated.lst: Added 19 new Apigee resources in alphabetical order - config/externalname.go: Configured external name patterns for all new resources following Terraform import format conventions - config/cluster/apigee/config.go: Added cross-resource references for proper resource relationships (org_id -> organization, env_id -> environment, sharedflow -> sharedflow, etc.) All resources follow the established TargetServer pattern with proper external name templates and reference configurations. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 158164e commit 41756e6

3 files changed

Lines changed: 184 additions & 12 deletions

File tree

config/cluster/apigee/config.go

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,119 @@ func Configure(p *config.Provider) { //nolint:gocyclo
7474
return diff, nil
7575
}
7676
})
77+
p.AddResourceConfigurator("google_apigee_api", func(r *config.Resource) {
78+
// org_id requires Organization ID without organization/ prefix, so extract name attribute
79+
r.References["org_id"] = config.Reference{
80+
TerraformName: "google_apigee_organization",
81+
Extractor: `github.com/crossplane/upjet/v2/pkg/resource.ExtractParamPath("name",true)`,
82+
}
83+
})
84+
p.AddResourceConfigurator("google_apigee_api_product", func(r *config.Resource) {
85+
// org_id requires Organization ID without organization/ prefix, so extract name attribute
86+
r.References["org_id"] = config.Reference{
87+
TerraformName: "google_apigee_organization",
88+
Extractor: `github.com/crossplane/upjet/v2/pkg/resource.ExtractParamPath("name",true)`,
89+
}
90+
})
91+
p.AddResourceConfigurator("google_apigee_app_group", func(r *config.Resource) {
92+
// org_id requires Organization ID without organization/ prefix, so extract name attribute
93+
r.References["org_id"] = config.Reference{
94+
TerraformName: "google_apigee_organization",
95+
Extractor: `github.com/crossplane/upjet/v2/pkg/resource.ExtractParamPath("name",true)`,
96+
}
97+
})
98+
p.AddResourceConfigurator("google_apigee_developer", func(r *config.Resource) {
99+
// org_id requires Organization ID without organization/ prefix, so extract name attribute
100+
r.References["org_id"] = config.Reference{
101+
TerraformName: "google_apigee_organization",
102+
Extractor: `github.com/crossplane/upjet/v2/pkg/resource.ExtractParamPath("name",true)`,
103+
}
104+
})
105+
p.AddResourceConfigurator("google_apigee_dns_zone", func(r *config.Resource) {
106+
// org_id requires Organization ID without organization/ prefix, so extract name attribute
107+
r.References["org_id"] = config.Reference{
108+
TerraformName: "google_apigee_organization",
109+
Extractor: `github.com/crossplane/upjet/v2/pkg/resource.ExtractParamPath("name",true)`,
110+
}
111+
})
112+
p.AddResourceConfigurator("google_apigee_environment_keyvaluemaps", func(r *config.Resource) {
113+
r.References["env_id"] = config.Reference{
114+
TerraformName: "google_apigee_environment",
115+
Extractor: common.ExtractResourceIDFuncPath,
116+
}
117+
})
118+
p.AddResourceConfigurator("google_apigee_environment_keyvaluemaps_entries", func(r *config.Resource) {
119+
r.References["env_id"] = config.Reference{
120+
TerraformName: "google_apigee_environment",
121+
Extractor: common.ExtractResourceIDFuncPath,
122+
}
123+
})
124+
p.AddResourceConfigurator("google_apigee_flowhook", func(r *config.Resource) {
125+
// org_id requires Organization ID without organization/ prefix, so extract name attribute
126+
r.References["org_id"] = config.Reference{
127+
TerraformName: "google_apigee_organization",
128+
Extractor: `github.com/crossplane/upjet/v2/pkg/resource.ExtractParamPath("name",true)`,
129+
}
130+
r.References["sharedflow"] = config.Reference{
131+
TerraformName: "google_apigee_sharedflow",
132+
}
133+
})
134+
p.AddResourceConfigurator("google_apigee_keystores_aliases_pkcs12", func(r *config.Resource) {
135+
// org_id requires Organization ID without organization/ prefix, so extract name attribute
136+
r.References["org_id"] = config.Reference{
137+
TerraformName: "google_apigee_organization",
138+
Extractor: `github.com/crossplane/upjet/v2/pkg/resource.ExtractParamPath("name",true)`,
139+
}
140+
})
141+
p.AddResourceConfigurator("google_apigee_keystores_aliases_self_signed_cert", func(r *config.Resource) {
142+
// org_id requires Organization ID without organization/ prefix, so extract name attribute
143+
r.References["org_id"] = config.Reference{
144+
TerraformName: "google_apigee_organization",
145+
Extractor: `github.com/crossplane/upjet/v2/pkg/resource.ExtractParamPath("name",true)`,
146+
}
147+
})
148+
p.AddResourceConfigurator("google_apigee_security_action", func(r *config.Resource) {
149+
// org_id requires Organization ID without organization/ prefix, so extract name attribute
150+
r.References["org_id"] = config.Reference{
151+
TerraformName: "google_apigee_organization",
152+
Extractor: `github.com/crossplane/upjet/v2/pkg/resource.ExtractParamPath("name",true)`,
153+
}
154+
})
155+
p.AddResourceConfigurator("google_apigee_security_monitoring_condition", func(r *config.Resource) {
156+
// org_id requires Organization ID without organization/ prefix, so extract name attribute
157+
r.References["org_id"] = config.Reference{
158+
TerraformName: "google_apigee_organization",
159+
Extractor: `github.com/crossplane/upjet/v2/pkg/resource.ExtractParamPath("name",true)`,
160+
}
161+
})
162+
p.AddResourceConfigurator("google_apigee_security_profile_v2", func(r *config.Resource) {
163+
// org_id requires Organization ID without organization/ prefix, so extract name attribute
164+
r.References["org_id"] = config.Reference{
165+
TerraformName: "google_apigee_organization",
166+
Extractor: `github.com/crossplane/upjet/v2/pkg/resource.ExtractParamPath("name",true)`,
167+
}
168+
})
169+
p.AddResourceConfigurator("google_apigee_sharedflow", func(r *config.Resource) {
170+
// org_id requires Organization ID without organization/ prefix, so extract name attribute
171+
r.References["org_id"] = config.Reference{
172+
TerraformName: "google_apigee_organization",
173+
Extractor: `github.com/crossplane/upjet/v2/pkg/resource.ExtractParamPath("name",true)`,
174+
}
175+
})
176+
p.AddResourceConfigurator("google_apigee_sharedflow_deployment", func(r *config.Resource) {
177+
// org_id requires Organization ID without organization/ prefix, so extract name attribute
178+
r.References["org_id"] = config.Reference{
179+
TerraformName: "google_apigee_organization",
180+
Extractor: `github.com/crossplane/upjet/v2/pkg/resource.ExtractParamPath("name",true)`,
181+
}
182+
r.References["sharedflow_id"] = config.Reference{
183+
TerraformName: "google_apigee_sharedflow",
184+
}
185+
})
186+
p.AddResourceConfigurator("google_apigee_target_server", func(r *config.Resource) {
187+
r.References["env_id"] = config.Reference{
188+
TerraformName: "google_apigee_environment",
189+
Extractor: common.ExtractResourceIDFuncPath,
190+
}
191+
})
77192
}

config/externalname.go

Lines changed: 50 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -932,36 +932,74 @@ var terraformPluginSDKExternalNameConfigs = map[string]config.ExternalName{
932932

933933
// apigee
934934
//
935-
// Imported by using the following format: {{org_id}}/endpointAttachments/{{endpoint_attachment_id}}
936-
"google_apigee_endpoint_attachment": config.TemplatedStringAsIdentifier("endpoint_attachment_id", "{{ .parameters.org_id }}/endpointAttachments/{{ .external_name }}"),
937935
// Imported by using the following format: organizations/{{name}}
938936
"google_apigee_addons_config": config.IdentifierFromProvider,
937+
// Imported by using the following format: organizations/{{org_id}}/apis/{{name}}
938+
"google_apigee_api": config.TemplatedStringAsIdentifier("name", "organizations/{{ .parameters.org_id }}/apis/{{ .external_name }}"),
939+
// Imported by using the following format: {{org_id}}/apiproducts/{{name}}
940+
"google_apigee_api_product": config.TemplatedStringAsIdentifier("name", "{{ .parameters.org_id }}/apiproducts/{{ .external_name }}"),
941+
// Imported by using the following format: {{org_id}}/appgroups/{{name}}
942+
"google_apigee_app_group": config.TemplatedStringAsIdentifier("name", "{{ .parameters.org_id }}/appgroups/{{ .external_name }}"),
943+
// Imported by using the following format: {{org_id}}/controlPlaneAccess
944+
"google_apigee_control_plane_access": config.IdentifierFromProvider,
945+
// Imported by using the following format: {{org_id}}/developers/{{email}}
946+
"google_apigee_developer": config.TemplatedStringAsIdentifier("email", "{{ .parameters.org_id }}/developers/{{ .external_name }}"),
947+
// Imported by using the following format: {{org_id}}/dnszones/{{name}}
948+
"google_apigee_dns_zone": config.TemplatedStringAsIdentifier("name", "{{ .parameters.org_id }}/dnszones/{{ .external_name }}"),
949+
// Imported by using the following format: {{org_id}}/endpointAttachments/{{endpoint_attachment_id}}
950+
"google_apigee_endpoint_attachment": config.TemplatedStringAsIdentifier("endpoint_attachment_id", "{{ .parameters.org_id }}/endpointAttachments/{{ .external_name }}"),
951+
// Imported by using the following format: {{env_id}}/keystores/{{name}}
952+
"google_apigee_env_keystore": config.TemplatedStringAsIdentifier("name", "{{ .parameters.env_id }}/keystores/{{ .external_name }}"),
953+
// Imported by using the following format: {{env_id}}/references/{{name}}
954+
"google_apigee_env_references": config.TemplatedStringAsIdentifier("name", "{{ .parameters.env_id }}/references/{{ .external_name }}"),
939955
// Imported by using the following format: {{org_id}}/envgroups/{{name}}
940956
"google_apigee_envgroup": config.TemplatedStringAsIdentifier("name", "{{ .parameters.org_id }}/envgroups/{{ .external_name }}"),
941957
// Imported by using the following format: {{envgroup_id}}/attachments/{{name}}. Name doesn't exist in parameters, try using IdentifierFromProvider
942958
"google_apigee_envgroup_attachment": apigeeEnvgroupAttachment(),
943959
// Imported by using the following format: {{org_id}}/environments/{{name}}
944960
"google_apigee_environment": config.TemplatedStringAsIdentifier("name", "{{ .parameters.org_id }}/environments/{{ .external_name }}"),
961+
// Imported by using the following format: {{org_id}}/environments/{{environment}}/addonsConfig
962+
"google_apigee_environment_addons_config": config.IdentifierFromProvider,
963+
// Imported by using the following format: {{org_id}}/environments/{{environment}} roles/viewer user:jane@example.com
964+
"google_apigee_environment_iam_binding": config.IdentifierFromProvider,
965+
// Imported by using the following format: {{org_id}}/environments/{{environment}} roles/viewer user:jane@example.com
966+
"google_apigee_environment_iam_member": config.IdentifierFromProvider,
967+
// Imported by using the following format: {{org_id}}/environments/{{environment}}
968+
"google_apigee_environment_iam_policy": config.IdentifierFromProvider,
969+
// Imported by using the following format: {{env_id}}/keyvaluemaps/{{name}}
970+
"google_apigee_environment_keyvaluemaps": config.TemplatedStringAsIdentifier("name", "{{ .parameters.env_id }}/keyvaluemaps/{{ .external_name }}"),
971+
// Imported by using the following format: {{env_id}}/keyvaluemaps/{{keyvaluemap}}/entries/{{name}}
972+
"google_apigee_environment_keyvaluemaps_entries": config.TemplatedStringAsIdentifier("name", "{{ .parameters.env_id }}/keyvaluemaps/{{ .parameters.keyvaluemap }}/entries/{{ .external_name }}"),
973+
// Imported by using the following format: {{org_id}}/environments/{{environment}}/flowhooks/{{flow_hook_point}}
974+
"google_apigee_flowhook": config.IdentifierFromProvider,
945975
// Imported by using the following format: {{org_id}}/instances/{{name}}
946976
"google_apigee_instance": config.TemplatedStringAsIdentifier("name", "{{ .parameters.org_id }}/instances/{{ .external_name }}"),
947977
// Imported by using the following format: {{instance_id}}/attachments/{{name}}
948978
"google_apigee_instance_attachment": apigeeInstanceAttachment(),
979+
// Imported by using the following format: organizations/{{org_id}}/environments/{{environment}}/keystores/{{keystore}}/aliases/{{alias}}
980+
"google_apigee_keystores_aliases_key_cert_file": config.TemplatedStringAsIdentifier("alias", "organizations/{{ .parameters.org_id }}/environments/{{ .parameters.environment }}/keystores/{{ .parameters.keystore }}/aliases/{{ .external_name }}"),
981+
// Imported by using the following format: organizations/{{org_id}}/environments/{{environment}}/keystores/{{keystore}}/aliases/{{alias}}
982+
"google_apigee_keystores_aliases_pkcs12": config.TemplatedStringAsIdentifier("alias", "organizations/{{ .parameters.org_id }}/environments/{{ .parameters.environment }}/keystores/{{ .parameters.keystore }}/aliases/{{ .external_name }}"),
983+
// Imported by using the following format: organizations/{{org_id}}/environments/{{environment}}/keystores/{{keystore}}/aliases/{{alias}}
984+
"google_apigee_keystores_aliases_self_signed_cert": config.TemplatedStringAsIdentifier("alias", "organizations/{{ .parameters.org_id }}/environments/{{ .parameters.environment }}/keystores/{{ .parameters.keystore }}/aliases/{{ .external_name }}"),
985+
// Imported by using the following format: {{instance_id}}/natAddresses/{{name}}
986+
"google_apigee_nat_address": config.TemplatedStringAsIdentifier("name", "{{ .parameters.instance_id }}/natAddresses/{{ .external_name }}"),
949987
// Imported by using the following format: organizations/{{name}}
950988
"google_apigee_organization": apigeeOrganization(),
989+
// Imported by using the following format: {{org_id}}/securityActions/{{security_action_id}}
990+
"google_apigee_security_action": config.TemplatedStringAsIdentifier("security_action_id", "{{ .parameters.org_id }}/securityActions/{{ .external_name }}"),
991+
// Imported by using the following format: {{org_id}}/environments/{{environment}}/securityMonitoringConditions/{{security_monitoring_condition_id}}
992+
"google_apigee_security_monitoring_condition": config.TemplatedStringAsIdentifier("security_monitoring_condition_id", "{{ .parameters.org_id }}/environments/{{ .parameters.environment }}/securityMonitoringConditions/{{ .external_name }}"),
993+
// Imported by using the following format: {{org_id}}/securityProfilesV2/{{security_profile_id}}
994+
"google_apigee_security_profile_v2": config.TemplatedStringAsIdentifier("security_profile_id", "{{ .parameters.org_id }}/securityProfilesV2/{{ .external_name }}"),
995+
// Imported by using the following format: organizations/{{org_id}}/sharedflows/{{name}}
996+
"google_apigee_sharedflow": config.TemplatedStringAsIdentifier("name", "organizations/{{ .parameters.org_id }}/sharedflows/{{ .external_name }}"),
997+
// Imported by using the following format: {{org_id}}/environments/{{environment}}/sharedflows/{{sharedflow_id}}/revisions/{{revision}}/deployments
998+
"google_apigee_sharedflow_deployment": config.IdentifierFromProvider,
951999
// Imported by using the following format: organizations/{{name}}/syncAuthorization
9521000
"google_apigee_sync_authorization": config.TemplatedStringAsIdentifier("", "organizations/{{ .parameters.name }}/syncAuthorization"),
953-
// Imported by using the following format: {{instance_id}}/natAddresses/{{name}}
954-
"google_apigee_nat_address": config.TemplatedStringAsIdentifier("name", "{{ .parameters.instance_id }}/natAddresses/{{ .external_name }}"),
955-
// Imported by using the following format: {{org_id}}/environments/{{environment}} roles/viewer user:jane@example.com
956-
"google_apigee_environment_iam_member": config.IdentifierFromProvider,
957-
// Imported by using the following format: {{env_id}}/keystores/{{name}}
958-
"google_apigee_env_keystore": config.TemplatedStringAsIdentifier("name", "{{ .parameters.env_id }}/keystores/{{ .external_name }}"),
959-
// Imported by using the following format: {{env_id}}/references/{{name}}
960-
"google_apigee_env_references": config.TemplatedStringAsIdentifier("name", "{{ .parameters.env_id }}/references/{{ .external_name }}"),
9611001
// Imported by using the following format: {{env_id}}/targetservers/{{name}}
9621002
"google_apigee_target_server": config.TemplatedStringAsIdentifier("name", "{{ .parameters.env_id }}/targetservers/{{ .external_name }}"),
963-
// Imported by using the following format: organizations/{{org_id}}/environments/{{environment}}/keystores/{{keystore}}/aliases/{{alias}}
964-
"google_apigee_keystores_aliases_key_cert_file": config.TemplatedStringAsIdentifier("alias", "organizations/{{ .parameters.org_id }}/environments/{{ .parameters.environment }}/keystores/{{ .parameters.keystore }}/aliases/{{ .external_name }}"),
9651003

9661004
// binaryauthorization
9671005
//

config/generated.lst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,37 @@
1010
"google_alloydb_cluster",
1111
"google_alloydb_instance",
1212
"google_apigee_addons_config",
13+
"google_apigee_api",
14+
"google_apigee_api_product",
15+
"google_apigee_app_group",
16+
"google_apigee_control_plane_access",
17+
"google_apigee_developer",
18+
"google_apigee_dns_zone",
1319
"google_apigee_endpoint_attachment",
1420
"google_apigee_env_keystore",
1521
"google_apigee_env_references",
1622
"google_apigee_envgroup",
1723
"google_apigee_envgroup_attachment",
1824
"google_apigee_environment",
25+
"google_apigee_environment_addons_config",
26+
"google_apigee_environment_iam_binding",
1927
"google_apigee_environment_iam_member",
28+
"google_apigee_environment_iam_policy",
29+
"google_apigee_environment_keyvaluemaps",
30+
"google_apigee_environment_keyvaluemaps_entries",
31+
"google_apigee_flowhook",
2032
"google_apigee_instance",
2133
"google_apigee_instance_attachment",
2234
"google_apigee_keystores_aliases_key_cert_file",
35+
"google_apigee_keystores_aliases_pkcs12",
36+
"google_apigee_keystores_aliases_self_signed_cert",
2337
"google_apigee_nat_address",
2438
"google_apigee_organization",
39+
"google_apigee_security_action",
40+
"google_apigee_security_monitoring_condition",
41+
"google_apigee_security_profile_v2",
42+
"google_apigee_sharedflow",
43+
"google_apigee_sharedflow_deployment",
2544
"google_apigee_sync_authorization",
2645
"google_apigee_target_server",
2746
"google_app_engine_application",

0 commit comments

Comments
 (0)