Does anyone have any idea on how to set config wit...
# automation-api
Does anyone have any idea on how to set config with objects involved using automation API? for example,
cidr: 172.xx.xx.xx/24
autoScalingDiskGbEnabled: true
mongoDbMajorVersion: 4.2
resourceGroupName: rg-name
vnetName: vnet-name
numShards: 1
what have you tried? you can probably just write the YAML file directly using your language yaml parser if needed
Copy code
export interface AtlasCluserConfig {
  autoScalingDiskGbEnabled: boolean;
  mongoDbMajorVersion: string;
  networkpeering: AtlasCluserNetworkPeeringConfig;
  numShards: number;
  provider: AtlasCluserProviderConfig;
  replicationFactor: number;
Copy code
export interface AtlasConfig {
  cluster: AtlasCluserConfig;
  cidr: string;

const stack = await LocalWorkspace.createOrSelectStack({
      stackName: stackName,
      projectName: ATLAS_PROJECT,
      program: async () => { 

      localworkspace.setLocalWorkspaceOptions(ATLAS_PROJECT, stackName),
await stack.setAllConfig({
'atlas.cidr': { value: '1'},   'atlas.cluster.autoScalingDiskGbEnabled': { value: 'true'}
As you could see above, I tried using setAllconfig() from Stack class.
And I am trying to set the properties for different resources creation using stack config as we used to do before using YAML stack file instead of hardcoding it inside programFun in automation API as in
@billowy-army-68599 - do you have anything to suggest me 🙂 ?
I don't have any bright ideas there I'm afraid, other than using
and setting a map into it I guess
One more thing, it is only value of type string that is allowed inside Map. And I couldn't find a place to put object value.
I can't speak 100% for the other SDKs - but I will say that for the .NET SDK the decision was made that for complex config scenarios we would just leave the consumer to serialize / deserialize directly to the YAML without supporting it through the Automation API. With .NET particularly it was very difficult to support complex object serialization across both YAML & JSON config scenarios without causing weird collisions of type issues between the 2 or without splitting the API. Similar decisions may have been made in the other SDKs. You shouldn't have any issues reading your structured config from within your
as that should still function the same as before the Automation API was released, but you might have to do the writing to the config file yourself.
Thanks for the update!