I am creating a cluster and want to specify a main...
# typescript
s
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
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
Oh, that’s sounds good to me. Thank you!
c
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
Oh, perfect. I will give it a try. Thank you, @clever-sunset-76585