1+ apiVersion : apiextensions.crossplane.io/v1
2+ kind : Composition
3+ metadata :
4+ name : xvirtualmachines.infrastructure.example.org
5+ labels :
6+ provider : gcp
7+ spec :
8+ compositeTypeRef :
9+ apiVersion : infrastructure.example.org/v1alpha1
10+ kind : XVirtualMachine
11+ resources :
12+ - base :
13+ apiVersion : infrastructure.example.org/v1alpha1
14+ kind : XNetwork
15+ patches :
16+ - fromFieldPath : spec.id
17+ toFieldPath : spec.id
18+ - fromFieldPath : spec.parameters.location
19+ toFieldPath : spec.location
20+ name : compositeNetGoogleVM
21+ - base :
22+ apiVersion : compute.gcp.upbound.io/v1beta1
23+ kind : Instance
24+ spec :
25+ forProvider :
26+ networkInterface :
27+ - networkSelector :
28+ matchLabels :
29+ networks.infrastructure.example.org/network-id : to-be-patched
30+ subnetworkSelector :
31+ matchLabels :
32+ networks.infrastructure.example.org/network-id : to-be-patched
33+ bootDisk :
34+ - initializeParams :
35+ - image : debian-cloud/debian-11 # patched
36+ machineType : e2-medium # patched
37+ zone : us-east1-b # patched
38+ patches :
39+ - fromFieldPath : spec.parameters.location
40+ toFieldPath : spec.forProvider.zone
41+ transforms :
42+ - type : map
43+ map :
44+ ' East US ' : ' us-east1-b'
45+ ' West US ' : ' us-west1-a'
46+ - fromFieldPath : spec.parameters.operatingSystem
47+ toFieldPath : spec.forProvider.bootDisk[0].initializeParams[0].image
48+ transforms :
49+ - type : map
50+ map :
51+ ' Windows ' : windows-cloud/windows-2022
52+ ' Linux (Ubuntu) ' : debian-cloud/debian-11
53+ - fromFieldPath : spec.parameters.vmSize
54+ toFieldPath : spec.forProvider.machineType
55+ transforms :
56+ - type : map
57+ map :
58+ ' 1 vCPU, 1 GB ' : e2-standard-2
59+ ' 2 vCPU, 8 GB ' : n2-standard-2
60+ ' 4 vCPU, 16 GB ' : n2-standard-4
61+ # Create this machine in the Network and Subnetwork referenced by network ID
62+ - fromFieldPath : spec.id
63+ toFieldPath : spec.forProvider.networkInterface[0].networkSelector.matchLabels[networks.infrastructure.example.org/network-id]
64+ - fromFieldPath : spec.id
65+ toFieldPath : spec.forProvider.networkInterface[0].subnetworkSelector.matchLabels[networks.infrastructure.example.org/network-id]
66+ name : compositeMachineGoogle
0 commit comments