@@ -112,27 +112,33 @@ def create_sddc(self):
112
112
print ('\n # Example: Create a SDDC ({}) in org {}:' .format (
113
113
self .sddc_name , self .org_id ))
114
114
115
- account_id = self .vmc_client .orgs .account_link .ConnectedAccounts .get (
116
- self .org_id )[0 ].id
115
+ account_linking_config = None
117
116
118
- vpc_map = self .vmc_client .orgs .account_link .CompatibleSubnets .get (
119
- org = self .org_id , linked_account_id = account_id ).vpc_map
117
+ # Get connected accounts if any
118
+ account_ids = self .vmc_client .orgs .account_link .ConnectedAccounts .get (
119
+ self .org_id )
120
120
121
- customer_subnet_id = self .get_subnet_id (vpc_map )
122
- if not customer_subnet_id :
123
- raise ValueError ('No available subnet for region {}' .format (
124
- self .region ))
121
+ if len (account_ids ) > 0 :
122
+ account_id = account_ids [0 ].id
123
+
124
+ vpc_map = self .vmc_client .orgs .account_link .CompatibleSubnets .get (
125
+ org = self .org_id , linked_account_id = account_id ).vpc_map
126
+
127
+ customer_subnet_id = self .get_subnet_id (vpc_map )
128
+ if not customer_subnet_id :
129
+ raise ValueError ('No available subnet for region {}' .format (
130
+ self .region ))
131
+
132
+ account_linking_config = AccountLinkSddcConfig (
133
+ customer_subnet_ids = [customer_subnet_id ],
134
+ connected_account_id = account_id )
125
135
126
136
sddc_config = AwsSddcConfig (
127
137
region = self .region ,
128
138
name = self .sddc_name ,
129
- account_link_sddc_config = [
130
- AccountLinkSddcConfig (
131
- customer_subnet_ids = [customer_subnet_id ],
132
- connected_account_id = account_id )
133
- ],
139
+ account_link_sddc_config = [account_linking_config ] if account_linking_config else None ,
134
140
provider = os .environ .get ('VMC_PROVIDER' , SddcConfig .PROVIDER_AWS ),
135
- num_hosts = 1 ,
141
+ num_hosts = 4 ,
136
142
deployment_type = SddcConfig .DEPLOYMENT_TYPE_SINGLEAZ )
137
143
138
144
try :
0 commit comments