https://pulumi.com logo
s

some-continent-7311

09/15/2023, 6:32 AM
I am creating a cluster and want to specify a maintenance policy with settings coming from the config file. In my script I declare an interface like this:
Copy code
interface ClusterConfig {
  // properties
  maintenancePolicy: ClusterMaintenancePolicy;
};
My issue is that I don’t know how to import the
ClusterMaintenancePolicy
properly. I tried
gcp.container.ClusterMaintenancePolicy
and it does not work. Is it possible at all?
f

full-eve-52536

09/15/2023, 1:46 PM
ClusterMaintenancePolicy
is an interface, so I think your usage in the above code is wrong. What you really want is:
Copy code
interface ClusterConfig {
  // properties
  maintenancePolicy: {
    dailyMaintenanceWindow: <insert object here>,
    maintenanceExclusions: <insert object here>,
   };
};
s

some-continent-7311

09/15/2023, 6:28 PM
Oh, that’s sounds good to me. Thank you!
c

clever-sunset-76585

09/19/2023, 4:02 AM
Interfaces are in the
types/input
module of the respective cloud provider. Add a separate import for that and then you'd be able to reuse existing types. For example, to use the types for resources under the
container
module in the Google Native provider:
Copy code
import {container} from "@pulumi/google-native/types/input";
s

some-continent-7311

09/19/2023, 5:05 AM
Oh, perfect. I will give it a try. Thank you, @clever-sunset-76585
2 Views