├── .github ├── CODE_OF_CONDUCT.md ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── SUPPORT.md ├── dependabot.yaml ├── stale.yaml └── workflows │ ├── ci.yaml │ └── release.yaml ├── .gitignore ├── .goreleaser.yaml ├── CHANGELOG.md ├── GNUmakefile ├── LICENSE ├── README.md ├── docs ├── index.md └── resources │ ├── account.md │ ├── account_aws.md │ ├── credentials_aws.md │ ├── credentials_azure.md │ ├── credentials_gcp.md │ ├── data_integration.md │ ├── elastigroup_aws.md │ ├── elastigroup_aws_beanstalk.md │ ├── elastigroup_aws_suspension.md │ ├── elastigroup_azure.md │ ├── elastigroup_gcp.md │ ├── elastigroup_gke.md │ ├── health_check.md │ ├── mrscaler_aws.md │ ├── ocean_aks_np.md │ ├── ocean_aks_np_virtual_node_group.md │ ├── ocean_automatic_rightsizing.md │ ├── ocean_aws.md │ ├── ocean_aws_extended_resource_definition.md │ ├── ocean_aws_launch_spec.md │ ├── ocean_ecs.md │ ├── ocean_ecs_launch_spec.md │ ├── ocean_gke_import.md │ ├── ocean_gke_launch_spec.md │ ├── ocean_gke_launch_spec_import.md │ ├── ocean_spark.md │ ├── ocean_spark_virtual_node_group.md │ ├── oceancd_rollout_spec.md │ ├── oceancd_strategy.md │ ├── oceancd_verification_provider.md │ ├── oceancd_verification_template.md │ ├── organization_policy.md │ ├── organization_programmatic_user.md │ ├── organization_user.md │ ├── organization_user_group.md │ ├── stateful_node_aws.md │ ├── stateful_node_azure.md │ └── subscription.md ├── go.mod ├── go.sum ├── main.go ├── scripts ├── changelog-links.sh ├── errcheck.sh ├── generate-docs.sh ├── gofmtcheck.sh └── gogetcookie.sh ├── spotinst ├── account │ ├── consts.go │ └── fields_spotinst_account.go ├── account_aws │ ├── consts.go │ └── fields_spotinst_account_aws.go ├── azure_v3 │ ├── elastigroup_azure │ │ ├── consts.go │ │ └── fields_spotinst_elastigroup_azure.go │ ├── elastigroup_azure_extension │ │ ├── consts.go │ │ └── fields_spotinst_elastigroup_azure_extensions.go │ ├── elastigroup_azure_health │ │ ├── consts.go │ │ └── fields_spotinst_elastigroup_azure_health.go │ ├── elastigroup_azure_image │ │ ├── consts.go │ │ └── fields_spotinst_elastigroup_azure_image.go │ ├── elastigroup_azure_launchspecification │ │ ├── consts.go │ │ └── fields_spotinst_elastigroup_azure_launchspecification.go │ ├── elastigroup_azure_load_balancer │ │ ├── consts.go │ │ └── fields_spotinst_elastigroup_azure_load_balancer.go │ ├── elastigroup_azure_login │ │ ├── consts.go │ │ └── fields_spotinst_elastigroup_azure_login.go │ ├── elastigroup_azure_network │ │ ├── consts.go │ │ └── fields_spotinst_elastigroup_azure_network.go │ ├── elastigroup_azure_scaling_policies │ │ ├── consts.go │ │ └── fields_spotinst_elastigroup_azure_scaling_policies.go │ ├── elastigroup_azure_scheduling │ │ ├── consts.go │ │ └── fields_spotinst_elastigroup_azure_scheduling.go │ ├── elastigroup_azure_secrets │ │ ├── consts.go │ │ └── fields_spotinst_elastigroup_azure_secret.go │ ├── elastigroup_azure_strategy │ │ ├── consts.go │ │ └── fields_spotinst_elastigroup_azure_strategy.go │ ├── elastigroup_azure_vm_sizes │ │ ├── consts.go │ │ └── fields_spotinst_elastigroup_azure_vm_sizes.go │ ├── stateful_node_azure │ │ ├── consts.go │ │ └── fields_spotinst_stateful_node_azure.go │ ├── stateful_node_azure_extension │ │ ├── consts.go │ │ └── fields_spotinst_stateful_node_azure_extensions.go │ ├── stateful_node_azure_health │ │ ├── consts.go │ │ └── fields_spotinst_stateful_node_azure_health.go │ ├── stateful_node_azure_image │ │ ├── consts.go │ │ └── fields_spotinst_stateful_node_azure_image.go │ ├── stateful_node_azure_launch_spec │ │ ├── consts.go │ │ └── fields_spotinst_stateful_node_azure_launch_spec.go │ ├── stateful_node_azure_load_balancer │ │ ├── consts.go │ │ └── fields_spotinst_stateful_node_azure_load_balancer.go │ ├── stateful_node_azure_login │ │ ├── consts.go │ │ └── fields_spotinst_stateful_node_azure_login.go │ ├── stateful_node_azure_network │ │ ├── consts.go │ │ └── fields_spotinst_stateful_node_azure_network.go │ ├── stateful_node_azure_persistence │ │ ├── consts.go │ │ └── fields_spotinst_stateful_node_azure_persistence.go │ ├── stateful_node_azure_scheduling │ │ ├── consts.go │ │ └── fields_spotinst_stateful_node_azure_scheduling.go │ ├── stateful_node_azure_secret │ │ ├── consts.go │ │ └── fields_spotinst_stateful_node_azure_secret.go │ ├── stateful_node_azure_strategy │ │ ├── consts.go │ │ └── fields_spotinst_stateful_node_azure_strategy.go │ └── stateful_node_azure_vm_sizes │ │ ├── consts.go │ │ └── fields_spotinst_stateful_node_azure_vm_sizes.go ├── commons │ ├── common_account.go │ ├── common_account_aws.go │ ├── common_credentials_aws.go │ ├── common_credentials_azure.go │ ├── common_credentials_gcp.go │ ├── common_dataintegration.go │ ├── common_elastigroup_aws.go │ ├── common_elastigroup_aws_beanstalk.go │ ├── common_elastigroup_aws_suspend_processes.go │ ├── common_elastigroup_azure_v3.go │ ├── common_elastigroup_gcp.go │ ├── common_elastigroup_gke.go │ ├── common_health_check.go │ ├── common_managed_instance_aws.go │ ├── common_mrscaler_aws.go │ ├── common_ocean_aks_np.go │ ├── common_ocean_aks_np_virtual_node_group.go │ ├── common_ocean_aws.go │ ├── common_ocean_aws_extended_resource_definition.go │ ├── common_ocean_aws_launch_spec.go │ ├── common_ocean_condintional_roll.go │ ├── common_ocean_ecs.go │ ├── common_ocean_ecs_launch_spec.go │ ├── common_ocean_gke.go │ ├── common_ocean_gke_import.go │ ├── common_ocean_gke_launch_spec.go │ ├── common_ocean_gke_launch_spec_import.go │ ├── common_ocean_right_sizing_rule.go │ ├── common_ocean_spark.go │ ├── common_ocean_spark_virtual_node_group.go │ ├── common_oceancd_rollout_spec.go │ ├── common_oceancd_strategy.go │ ├── common_oceancd_verification_provider.go │ ├── common_oceancd_verification_template.go │ ├── common_organization_policy.go │ ├── common_organization_programmatic_user.go │ ├── common_organization_user.go │ ├── common_organization_user_group.go │ ├── common_spotinst_resource.go │ ├── common_stateful_node_azure.go │ ├── common_subscription.go │ ├── consts.go │ ├── managed_instance_aws │ │ ├── consts.go │ │ └── fields_spotinst_manged_instance_aws.go │ ├── managed_instance_aws_compute │ │ ├── consts.go │ │ └── fields_spotinst_managed_instance_aws_compute.go │ ├── managed_instance_aws_compute_instance_type │ │ ├── consts.go │ │ └── fields_managed_instance_aws_compute_instance_type.go │ ├── managed_instance_aws_compute_launchspecification │ │ ├── consts.go │ │ └── fields_spotinst_managed_instances_aws_compute_launchspecification.go │ ├── managed_instance_aws_integrations │ │ ├── consts.go │ │ ├── fields_spotinst_managed_instance_integration_aws.go │ │ ├── managed_instance_aws_integrations_route53.go │ │ └── managed_instance_integration_load_balancers.go │ ├── managed_instance_healthcheck │ │ ├── consts.go │ │ └── fields_spotinst_managed_instance_healthCheack.go │ ├── managed_instance_persistence │ │ ├── consts.go │ │ └── fields_spotinst_managed_instance_persistence_aws.go │ ├── managed_instance_scheduling │ │ ├── consts.go │ │ └── fields_spotinst_managed_instance_aws_scheduling.go │ ├── managed_instance_strategy │ │ ├── consts.go │ │ └── fields_managed_instance_strategy_aws.go │ └── managed_instances_aws_compute_launchspecification_networkinterfaces │ │ ├── consts.go │ │ └── fields_spotinst_managed_instances_aws_compute_launchspecification_networkinterfaces.go ├── config.go ├── credentials_aws │ ├── consts.go │ └── fields_spotinst_credentials_aws.go ├── credentials_azure │ ├── consts.go │ └── fields_spotinst_credentials_azure.go ├── credentials_gcp │ ├── consts.go │ └── fields_spotinst_credentials_gcp.go ├── dataintegration │ ├── consts.go │ └── fields_spotinst_dataintegration.go ├── elastigroup_aws │ ├── consts.go │ └── fields_spotinst_elastigroup_aws.go ├── elastigroup_aws_beanstalk │ ├── consts.go │ └── fields_spotinst_elastigroup_aws_beanstalk.go ├── elastigroup_aws_beanstalk_scheduled_task │ ├── consts.go │ └── fields_spotinst_elastigroup_aws_beanstalk_scheduled_task.go ├── elastigroup_aws_block_devices │ ├── consts.go │ └── fields_spotinst_elastigroup_aws_block_devices.go ├── elastigroup_aws_instance_types │ ├── consts.go │ └── fields_spotinst_elastigroup_aws_instance_types.go ├── elastigroup_aws_integrations │ ├── consts.go │ ├── fields_spotinst_elastigroup_aws_integrations.go │ ├── fields_spotinst_elastigroup_aws_integrations_codedeploy.go │ ├── fields_spotinst_elastigroup_aws_integrations_docker_swarm.go │ ├── fields_spotinst_elastigroup_aws_integrations_ecs.go │ ├── fields_spotinst_elastigroup_aws_integrations_elastic_beanstalk.go │ ├── fields_spotinst_elastigroup_aws_integrations_gitlab.go │ ├── fields_spotinst_elastigroup_aws_integrations_kubernetes.go │ ├── fields_spotinst_elastigroup_aws_integrations_mesosphere.go │ ├── fields_spotinst_elastigroup_aws_integrations_nomad.go │ ├── fields_spotinst_elastigroup_aws_integrations_rancher.go │ └── fields_spotinst_elastigroup_aws_integrations_route53.go ├── elastigroup_aws_launch_configuration │ ├── consts.go │ └── fields_spotinst_elastigroup_aws_launch_configuration.go ├── elastigroup_aws_logging │ ├── const.go │ └── fields_spotinst_elastigroup_aws_logging.go ├── elastigroup_aws_network_interface │ ├── consts.go │ └── fields_spotinst_elastigroup_aws_network_interface.go ├── elastigroup_aws_scaling_policies │ ├── consts.go │ └── fields_spotinst_elastigroup_aws_scaling_policies.go ├── elastigroup_aws_scheduled_task │ ├── consts.go │ └── fields_spotinst_elastigroup_aws_scheduled_task.go ├── elastigroup_aws_stateful │ ├── consts.go │ └── fields_spotinst_elastigroup_aws_stateful.go ├── elastigroup_aws_strategy │ ├── consts.go │ └── fields_spotinst_elastigroup_aws_strategy.go ├── elastigroup_aws_suspend_processes │ ├── consts.go │ └── fields_suspend_processes.go ├── elastigroup_gcp │ ├── consts.go │ └── fields_spotinst_elastigroup_gcp.go ├── elastigroup_gcp_disk │ ├── consts.go │ └── fields_spotinst_elastigroup_gcp_disk.go ├── elastigroup_gcp_gpu │ ├── consts.go │ └── fields_spotinst_elastigroup_gcp_gpu.go ├── elastigroup_gcp_instance_types │ ├── consts.go │ └── fields_spotinst_elastigroup_gcp_instance_types.go ├── elastigroup_gcp_integrations │ ├── consts.go │ ├── fields_spotinst_elastigroup_gcp_integrations.go │ ├── fields_spotinst_elastigroup_gcp_integrations_docker_swarm.go │ └── fields_spotinst_elastigroup_gcp_integrations_gke.go ├── elastigroup_gcp_launch_configuration │ ├── consts.go │ └── fields_spotinst_elastigroup_gcp_launch_configuration.go ├── elastigroup_gcp_network_interface │ ├── consts.go │ └── fields_spotinst_elastigroup_gcp_network_interface.go ├── elastigroup_gcp_scaling_policies │ ├── consts.go │ └── fields_spotinst_elastigroup_gcp_scaling_policies.go ├── elastigroup_gcp_scheduled_task │ ├── consts.go │ └── fields_spotinst_elastigroup_gcp_scheduled_task.go ├── elastigroup_gcp_strategy │ ├── consts.go │ └── fields_spotinst_elastigroup_gcp_strategy.go ├── elastigroup_gke │ ├── consts.go │ └── fields_spotinst_elastigroup_gke.go ├── elastigroup_sweeper_test.go ├── health_check │ ├── consts.go │ └── fields_health_check.go ├── mrscaler_aws │ ├── consts.go │ └── fields_spotinst_mrscaler_aws.go ├── mrscaler_aws_cluster │ ├── consts.go │ └── fields_spotinst_mrscaler_aws_cluster.go ├── mrscaler_aws_instance_groups │ ├── consts.go │ ├── fields_spotinst_mrscaler_aws_instance_groups.go │ ├── fields_spotinst_mrscaler_aws_instance_groups_core.go │ ├── fields_spotinst_mrscaler_aws_instance_groups_master.go │ └── fields_spotinst_mrscaler_aws_instance_groups_task.go ├── mrscaler_aws_scaling_policies │ ├── consts.go │ ├── fields_spotinst_mrscaler_aws_core_scaling_policies.go │ ├── fields_spotinst_mrscaler_aws_scaling_policies.go │ └── fields_spotinst_mrscaler_aws_task_scaling_policies.go ├── mrscaler_aws_scheduled_task │ ├── consts.go │ └── fields_spotinst_mrscaler_aws_scheduled_task.go ├── mrscaler_aws_strategy │ ├── consts.go │ └── fields_spotinst_mrscaler_aws_strategy.go ├── mrscaler_aws_terminationPolicies │ ├── consts.go │ └── fields_spotinst_mrscaler_aws_terminationPolicies.go ├── ocean_aks_np │ ├── consts.go │ └── fields_spotinst_ocean_aks_np.go ├── ocean_aks_np_auto_scale │ ├── consts.go │ └── fields_spotinst_ocean_aks_np_auto_scale.go ├── ocean_aks_np_auto_scaler │ ├── consts.go │ └── fields_spotinst_ocean_aks_np_auto_scaler.go ├── ocean_aks_np_health │ ├── consts.go │ └── fields_spotinst_ocean_aks_np_health.go ├── ocean_aks_np_logging │ ├── consts.go │ └── fields_spotinst_ocean_aks_np_logging.go ├── ocean_aks_np_node_count_limits │ ├── consts.go │ └── fields_spotinst_ocean_aks_np_node_count_limits.go ├── ocean_aks_np_node_pool_properties │ ├── consts.go │ └── fields_spotinst_ocean_aks_np_node_pool_properties.go ├── ocean_aks_np_scheduling │ ├── consts.go │ └── fields_spotinst_ocean_aks_np_scheduling.go ├── ocean_aks_np_strategy │ ├── consts.go │ └── fields_spotinst_ocean_aks_np_strategy.go ├── ocean_aks_np_virtual_node_group │ ├── consts.go │ └── fields_spotinst_ocean_aks_np_virtual_node_group.go ├── ocean_aks_np_virtual_node_group_auto_scale │ ├── consts.go │ └── fields_spotinst_ocean_aks_np_virtual_node_group_auto_scale.go ├── ocean_aks_np_virtual_node_group_node_count_limits │ ├── consts.go │ └── fields_spotinst_ocean_aks_np_virtual_node_group_node_count_limits.go ├── ocean_aks_np_virtual_node_group_node_pool_properties │ ├── consts.go │ └── fields_spotinst_ocean_aks_np_virtual_node_group_node_pool_properties.go ├── ocean_aks_np_virtual_node_group_scheduling │ ├── consts.go │ └── fields_spotinst_ocean_aks_np_virtual_node_group_scheduling.go ├── ocean_aks_np_virtual_node_group_strategy │ ├── consts.go │ └── fields_spotinst_ocean_aks_np_virtual_node_group_strategy.go ├── ocean_aks_np_virtual_node_group_vm_sizes │ ├── consts.go │ └── fields_spotinst_ocean_aks_np_virtual_node_group_vm_sizes.go ├── ocean_aks_np_vm_sizes │ ├── consts.go │ └── fields_spotinst_ocean_aks_np_vm_sizes.go ├── ocean_aws │ ├── consts.go │ └── fields_spotinst_ocean_aws.go ├── ocean_aws_auto_scaling │ ├── consts.go │ └── fields_spotinst_ocean_aws_auto_scaling.go ├── ocean_aws_extended_resource_definition │ ├── consts.go │ └── fields_spotinst_ocean_aws_extended_resource_definition.go ├── ocean_aws_instance_types │ ├── consts.go │ └── fields_spotinst_ocean_aws_instance_types.go ├── ocean_aws_launch_configuration │ ├── consts.go │ └── fields_spotinst_ocean_aws_launch_configuration.go ├── ocean_aws_launch_spec │ ├── consts.go │ └── fields_spotinst_ocean_aws_launch_spec.go ├── ocean_aws_logging │ ├── consts.go │ └── fields_spotinst_ocean_aws_logging.go ├── ocean_aws_scheduling │ ├── consts.go │ └── fields_spotinst_ocean_aws_scheduling.go ├── ocean_aws_strategy │ ├── consts.go │ └── fields_spotinst_ocean_aws_strategy.go ├── ocean_ecs │ ├── consts.go │ └── fields_spotinst_ocean_ecs.go ├── ocean_ecs_autoscaler │ ├── consts.go │ └── fields_spotinst_ocean_ecs_autoscaler.go ├── ocean_ecs_instance_types │ ├── consts.go │ └── fields_spotinst_ocean_ecs_instance_types.go ├── ocean_ecs_launch_spec │ ├── consts.go │ └── fields_spotinst_ocean_ecs_launch_spec.go ├── ocean_ecs_launch_specification │ ├── consts.go │ └── fields_spotinst_ocean_ecs_launch_specification.go ├── ocean_ecs_logging │ ├── consts.go │ └── fields_spotinst_ocean_ecs_logging.go ├── ocean_ecs_optimize_images │ ├── consts.go │ └── fields_spotinst_ocean_optimize_images.go ├── ocean_ecs_scheduling │ ├── consts.go │ └── fields_spotinst_ocean_ecs_scheduling.go ├── ocean_ecs_strategy │ ├── consts.go │ └── fields_spotinst_ocean_ecs_strategy.go ├── ocean_gke │ ├── consts.go │ └── fields_spotinst_ocean_gke.go ├── ocean_gke_auto_scaling │ ├── consts.go │ └── fields_spotinst_ocean_gke_auto_scaling.go ├── ocean_gke_import │ ├── consts.go │ └── fields_spotinst_ocean_gke_import.go ├── ocean_gke_import_autoscaler │ ├── consts.go │ └── fields_spotinst_ocean_gke_import_autoscaler.go ├── ocean_gke_import_launch_specification │ ├── consts.go │ └── fields_ocean_gke_import_launch_specification.go ├── ocean_gke_import_scheduling │ ├── consts.go │ └── fields_spotinst_ocean_gke_scheduling.go ├── ocean_gke_import_strategy │ ├── consts.go │ └── fields_spotinst_ocean_gke_strategy.go ├── ocean_gke_instance_types │ ├── consts.go │ └── fields_spotinst_ocean_gke_instance_types.go ├── ocean_gke_launch_spec │ ├── consts.go │ └── fields_spotinst_ocean_gke_launch_spec.go ├── ocean_gke_launch_spec_import │ ├── consts.go │ └── fields_spotinst_ocean_gke_launch_spec_import.go ├── ocean_gke_launch_spec_scheduling │ ├── consts.go │ └── fields_spotinst_ocean_gke_launch_spec_scheduling.go ├── ocean_gke_launch_spec_strategy │ ├── consts.go │ └── fields_spotinst_ocean_gke_launch_spec_strategy.go ├── ocean_gke_network_interface │ ├── consts.go │ └── fields_spotinst_elastigroup_gke_network_interface.go ├── ocean_gke_strategy │ ├── consts.go │ └── fields_spotinst_ocean_gke_strategy.go ├── ocean_right_sizing_rule │ ├── consts.go │ └── fields_spotinst_ocean_right_sizing_rule.go ├── ocean_spark │ ├── consts.go │ └── fields_spotinst_ocean_spark.go ├── ocean_spark_compute │ ├── consts.go │ └── fields_spotinst_ocean_spark_compute.go ├── ocean_spark_ingress │ ├── consts.go │ └── fields_spotinst_ocean_spark_ingress.go ├── ocean_spark_log_collection │ ├── consts.go │ └── fields_spotinst_ocean_spark_log_collection.go ├── ocean_spark_spark │ ├── consts.go │ └── fields_spotinst_ocean_spark_spark.go ├── ocean_spark_virtual_node_group │ ├── consts.go │ └── fields_spotinst_ocean_spark_virtual_node_group.go ├── ocean_spark_webhook │ ├── consts.go │ └── fields_spotinst_ocean_spark_webhook.go ├── ocean_spark_workspaces │ ├── consts.go │ └── fields_spotinst_ocean_spark_workspaces.go ├── oceancd_rollout_spec │ ├── consts.go │ └── fields_spotinst_oceancd_rollout_spec.go ├── oceancd_rollout_spec_spot_deployment │ ├── consts.go │ └── fields_spotinst_oceancd_rollout_spec_spot_deployment.go ├── oceancd_rollout_spec_strategy │ ├── consts.go │ └── fields_spotinst_oceancd_rollout_spec_strategy.go ├── oceancd_rollout_spec_traffic │ ├── consts.go │ └── fields_spotinst_oceancd_rollout_spec_traffic.go ├── oceancd_strategy_canary │ ├── consts.go │ └── fields_spotinst_oceancd_strategy_canary.go ├── oceancd_strategy_rolling │ ├── consts.go │ └── fields_spotinst_oceancd_strategy_rolling.go ├── oceancd_verification_provider │ ├── const.go │ └── fields_spotinst_oceancd_verification_provider.go ├── oceancd_verification_provider_cloud_watch │ ├── const.go │ └── fields_spotinst_oceancd_verification_provider_cloud_watch.go ├── oceancd_verification_provider_datadog │ ├── const.go │ └── fields_spotinst_oceancd_verification_provider_datadog.go ├── oceancd_verification_provider_jenkins │ ├── const.go │ └── fields_spotinst_oceancd_verification_provider_jenkins.go ├── oceancd_verification_provider_new_relic │ ├── const.go │ └── fields_spotinst_oceancd_verification_provider_new_relic.go ├── oceancd_verification_provider_prometheus │ ├── const.go │ └── fields_spotinst_oceancd_verification_provider_prometheus.go ├── oceancd_verification_template │ ├── consts.go │ └── fields_spotinst_oceancd_verification_provider.go ├── oceancd_verification_template_args │ ├── consts.go │ └── fields_spotinst_oceancd_verification_template_args.go ├── oceancd_verification_template_metrics │ ├── consts.go │ └── fields_spotinst_oceancd_verification_template_metrics.go ├── organization_policy │ ├── consts.go │ └── fields_spotinst_organization_policy.go ├── organization_programmatic_user │ ├── consts.go │ └── fields_spotinst_organization_programmatic_user.go ├── organization_user │ ├── consts.go │ └── fields_spotinst_organization_user.go ├── organization_user_group │ ├── consts.go │ └── fields_spotinst_organization_user_group.go ├── provider.go ├── provider_test.go ├── resource_spotinst_account.go ├── resource_spotinst_account_aws.go ├── resource_spotinst_credentials_aws.go ├── resource_spotinst_credentials_azure.go ├── resource_spotinst_credentials_gcp.go ├── resource_spotinst_data_integration.go ├── resource_spotinst_data_integration_test.go ├── resource_spotinst_elastigroup_aws.go ├── resource_spotinst_elastigroup_aws_beanstalk.go ├── resource_spotinst_elastigroup_aws_beanstalk_test.go ├── resource_spotinst_elastigroup_aws_suspend_processes.go ├── resource_spotinst_elastigroup_aws_suspend_processes_test.go ├── resource_spotinst_elastigroup_aws_test.go ├── resource_spotinst_elastigroup_azure_v3.go ├── resource_spotinst_elastigroup_azure_v3_test.go ├── resource_spotinst_elastigroup_gcp.go ├── resource_spotinst_elastigroup_gcp_test.go ├── resource_spotinst_elastigroup_gke.go ├── resource_spotinst_elastigroup_gke_test.go ├── resource_spotinst_elastigroup_health_check.go ├── resource_spotinst_elastigroup_health_check_test.go ├── resource_spotinst_managed_instance_aws.go ├── resource_spotinst_managed_instance_aws_test.go ├── resource_spotinst_mrscaler_aws.go ├── resource_spotinst_mrscaler_aws_test.go ├── resource_spotinst_mrscaler_aws_test.go.disabled ├── resource_spotinst_ocean_aks_np.go ├── resource_spotinst_ocean_aks_np_test.go ├── resource_spotinst_ocean_aks_np_virtual_node_group.go ├── resource_spotinst_ocean_aks_np_virtual_node_group_test.go ├── resource_spotinst_ocean_aws.go ├── resource_spotinst_ocean_aws_launch_spec.go ├── resource_spotinst_ocean_aws_launch_spec_test.go ├── resource_spotinst_ocean_aws_test.go ├── resource_spotinst_ocean_ecs.go ├── resource_spotinst_ocean_ecs_launch_spec.go ├── resource_spotinst_ocean_ecs_launch_spec_test.go ├── resource_spotinst_ocean_ecs_test.go ├── resource_spotinst_ocean_extended_resourcce_definition.go ├── resource_spotinst_ocean_extended_resourcce_definition_test.go ├── resource_spotinst_ocean_gke.go ├── resource_spotinst_ocean_gke_import.go ├── resource_spotinst_ocean_gke_import_test.go ├── resource_spotinst_ocean_gke_launch_spec.go ├── resource_spotinst_ocean_gke_launch_spec_import.go ├── resource_spotinst_ocean_gke_launch_spec_import_test.go ├── resource_spotinst_ocean_gke_launch_spec_test.go ├── resource_spotinst_ocean_right_sizing_rule.go ├── resource_spotinst_ocean_spark.go ├── resource_spotinst_ocean_spark_test.go ├── resource_spotinst_ocean_spark_virtual_node_group.go ├── resource_spotinst_ocean_spark_virtual_node_group_test.go ├── resource_spotinst_oceancd_rollout_spec.go ├── resource_spotinst_oceancd_strategy.go ├── resource_spotinst_oceancd_verification_provider.go ├── resource_spotinst_oceancd_verification_template.go ├── resource_spotinst_organization_policy.go ├── resource_spotinst_organization_policy_test.go ├── resource_spotinst_organization_programmatic_user.go ├── resource_spotinst_organization_programmatic_user_test.go ├── resource_spotinst_organization_user.go ├── resource_spotinst_organization_user_group.go ├── resource_spotinst_organization_user_group_test.go ├── resource_spotinst_organization_user_test.go ├── resource_spotinst_stateful_node_azure.go ├── resource_spotinst_stateful_node_azure_test.go ├── resource_spotinst_subscription.go ├── resource_spotinst_subscription_test.go └── subscription │ ├── consts.go │ └── fields_spotinst_subscription.go ├── tools.go └── version └── version.go /.github/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Code of Conduct 2 | 3 | HashiCorp Community Guidelines apply to you when interacting with the community here on GitHub and contributing code. 4 | 5 | Please read the full text at https://www.hashicorp.com/community-guidelines 6 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "Feature request" 3 | about: Suggest a new feature or other enhancement 4 | labels: kind/feature 5 | --- 6 | 7 | 14 | 15 | ### Terraform Version 16 | 17 | 25 | 26 | ### Description 27 | 28 | 29 | 30 | ### Use Cases 31 | 32 | 42 | 43 | ### Potential Terraform Configuration 44 | 45 | 53 | 54 | ### References 55 | 56 | 63 | 64 | ### Community Note 65 | 66 | * Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to help the community and maintainers prioritize this request. 67 | * If you are interested in working on this issue or have submitted a pull request, please leave a comment. 68 | 69 | 70 | -------------------------------------------------------------------------------- /.github/SUPPORT.md: -------------------------------------------------------------------------------- 1 | # Support 2 | 3 | Terraform is a mature project with a growing community. There are active, dedicated people willing to help you through various mediums. 4 | 5 | Take a look at those mediums listed at https://www.terraform.io/community.html 6 | -------------------------------------------------------------------------------- /.github/dependabot.yaml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "gomod" 4 | directory: "/" 5 | schedule: 6 | interval: "daily" 7 | labels: 8 | - "area/dependency" 9 | -------------------------------------------------------------------------------- /.github/stale.yaml: -------------------------------------------------------------------------------- 1 | # Number of days of inactivity before an issue becomes stale 2 | daysUntilStale: 180 3 | # Number of days of inactivity before a stale issue is closed 4 | daysUntilClose: 30 5 | # Issues with these labels will never be considered stale 6 | exemptLabels: 7 | - pinned 8 | - security 9 | # Label to use when marking an issue as stale 10 | staleLabel: lifecycle/stale 11 | # Comment to post when marking an issue as stale. Set to `false` to disable 12 | markComment: > 13 | This issue has been automatically marked as stale because it has not had 14 | recent activity. It will be closed if no further activity occurs. Thank you 15 | for your contributions. 16 | # Comment to post when closing a stale issue. Set to `false` to disable 17 | closeComment: false 18 | -------------------------------------------------------------------------------- /.github/workflows/ci.yaml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | - push 5 | - pull_request 6 | 7 | jobs: 8 | test: 9 | runs-on: ${{ matrix.os }} 10 | 11 | strategy: 12 | fail-fast: false 13 | matrix: 14 | os: [ubuntu-latest, macos-latest] 15 | make_target: [test, vet] 16 | 17 | steps: 18 | - name: Checkout 19 | uses: actions/checkout@v2 20 | 21 | - name: Set up Go 22 | uses: actions/setup-go@v2 23 | with: 24 | go-version: ~1.23 25 | 26 | - uses: actions/cache@v3 27 | with: 28 | path: ~/go/pkg/mod 29 | key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} 30 | restore-keys: | 31 | ${{ runner.os }}-go- 32 | 33 | # https://help.github.com/en/actions/reference/workflow-commands-for-github-actions 34 | - name: Set build variables 35 | run: | 36 | echo "MAKE_TARGET=${{ matrix.make_target }}" >> $GITHUB_ENV 37 | 38 | - name: Run ${{matrix.make_target}} 39 | run: | 40 | make $MAKE_TARGET 41 | 42 | lint: 43 | runs-on: ubuntu-latest 44 | container: bflad/tfproviderlint:0.29.0 45 | steps: 46 | - uses: actions/checkout@v2 47 | - run: | 48 | tfproviderlint \ 49 | -c 1 \ 50 | -AT001 \ 51 | -AT002 \ 52 | -S001 \ 53 | -S002 \ 54 | -S003 \ 55 | -S004 \ 56 | -S005 \ 57 | -S007 \ 58 | -S008 \ 59 | -S009 \ 60 | -S010 \ 61 | -S011 \ 62 | -S012 \ 63 | -S013 \ 64 | -S014 \ 65 | -S015 \ 66 | -S016 \ 67 | -S017 \ 68 | -S019 \ 69 | ./... 70 | 71 | docs: 72 | runs-on: ubuntu-latest 73 | steps: 74 | - name: Set up Go 75 | uses: actions/setup-go@v2 76 | with: 77 | go-version: ^1.23 78 | 79 | - name: Checkout 80 | uses: actions/checkout@v2 81 | 82 | - name: Docscheck 83 | run: | 84 | make docscheck 85 | -------------------------------------------------------------------------------- /.github/workflows/release.yaml: -------------------------------------------------------------------------------- 1 | name: Release 2 | 3 | on: 4 | push: 5 | tags: 6 | - 'v*' 7 | 8 | jobs: 9 | goreleaser: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - name: Checkout 13 | uses: actions/checkout@v2 14 | with: 15 | fetch-depth: 0 # required for the changelog to work correctly 16 | 17 | - name: Set up Go 18 | uses: actions/setup-go@v2 19 | with: 20 | go-version: ~1.23 21 | 22 | - name: Import GPG key 23 | id: import_gpg 24 | uses: paultyng/ghaction-import-gpg@v2.1.0 25 | env: 26 | GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} 27 | PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} 28 | 29 | - name: Run GoReleaser 30 | uses: goreleaser/goreleaser-action@v2 31 | with: 32 | version: latest 33 | args: release --clean 34 | env: 35 | GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} 36 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 37 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.dll 2 | *.exe 3 | .DS_Store 4 | example.tf 5 | terraform.tfplan 6 | terraform.tfstate 7 | terraform-provider-spotinst 8 | bin/ 9 | modules-dev/ 10 | /pkg/ 11 | website/.vagrant 12 | website/.bundle 13 | website/build 14 | website/node_modules 15 | .vagrant/ 16 | *.backup 17 | ./*.tfstate 18 | .terraform/ 19 | *.log 20 | *.bak 21 | *~ 22 | .*.swp 23 | .idea 24 | .vscode 25 | *.iml 26 | *.test 27 | *.iml 28 | website/vendor 29 | vendor/ 30 | 31 | # Test exclusions 32 | !command/test-fixtures/**/*.tfstate 33 | !command/test-fixtures/**/.terraform/ 34 | -------------------------------------------------------------------------------- /.goreleaser.yaml: -------------------------------------------------------------------------------- 1 | before: 2 | hooks: 3 | - go mod tidy 4 | 5 | builds: 6 | - env: 7 | # GoReleaser does not work with CGO, it could also complicate 8 | # usage by users in CI/CD systems like Terraform Cloud where 9 | # they are unable to install libraries. 10 | - CGO_ENABLED=0 11 | mod_timestamp: "{{ .CommitTimestamp }}" 12 | flags: 13 | - -trimpath 14 | ldflags: 15 | - "-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}" 16 | goos: 17 | - freebsd 18 | - windows 19 | - linux 20 | - darwin 21 | goarch: 22 | - amd64 23 | - "386" 24 | - arm 25 | - arm64 26 | ignore: 27 | - goos: darwin 28 | goarch: "386" 29 | - goos: windows 30 | goarch: arm64 31 | binary: "{{ .ProjectName }}_v{{ .Version }}" 32 | 33 | archives: 34 | - format: zip 35 | name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" 36 | 37 | checksum: 38 | name_template: "{{ .ProjectName }}_{{ .Version }}_SHA256SUMS" 39 | algorithm: sha256 40 | 41 | signs: 42 | - artifacts: checksum 43 | args: 44 | - "--batch" 45 | - "--local-user" 46 | - "{{ .Env.GPG_FINGERPRINT }}" # our signing key 47 | - "--output" 48 | - "${signature}" 49 | - "--detach-sign" 50 | - "${artifact}" 51 | 52 | changelog: 53 | sort: asc 54 | filters: 55 | exclude: 56 | - ^chore 57 | - ^ci 58 | - ^doc 59 | - ^test 60 | - Merge pull request 61 | - Merge branch 62 | 63 | release: 64 | draft: true 65 | -------------------------------------------------------------------------------- /GNUmakefile: -------------------------------------------------------------------------------- 1 | TEST?=./... 2 | PKGNAME?=spotinst 3 | 4 | # Use GNU Grep instead of BSD Grep on macOS 5 | UNAME_S := $(shell uname -s) 6 | ifeq ($(UNAME_S),Darwin) 7 | VERSION?=$(shell ggrep -oP '(?<=Version = ).+' version/version.go | xargs) 8 | else 9 | VERSION?=$(shell grep -oP '(?<=Version = ).+' version/version.go | xargs) 10 | endif 11 | RELEASE?=v$(VERSION) 12 | 13 | default: build 14 | 15 | .PHONY: build 16 | build: fmtcheck 17 | go install 18 | 19 | .PHONY: test 20 | test: fmtcheck 21 | go test $(TEST) -timeout=30s -parallel=4 22 | 23 | .PHONY: testacc 24 | testacc: fmtcheck 25 | TF_ACC=1 go test $(TEST) -v -count 1 -parallel 20 $(TESTARGS) -timeout 120m 26 | 27 | .PHONY: testcompile 28 | testcompile: 29 | @if [ "$(TEST)" = "./..." ]; then \ 30 | echo "ERROR: Set TEST to a specific package. For example,"; \ 31 | echo " make test-compile TEST=./$(PKGNAME)"; \ 32 | exit 1; \ 33 | fi 34 | go test -c $(TEST) $(TESTARGS) 35 | 36 | .PHONY: vet 37 | vet: 38 | go vet ./... 39 | 40 | .PHONY: fmt 41 | fmt: 42 | @gofmt -s -w ./$(PKGNAME) 43 | 44 | .PHONY: fmtcheck 45 | fmtcheck: 46 | @sh -c "'$(CURDIR)/scripts/gofmtcheck.sh'" 47 | 48 | .PHONY: depscheck 49 | depscheck: 50 | @echo "==> Checking source code with go mod tidy..." 51 | @go mod tidy 52 | @git diff --exit-code -- go.mod go.sum || \ 53 | (echo; echo "Unexpected difference in go.mod/go.sum files. Run 'go mod tidy' command or revert any go.mod/go.sum changes and commit."; exit 1) 54 | 55 | .PHONY: docs 56 | docs: tools 57 | @sh -c "'$(CURDIR)/scripts/generate-docs.sh'" 58 | 59 | .PHONY: docscheck 60 | docscheck: docs 61 | @tfplugindocs validate 62 | 63 | .PHONY: lint 64 | lint: 65 | @echo "==> Checking source code against linters..." 66 | @golint ./$(PKGNAME)/... 67 | @tfproviderlint \ 68 | -c 1 \ 69 | -AT001 \ 70 | -AT002 \ 71 | -S001 \ 72 | -S002 \ 73 | -S003 \ 74 | -S004 \ 75 | -S005 \ 76 | -S007 \ 77 | -S008 \ 78 | -S009 \ 79 | -S010 \ 80 | -S011 \ 81 | -S012 \ 82 | -S013 \ 83 | -S014 \ 84 | -S015 \ 85 | -S016 \ 86 | -S017 \ 87 | -S019 \ 88 | ./$(PKGNAME) 89 | 90 | .PHONY: tools 91 | tools: 92 | @go generate -tags tools tools.go 93 | 94 | .PHONY: release 95 | release: CI_JOB_NUMBER=$(shell read -p "» Last successful CI job number: " n && [[ -z "$$n" ]] && n="unknown"; echo $$n) 96 | release: 97 | @git commit -a -m "chore(release): $(RELEASE)" -m "CI_JOB_NUMBER: $(CI_JOB_NUMBER)" 98 | @git tag -f -m "chore(release): $(RELEASE)" $(RELEASE) 99 | @git push --follow-tags 100 | -------------------------------------------------------------------------------- /docs/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: "spotinst" 3 | page_title: "Provider: Spotinst" 4 | description: |- 5 | The Spotinst provider is used to interact with the resources supported by Spotinst. The provider needs to be configured with the proper credentials before it can be used. 6 | --- 7 | 8 | # Spotinst Provider 9 | 10 | The Spotinst provider is used to interact with the 11 | resources supported by Spotinst. The provider needs to be configured 12 | with the proper credentials before it can be used. 13 | 14 | Use the navigation to the left to read about the available resources. 15 | 16 | ## Example Usage 17 | 18 | ```hcl 19 | # Configure the Spotinst provider 20 | provider "spotinst" { 21 | token = "${var.spotinst_token}" 22 | account = "${var.spotinst_account}" 23 | } 24 | 25 | # Create an Elastigroup 26 | resource "spotinst_elastigroup_aws" "foo" { 27 | # ... 28 | } 29 | ``` 30 | 31 | ## Argument Reference 32 | 33 | The following arguments are supported: 34 | 35 | * `enabled` - (Optional) Boolean value to enable or disable the provider. Default is `true`. 36 | * `token` - (Required) A Personal API Access Token issued by Spotinst. It can be sourced from the `SPOTINST_TOKEN` environment variable. 37 | * `account` - (Optional) A valid Spotinst account ID. It can be sourced from the `SPOTINST_ACCOUNT` environment variable. 38 | * `feature_flags` - (Optional) Spotinst SDK feature flags. They can be sourced from the `SPOTINST_FEATURE_FLAGS` environment variable. 39 | 40 | ## Credential Precedence 41 | 42 | Credentials will be set given the following precedence: 43 | 1. credentials defined in the provider block of the template 44 | 2. credentials defined as environment variables 45 | 3. credentials defined in ~/.spotinst/credentials 46 | 47 | The credentials can be merge in the chain by enabling the `MergeCredentialsChain` feature flag. 48 | 49 | ```hcl 50 | provider "spotinst" { 51 | account = "${var.spotinst_account}" 52 | feature_flags = "MergeCredentialsChain=true" 53 | } 54 | ``` 55 | 56 | Please note that if you omit the Spotinst account, resources will be created using the default account for your organization. 57 | -------------------------------------------------------------------------------- /docs/resources/account.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: "spotinst" 3 | page_title: "Spotinst: account" 4 | subcategory: "Accounts" 5 | description: |- 6 | Create a Spotinst account resource. 7 | --- 8 | 9 | # spotinst\_account 10 | 11 | Provides a Spotinst account resource. 12 | 13 | ## Example Usage 14 | 15 | ```hcl 16 | # Create a Account 17 | resource "spotinst_account" "my_acct" { 18 | name="my_acct" 19 | } 20 | ``` 21 | 22 | ## Argument Reference 23 | 24 | The following arguments are supported: 25 | 26 | * `name` - (Required) Provide a name for your account. The account name must contain at least one character that is a-z or A-Z. 27 | 28 | ## Attributes Reference 29 | 30 | The following attributes are exported: 31 | 32 | * `id` - The account ID. 33 | -------------------------------------------------------------------------------- /docs/resources/account_aws.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: "spotinst" 3 | page_title: "Spotinst: account_aws" 4 | subcategory: "Accounts" 5 | description: |- 6 | Create a Spotinst account resource. 7 | --- 8 | 9 | # spotinst\_account\_aws 10 | 11 | Provides a Spotinst account resource. 12 | 13 | ## Example Usage 14 | 15 | ```hcl 16 | # Create a Account 17 | resource "spotinst_account_aws" "my_aws_acct" { 18 | name="my_aws_acct" 19 | } 20 | ``` 21 | 22 | ## Argument Reference 23 | 24 | The following arguments are supported: 25 | 26 | * `name` - (Required) Provide a name for your account. The account name must contain at least one character that is a-z or A-Z. 27 | 28 | ## Attributes Reference 29 | 30 | The following attributes are exported: 31 | 32 | * `id` - The account ID. 33 | -------------------------------------------------------------------------------- /docs/resources/credentials_aws.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: "spotinst" 3 | page_title: "Spotinst: credentials_aws" 4 | subcategory: "Accounts" 5 | description: |- 6 | Provides a Spotinst credential AWS resource. 7 | --- 8 | 9 | # spotinst\_credentials\_aws 10 | 11 | Provides a Spotinst credential AWS resource. 12 | 13 | ## Example Usage 14 | 15 | ```hcl 16 | # set credential AWS 17 | resource "spotinst_credentials_aws" "credential" { 18 | iamrole = "arn:aws:iam::1234567890:role/Spot_Iam_Role" 19 | account_id = "act-123456" 20 | } 21 | ``` 22 | 23 | ## Argument Reference 24 | 25 | The following arguments are supported: 26 | 27 | * `iamrole` - (Required) Provide the IAM Role ARN connected to another AWS account 922761411349 and with the latest Spot Policy - https://docs.spot.io/administration/api/spot-policy-in-aws 28 | * `account_id` - (Required) The ID of the account associated with your token. 29 | -------------------------------------------------------------------------------- /docs/resources/credentials_azure.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: "spotinst" 3 | page_title: "Spotinst: credentials_azure" 4 | subcategory: "Accounts" 5 | description: |- 6 | Provides a Spotinst credential Azure resource. 7 | --- 8 | 9 | # spotinst\_credentials\_azure 10 | 11 | Provides a Spotinst credential Azure resource. 12 | 13 | ## Example Usage 14 | 15 | ```hcl 16 | # set credential Azure 17 | resource "spotinst_credentials_azure" "credential" { 18 | account_id = "act-123456" 19 | client_id = "redacted" 20 | client_secret = "redacted" 21 | tenant_id = "redacted" 22 | subscription_id = "redacted" 23 | expiration_date = "2025-12-31T23:59:00.000Z" 24 | } 25 | ``` 26 | 27 | ## Argument Reference 28 | 29 | The following arguments are supported: 30 | 31 | * `account_id` - (Required) The ID of the account associated with your token. 32 | * `client_id` - (Required) Set the application ID. 33 | * `client_secret` - (Required) Set the key secret. 34 | * `tenant_id` - (Required) Set the directory ID. 35 | * `subscription_id` - (Required) Set the subscription ID. 36 | * `expiration_date` - (Required) Set the key secret expiration date. 37 | -------------------------------------------------------------------------------- /docs/resources/credentials_gcp.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: "spotinst" 3 | page_title: "Spotinst: credentials_gcp" 4 | subcategory: "Accounts" 5 | description: |- 6 | Provides a Spotinst credential GCP resource. 7 | --- 8 | 9 | # spotinst\_credentials\_gcp 10 | 11 | Provides a Spotinst credential GCP resource. 12 | 13 | ## Example Usage 14 | 15 | ```hcl 16 | # set credential GCP 17 | resource "spotinst_credentials_gcp" "cred_gcp" { 18 | account_id = "act-123456" 19 | type = "service_account" 20 | project_id = "demo-labs" 21 | private_key_id = "1234567890" 22 | private_key = "-----BEGIN PRIVATE KEY-----abcd1234-----END PRIVATE KEY-----" 23 | client_email = "demo-role-act-123456@demo-labs.iam.gserviceaccount.com" 24 | client_id = "1234567890" 25 | auth_uri = "https://accounts.google.com/o/oauth2/auth" 26 | token_uri = "https://oauth2.googleapis.com/token" 27 | auth_provider_x509_cert_url = "https://www.googleapis.com/oauth2/v1/certs" 28 | client_x509_cert_url = "https://www.googleapis.com/robot/v1/metadata/x509/demo-role-act-123456%40demo-labs.iam.gserviceaccount.com" 29 | 30 | lifecycle { 31 | ignore_changes = [ 32 | private_key, 33 | account_id 34 | ] 35 | }} 36 | ``` 37 | 38 | ## Argument Reference 39 | 40 | The following arguments are supported: 41 | 42 | * `account_id` - (Required) The ID of the account associated with your token. 43 | * `type` - (Required) Valid values - service_account. 44 | * `project_id` - (Required) Name of project in GCP. 45 | * `private_key_id` - (Required) Private key ID of JSON key created during prerequisites stage. 46 | * `private_key` - (Required) Private key of JSON key created during prerequisites stage. 47 | * `client_email` - (Required) Email associated with service account. 48 | * `client_id` - (Required) Client ID of service account. 49 | * `auth_uri` - (Required, Default: https://accounts.google.com/o/oauth2/auth) Authentication uri. 50 | * `token_uri` - (Required, Default: https://oauth2.googleapis.com/token) Token uri. 51 | * `auth_provider_x509_cert_url` - (Required, Default: https://www.googleapis.com/oauth2/v1/certs). 52 | * `client_x509_cert_url` - (Required) Should be in following format - "https://www.googleapis.com/robot/v1/metadata/x509/". 53 | -------------------------------------------------------------------------------- /docs/resources/data_integration.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: "spotinst" 3 | page_title: "Spotinst: data_integration" 4 | subcategory: "Data Integration" 5 | description: |- 6 | Manages an Data Integration resource. 7 | --- 8 | 9 | # spotinst\_data\_integration 10 | 11 | Provides a Spotinst Data Integration resource. 12 | 13 | ## Example Usage 14 | 15 | ```hcl 16 | resource "spotinst_data_integration" "example" { 17 | name = "foo" 18 | status = "enabled" 19 | s3 { 20 | bucketName = "terraform-test-do-not-delete" 21 | subdir = "terraform-test-data-integration" 22 | } 23 | } 24 | ``` 25 | 26 | ## Argument Reference 27 | 28 | The following arguments are supported: 29 | 30 | * `name`- (Required) The name of the data integration. 31 | * `status` - (Optional, only when update) Determines if this data integration is on or off. Valid values: `"enabled"`, `"disabled"` 32 | * `s3` - (Required) When vendor value is s3, the following fields are included: 33 | * `bucketName` - (Required) The name of the bucket to use. Your spot IAM Role policy needs to include s3:putObject permissions for this bucket. Can't be null. 34 | * `subdir` - (Optional) The subdirectory in which your files will be stored within the bucket. Adds the prefix subdir/ to new objects' keys. Can't be null or contain '/'. 35 | 36 | 37 | ## Attributes Reference 38 | 39 | In addition to all arguments above, the following attributes are exported: 40 | * `id` - The Spotinst Data Integration ID. 41 | -------------------------------------------------------------------------------- /docs/resources/elastigroup_aws_suspension.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: "spotinst" 3 | page_title: "Spotinst: elastigroup_aws_suspension" 4 | subcategory: "Elastigroup" 5 | description: |- 6 | Provides a process suspension to Spotinst AWS group resources. 7 | --- 8 | 9 | # spotinst\_elastigroup\_aws\_suspension 10 | 11 | Suspend AWS Elastigroup processes. This resource provide the capability of 12 | suspending elastigroup processes using Terraform. 13 | 14 | For supported processes please visit: [Suspend Processes API reference](https://help.spot.io/spotinst-api/elastigroup/amazon-web-services/suspend-processes/) 15 | ## Example Usage 16 | 17 | ```hcl 18 | # Create a suspension for Elastigroup 19 | resource "spotinst_elastigroup_aws_suspension" "resource_name" { 20 | group_id = "sig-12345678" 21 | 22 | suspension { 23 | name = "OUT_OF_STRATEGY" 24 | } 25 | 26 | suspension { 27 | name = "REVERT_PREFERRED" 28 | } 29 | 30 | suspension { 31 | name = "PREVENTIVE_REPLACEMENT" 32 | } 33 | } 34 | ``` 35 | 36 | ## Argument Reference 37 | 38 | The following arguments are supported: 39 | 40 | * `group_id` - (Required; string) Elastigroup ID to apply the suspensions on. 41 | * `suspension` - (Required; at least one block is required) block of single process to suspend. 42 | * `name` - (Required; string) The name of process to suspend. Valid values: `"AUTO_HEALING" , "OUT_OF_STRATEGY", "PREVENTIVE_REPLACEMENT", "REVERT_PREFERRED", or "SCHEDULING"`. 43 | -------------------------------------------------------------------------------- /docs/resources/health_check.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: "spotinst" 3 | page_title: "Spotinst: health_check" 4 | subcategory: "Elastigroup" 5 | description: |- 6 | Provides a Spotinst Health Check resource. 7 | --- 8 | 9 | # spotinst\_health\_check 10 | 11 | Provides a Spotinst Health Check resource. 12 | 13 | ## Example Usage 14 | 15 | ```hcl 16 | resource "spotinst_health_check" "http_check" { 17 | name = "terraform_healt_cheack" 18 | resource_id = "sig-123" 19 | 20 | check { 21 | protocol = "http" 22 | endpoint = "http://endpoint.com" 23 | port = 1337 24 | interval = 10 25 | timeout = 10 26 | healthy = 1 27 | unhealthy = 1 28 | } 29 | 30 | proxy_address = "http://proxy.com" 31 | proxy_port = 80 32 | 33 | } 34 | ``` 35 | 36 | ## Argument Reference 37 | 38 | The following arguments are supported: 39 | 40 | * `name` - (Optional) The name of the health check. 41 | * `resource_id` - (Required) The ID of the resource to check. 42 | * `check` - (Required) Describes the check to execute. 43 | 44 | * `protocol` - (Required) The protocol to use to connect with the instance. Valid values: http, https. 45 | * `endpoint` - (Required) The destination for the request. 46 | * `port` - (Required) The port to use to connect with the instance. 47 | * `interval` - (Required) The amount of time (in seconds) between each health check (minimum: 10). 48 | * `timeout` - (Required) the amount of time (in seconds) to wait when receiving a response from the health check. 49 | 50 | * `threshold` - (Required) 51 | 52 | * `healthy` - (Required) The number of consecutive successful health checks that must occur before declaring an instance healthy. 53 | * `unhealthy` - (Required) The number of consecutive failed health checks that must occur before declaring an instance unhealthy. 54 | 55 | * `proxy` - (Required) 56 | 57 | * `addr` - (Required) The public hostname / IP where you installed the Spotinst HCS. 58 | * `port` - (Required) The port of the Spotinst HCS (default: 80). 59 | 60 | ## Attributes Reference 61 | 62 | The following attributes are exported: 63 | 64 | * `id` - The Health Check ID. 65 | -------------------------------------------------------------------------------- /docs/resources/ocean_aws_extended_resource_definition.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: "spotinst" 3 | page_title: "Spotinst: ocean_aws_extended_resource_definition" 4 | subcategory: "Ocean" 5 | description: |- 6 | Manages an Ocean extended resource definition resource. 7 | --- 8 | 9 | # spotinst\_ocean\_aws\_extended\_resource\_definition 10 | 11 | Provides a Spotinst Ocean AWS Extended Resource Definition resource. 12 | 13 | ## Example Usage 14 | 15 | ```hcl 16 | resource "spotinst_ocean_aws_extended_resource_definition" "example" { 17 | name = "terraform_extended_resource_definition" 18 | resource_mapping = { 19 | "c3.large" = "2Ki" 20 | "c3.xlarge" = "4Ki" 21 | } 22 | } 23 | ``` 24 | 25 | ## Argument Reference 26 | 27 | The following arguments are supported: 28 | 29 | * `name` - (Required) The extended resource name as should be requested by your pods and registered to the nodes. Cannot be updated. 30 | The name should be a valid Kubernetes extended resource name. 31 | * `resource_mapping` - (Required) A mapping between AWS instanceType or * as default and its value for the given extended resource. 32 | 33 | 34 | ## Attributes Reference 35 | 36 | In addition to all arguments above, the following attributes are exported: 37 | * `id` - The Spotinst Extended Resource Definition ID. 38 | -------------------------------------------------------------------------------- /docs/resources/ocean_gke_launch_spec_import.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: "spotinst" 3 | page_title: "Spotinst: ocean_gke_launch_spec_import" 4 | subcategory: "Ocean" 5 | description: |- 6 | Provides a Spotinst Ocean Launch Spec Import resource using GKE. 7 | --- 8 | 9 | # spotinst\_ocean\_gke\_launch\_spec_import (legacy) 10 | 11 | Manages a custom Spotinst Ocean GKE Launch Spec Import resource. 12 | 13 | ## Example Usage 14 | 15 | ```hcl 16 | resource "spotinst_ocean_gke_launch_spec_import" "example" { 17 | ocean_id = "o-123456" 18 | node_pool_name = "default-pool" 19 | } 20 | ``` 21 | ``` 22 | output "ocean_launchspec_id" { 23 | value = spotinst_ocean_gke_launch_spec_import.example.id 24 | } 25 | ``` 26 | 27 | ## Argument Reference 28 | 29 | The following arguments are supported: 30 | 31 | * `ocean_id` - (Required) The Ocean cluster ID required for launchSpec create. 32 | * `node_pool_name` - (Required) The node pool you wish to use in your launchSpec. 33 | 34 | ## Attributes Reference 35 | 36 | In addition to all arguments above, the following attributes are exported: 37 | * `id` - The Spotinst LaunchSpec ID. -------------------------------------------------------------------------------- /docs/resources/ocean_spark_virtual_node_group.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: "spotinst" 3 | page_title: "Spotinst: ocean_spark_virtual_node_group" 4 | subcategory: "Ocean" 5 | description: |- 6 | Provides a Spotinst Ocean Spark Virtual Node Group resource 7 | --- 8 | 9 | # ocean_spark_virtual_node_group 10 | 11 | Manage a dedicated Spotinst Ocean Spark Virtual Node Group resource 12 | 13 | ## Prerequisites 14 | 15 | An existing Ocean cluster and Ocean VNG is required by this resource 16 | 17 | ## Example Usage 18 | 19 | ```hcl 20 | provider "spotinst" { 21 | token = "redacted" 22 | account = "redacted" 23 | } 24 | 25 | resource "spotinst_ocean_spark_virtual_node_group" "example" { 26 | virtual_node_group_id = "vng_id" 27 | ocean_spark_cluster_id = "cluster_id" 28 | } 29 | ``` 30 | 31 | 32 | ## Schema 33 | 34 | ### Required 35 | 36 | - **ocean_spark_cluster_id** (String) 37 | - **virtual_node_group_id** (String) 38 | 39 | 40 | -------------------------------------------------------------------------------- /docs/resources/organization_policy.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: "spotinst" 3 | page_title: "Spotinst: organization_policy" 4 | subcategory: "Organization" 5 | description: |- 6 | Provides a Spotinst access policy. 7 | --- 8 | 9 | # spotinst\_organization\_policy 10 | 11 | Provides a Spotinst access policy. 12 | 13 | ## Example Usage 14 | 15 | ```hcl 16 | resource "spotinst_organization_policy" "terraform_policy" { 17 | name = "test-policy" 18 | description = "policy by terraform" 19 | policy_content { 20 | statements { 21 | actions = ["ocean:deleteCluster"] 22 | effect = "DENY" 23 | resources = ["o-abcd1234","o-defg6789"] 24 | } 25 | statements { 26 | actions = ["ocean:createCluster"] 27 | effect = "DENY" 28 | resources = ["o-fhau4752","o-761owf4r3"] 29 | } 30 | } 31 | } 32 | ``` 33 | 34 | ## Argument Reference 35 | 36 | The following arguments are supported: 37 | 38 | * `name` - (Required) Name of the Policy. 39 | * `description` - (Optional) Short description of policy. 40 | * `policy_content` - (Required) Set permissions objects list. 41 | * `statements` - (Required) List of permissions statements. 42 | * `actions` - (Required) Set a list of required actions for this permissions statement. 43 | Full list of actions can be found in [https://docs.spot.io/account-user-management/user-management/access-policies-actions/](https://docs.spot.io/account-user-management/user-management/access-policies-actions/). 44 | * `effect` - (Required) Valid values "ALLOW", "DENY". 45 | * `resources` - (Required) Set a list of resources IDs. In order to include all resources in this statement - use "*". 46 | 47 | ## Attributes Reference 48 | 49 | The following attributes are exported: 50 | 51 | * `id` - The Spotinst Policy ID. 52 | -------------------------------------------------------------------------------- /docs/resources/organization_programmatic_user.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: "spotinst" 3 | page_title: "Spotinst: organization_programmatic_user" 4 | subcategory: "Organization" 5 | description: |- 6 | Provides a Spotinst programmatic user in the creator's organization. 7 | --- 8 | 9 | # spotinst\_organization\_programmatic\_user 10 | 11 | Provides a Spotinst programmatic user in the creator's organization. 12 | 13 | ## Example Usage 14 | 15 | ```hcl 16 | resource "spotinst_organization_programmatic_user" "terraform_prog_user" { 17 | name = "test-prog-user" 18 | description = "creating programmatic user" 19 | policies { 20 | policy_id = "pol-g75d8c06" 21 | policy_account_ids = ["act-a1b2c3d4"] 22 | } 23 | /*accounts { 24 | account_id = "act-a1b2c3d4" 25 | account_role = "viewer" 26 | }*/ 27 | user_group_ids=["ugr-abcd1234","ugr-defg8763"] 28 | // account and policies are exclusive 29 | } 30 | ``` 31 | 32 | ## Argument Reference 33 | 34 | The following arguments are supported: 35 | 36 | * `name` - (Required) Name of the programmatic user. 37 | * `description` - (Optional) Brief description of the user. 38 | * `policies` - (Optional) All the policies the programmatic user will have access to. 39 | If used - Cannot be empty. 40 | * `policy_account_ids` - (Optional) A list of the accounts that the policy should be 41 | enforced for the user. 42 | * `policy_id` - (Required) Policy ID the programmatic user will have access to. 43 | * `accounts` - (Optional) All the accounts the programmatic user will have access to. 44 | If used - Cannot be empty. 45 | * `account_id` - (Required) Account ID the programmatic user will have access to. 46 | * `account_role` - (Required) (Enum: `"viewer", "editor") Role to be associated with the 47 | programmatic user for this account. 48 | * `user_group_ids` - (Optional) A list of the user groups to register the given user to (should be existing user groups only) 49 | 50 | ## Attributes Reference 51 | 52 | The following attributes are exported: 53 | 54 | * `id` - The Spotinst Progammatic User ID. 55 | -------------------------------------------------------------------------------- /docs/resources/organization_user.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: "spotinst" 3 | page_title: "Spotinst: organization_user" 4 | subcategory: "Organization" 5 | description: |- 6 | Provides a Spotinst User in the creator's organization. 7 | --- 8 | 9 | # spotinst\_organization\_user 10 | 11 | Provides a Spotinst User in the creator's organization. 12 | 13 | ## Example Usage 14 | 15 | ```hcl 16 | resource "spotinst_organization_user" "terraform_user" { 17 | email = "abc@xyz.com" 18 | first_name = "test" 19 | last_name = "user" 20 | password = "testUser@123" 21 | role = "viewer" 22 | policies{ 23 | policy_id = "pol-abcd1236" 24 | policy_account_ids = ["act-abcf4245"] 25 | } 26 | user_group_ids=["ugr-abcd1234","ugr-defg8763"] 27 | } 28 | ``` 29 | 30 | ## Argument Reference 31 | 32 | The following arguments are supported: 33 | 34 | * `email` - (Required) Email. 35 | * `first_name` - (Required) The first name of the user. 36 | * `last_name` - (Required) The last name of the user. 37 | * `password` - (Optional) Password. 38 | * `role` - (Optional) User's role. 39 | * `policies` - (Optional) The policies to register under the given group 40 | (should be existing policies only). 41 | * `account_ids` - (Required) A list of accounts to register with the assigned under the 42 | given group (should be existing accounts only). 43 | * `policy_id` - (Required) A policy to register under the given group 44 | (should be existing policy only). 45 | * `user_group_ids` - (Optional) A list of the user groups to register the given user to (should be existing user groups only) 46 | 47 | ## Attributes Reference 48 | 49 | The following attributes are exported: 50 | 51 | * `id` - The Spotinst User ID. 52 | -------------------------------------------------------------------------------- /docs/resources/organization_user_group.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: "spotinst" 3 | page_title: "Spotinst: organization_user_group" 4 | subcategory: "Organization" 5 | description: |- 6 | Provides a Spotinst user-group of your Spot organization. 7 | --- 8 | 9 | # spotinst\_organization\_user\_group 10 | 11 | Provides a Spotinst user-group of your Spot organization. 12 | 13 | ## Example Usage 14 | 15 | ```hcl 16 | resource "spotinst_organization_user_group" "terraform_user_group" { 17 | name = "test_user_group" 18 | description = "user group by terraform" 19 | user_ids = ["u-372gf6ae"] 20 | policies { 21 | account_ids = ["act-a1b2c3d4"] 22 | policy_id = "pol-vv7d8c06" 23 | } 24 | } 25 | ``` 26 | 27 | ## Argument Reference 28 | 29 | The following arguments are supported: 30 | 31 | * `name` - (Required) User group name. 32 | * `description` - (Optional) User group description. 33 | * `user_ids` - (Optional) The users to register under the created group 34 | (should be existing users only). 35 | * `policies` - (Optional) The policies to register under the given group 36 | (should be existing policies only). 37 | * `account_ids` - (Required) A list of accounts to register with the assigned under the 38 | given group (should be existing accounts only). 39 | * `policy_id` - (Required) A policy to register under the given group 40 | (should be existing policy only). 41 | 42 | ## Attributes Reference 43 | 44 | The following attributes are exported: 45 | 46 | * `id` - The Spotinst User Group ID. 47 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "context" 5 | "flag" 6 | "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" 7 | "github.com/hashicorp/terraform-plugin-sdk/v2/plugin" 8 | "github.com/spotinst/terraform-provider-spotinst/spotinst" 9 | "log" 10 | ) 11 | 12 | func main() { 13 | var debugMode bool 14 | flag.BoolVar(&debugMode, "debug", false, "set to true to run the provider with support for debuggers like delve") 15 | flag.Parse() 16 | 17 | opts := &plugin.ServeOpts{ 18 | ProviderFunc: func() *schema.Provider { 19 | return spotinst.Provider() 20 | }, 21 | } 22 | 23 | if debugMode { 24 | err := plugin.Debug(context.Background(), "terraform-spotinst/local/spotinst", opts) 25 | if err != nil { 26 | log.Fatal(err.Error()) 27 | } 28 | return 29 | } 30 | 31 | plugin.Serve(opts) 32 | } 33 | -------------------------------------------------------------------------------- /scripts/changelog-links.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This script rewrites [GH-nnnn]-style references in the CHANGELOG.md file to 4 | # be Markdown links to the given github issues. 5 | # 6 | # This is run during releases so that the issue references in all of the 7 | # released items are presented as clickable links, but we can just use the 8 | # easy [GH-nnnn] shorthand for quickly adding items to the "Unrelease" section 9 | # while merging things between releases. 10 | 11 | set -e 12 | 13 | if [[ ! -f CHANGELOG.md ]]; then 14 | echo "ERROR: CHANGELOG.md not found in pwd." 15 | echo "Please run this from the root of the terraform provider repository" 16 | exit 1 17 | fi 18 | 19 | if [[ `uname` == "Darwin" ]]; then 20 | echo "Using BSD sed" 21 | SED="sed -i.bak -E -e" 22 | else 23 | echo "Using GNU sed" 24 | SED="sed -i.bak -r -e" 25 | fi 26 | 27 | PROVIDER_URL="https:\/\/github.com\/spotinst\/terraform-provider-spotinst\/issues" 28 | 29 | $SED "s/GH-([0-9]+)/\[#\1\]\($PROVIDER_URL\/\1\)/g" -e 's/\[\[#(.+)([0-9])\)]$/(\[#\1\2))/g' CHANGELOG.md 30 | 31 | rm CHANGELOG.md.bak 32 | -------------------------------------------------------------------------------- /scripts/errcheck.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Check gofmt 4 | echo "==> Checking for unchecked errors..." 5 | 6 | if ! which errcheck > /dev/null; then 7 | echo "==> Installing errcheck..." 8 | go get -u github.com/kisielk/errcheck 9 | fi 10 | 11 | err_files=$(errcheck -ignoretests \ 12 | -ignore 'github.com/hashicorp/terraform/helper/schema:Set' \ 13 | -ignore 'bytes:.*' \ 14 | -ignore 'io:Close|Write' \ 15 | $(go list ./...| grep -v /vendor/)) 16 | 17 | if [[ -n ${err_files} ]]; then 18 | echo 'Unchecked errors found in the following places:' 19 | echo "${err_files}" 20 | echo "Please handle returned errors. You can check directly with \`make errcheck\`" 21 | exit 1 22 | fi 23 | 24 | exit 0 25 | -------------------------------------------------------------------------------- /scripts/generate-docs.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Generate the documentation using tfplugindocs and 4 | # remove changes to files that shouldn't change. 5 | 6 | # Legacy files that currently shouldn't be autogenerated. 7 | exclude_files=( 8 | "docs/index.md" 9 | "docs/resources/elastigroup_aws.md" 10 | "docs/resources/elastigroup_aws_beanstalk.md" 11 | "docs/resources/elastigroup_aws_suspension.md" 12 | "docs/resources/elastigroup_azure.md" 13 | "docs/resources/elastigroup_gcp.md" 14 | "docs/resources/elastigroup_gke.md" 15 | "docs/resources/health_check.md" 16 | "docs/resources/stateful_node_aws.md" 17 | "docs/resources/mrscaler_aws.md" 18 | "docs/resources/ocean_aws.md" 19 | "docs/resources/ocean_aws_launch_spec.md" 20 | "docs/resources/ocean_ecs.md" 21 | "docs/resources/ocean_ecs_launch_spec.md" 22 | "docs/resources/ocean_gke_import.md" 23 | "docs/resources/ocean_gke_launch_spec.md" 24 | "docs/resources/ocean_gke_launch_spec_import.md" 25 | "docs/resources/subscription.md" 26 | "docs/resources/data_integration.md" 27 | "docs/resources/stateful_node_azure.md" 28 | ) 29 | 30 | # Check if manual changes were made to any excluded files and exit. 31 | # Otherwise, these will be lost with `tfplugindocs`. 32 | git_status="$(git status --porcelain "${exclude_files[@]}")" 33 | if [[ -n "${git_status}" ]]; then 34 | cat < Uncommitted changes were detected to the following files. 36 | !> These aren't autogenerated, please commit or stash these changes and try again. 37 | EOF 38 | echo "${git_status}" 39 | exit 1 40 | fi 41 | 42 | # Generate documentation. 43 | tfplugindocs 44 | 45 | # Remove deprecated resources. 46 | rm docs/resources/multai_* 47 | 48 | # Remove the changes to files we don't autogenerate. 49 | git checkout HEAD -- "${exclude_files[@]}" 50 | -------------------------------------------------------------------------------- /scripts/gofmtcheck.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Check gofmt 4 | echo "==> Checking that code complies with gofmt requirements..." 5 | gofmt_files=$(gofmt -l `find . -name '*.go' | grep -v vendor`) 6 | if [[ -n ${gofmt_files} ]]; then 7 | echo 'gofmt needs running on the following files:' 8 | echo "${gofmt_files}" 9 | echo "You can use the command: \`make fmt\` to reformat code." 10 | exit 1 11 | fi 12 | 13 | exit 0 14 | -------------------------------------------------------------------------------- /scripts/gogetcookie.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | touch ~/.gitcookies 4 | chmod 0600 ~/.gitcookies 5 | 6 | git config --global http.cookiefile ~/.gitcookies 7 | 8 | tr , \\t <<\__END__ >>~/.gitcookies 9 | .googlesource.com,TRUE,/,TRUE,2147483647,o,git-paul.hashicorp.com=1/z7s05EYPudQ9qoe6dMVfmAVwgZopEkZBb1a2mA5QtHE 10 | __END__ 11 | -------------------------------------------------------------------------------- /spotinst/account/consts.go: -------------------------------------------------------------------------------- 1 | package account 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Name commons.FieldName = "name" 7 | ) 8 | -------------------------------------------------------------------------------- /spotinst/account/fields_spotinst_account.go: -------------------------------------------------------------------------------- 1 | package account 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" 7 | "github.com/spotinst/spotinst-sdk-go/spotinst" 8 | "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 9 | ) 10 | 11 | func Setup(fieldsMap map[commons.FieldName]*commons.GenericField) { 12 | fieldsMap[Name] = commons.NewGenericField( 13 | commons.Account, 14 | Name, 15 | &schema.Schema{ 16 | Type: schema.TypeString, 17 | Required: true, 18 | }, 19 | func(resourceObject interface{}, resourceData *schema.ResourceData, meta interface{}) error { 20 | accountWrapper := resourceObject.(*commons.AccountWrapper) 21 | account := accountWrapper.GetAccount() 22 | var value *string = nil 23 | if account.Name != nil { 24 | value = account.Name 25 | } 26 | if err := resourceData.Set(string(Name), value); err != nil { 27 | return fmt.Errorf(string(commons.FailureFieldReadPattern), string(Name), err) 28 | } 29 | return nil 30 | }, 31 | func(resourceObject interface{}, resourceData *schema.ResourceData, meta interface{}) error { 32 | accountWrapper := resourceObject.(*commons.AccountWrapper) 33 | account := accountWrapper.GetAccount() 34 | account.SetName(spotinst.String(resourceData.Get(string(Name)).(string))) 35 | return nil 36 | }, 37 | func(resourceObject interface{}, resourceData *schema.ResourceData, meta interface{}) error { 38 | accountWrapper := resourceObject.(*commons.AccountWrapper) 39 | account := accountWrapper.GetAccount() 40 | account.SetName(spotinst.String(resourceData.Get(string(Name)).(string))) 41 | return nil 42 | }, 43 | nil, 44 | ) 45 | 46 | } 47 | -------------------------------------------------------------------------------- /spotinst/account_aws/consts.go: -------------------------------------------------------------------------------- 1 | package account_aws 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Name commons.FieldName = "name" 7 | ) 8 | -------------------------------------------------------------------------------- /spotinst/account_aws/fields_spotinst_account_aws.go: -------------------------------------------------------------------------------- 1 | package account_aws 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" 7 | "github.com/spotinst/spotinst-sdk-go/spotinst" 8 | "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 9 | ) 10 | 11 | func Setup(fieldsMap map[commons.FieldName]*commons.GenericField) { 12 | fieldsMap[Name] = commons.NewGenericField( 13 | commons.AccountAWS, 14 | Name, 15 | &schema.Schema{ 16 | Type: schema.TypeString, 17 | Required: true, 18 | ForceNew: true, 19 | }, 20 | func(resourceObject interface{}, resourceData *schema.ResourceData, meta interface{}) error { 21 | accountWrapper := resourceObject.(*commons.AWSAccountWrapper) 22 | account := accountWrapper.GetAccount() 23 | var value *string = nil 24 | if account.Name != nil { 25 | value = account.Name 26 | } 27 | if err := resourceData.Set(string(Name), value); err != nil { 28 | return fmt.Errorf(string(commons.FailureFieldReadPattern), string(Name), err) 29 | } 30 | return nil 31 | }, 32 | func(resourceObject interface{}, resourceData *schema.ResourceData, meta interface{}) error { 33 | accountWrapper := resourceObject.(*commons.AWSAccountWrapper) 34 | account := accountWrapper.GetAccount() 35 | account.SetName(spotinst.String(resourceData.Get(string(Name)).(string))) 36 | return nil 37 | }, 38 | func(resourceObject interface{}, resourceData *schema.ResourceData, meta interface{}) error { 39 | accountWrapper := resourceObject.(*commons.AWSAccountWrapper) 40 | account := accountWrapper.GetAccount() 41 | account.SetName(spotinst.String(resourceData.Get(string(Name)).(string))) 42 | return nil 43 | }, 44 | nil, 45 | ) 46 | } 47 | -------------------------------------------------------------------------------- /spotinst/azure_v3/elastigroup_azure/consts.go: -------------------------------------------------------------------------------- 1 | package elastigroup_azure 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Name commons.FieldName = "name" 7 | Region commons.FieldName = "region" 8 | ResourceGroupName commons.FieldName = "resource_group_name" 9 | MaxSize commons.FieldName = "max_size" 10 | MinSize commons.FieldName = "min_size" 11 | DesiredCapacity commons.FieldName = "desired_capacity" 12 | OS commons.FieldName = "os" 13 | Description commons.FieldName = "description" 14 | Zones commons.FieldName = "zones" 15 | PreferredZones commons.FieldName = "preferred_zones" 16 | ) 17 | -------------------------------------------------------------------------------- /spotinst/azure_v3/elastigroup_azure_extension/consts.go: -------------------------------------------------------------------------------- 1 | package elastigroup_azure_extension 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Extensions commons.FieldName = "extensions" 7 | APIVersion commons.FieldName = "api_version" 8 | MinorVersionAutoUpgrade commons.FieldName = "minor_version_auto_upgrade" 9 | EnableAutomaticUpgrade commons.FieldName = "enable_automatic_upgrade" 10 | Name commons.FieldName = "name" 11 | Publisher commons.FieldName = "publisher" 12 | Type commons.FieldName = "type" 13 | ProtectedSettings commons.FieldName = "protected_settings" 14 | PublicSettings commons.FieldName = "public_settings" 15 | 16 | ProtectedSettingsFromKeyVault commons.FieldName = "protected_settings_from_key_vault" 17 | SecretUrl commons.FieldName = "secret_url" 18 | SourceVault commons.FieldName = "source_vault" 19 | ) 20 | -------------------------------------------------------------------------------- /spotinst/azure_v3/elastigroup_azure_health/consts.go: -------------------------------------------------------------------------------- 1 | package elastigroup_azure_health 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Health commons.FieldName = "health" 7 | HealthCheckTypes commons.FieldName = "health_check_types" 8 | GracePeriod commons.FieldName = "grace_period" 9 | UnhealthyDuration commons.FieldName = "unhealthy_duration" 10 | AutoHealing commons.FieldName = "auto_healing" 11 | ) 12 | -------------------------------------------------------------------------------- /spotinst/azure_v3/elastigroup_azure_image/consts.go: -------------------------------------------------------------------------------- 1 | package elastigroup_azure_image 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Prefix = "azure_image_" 7 | ) 8 | 9 | const ( 10 | Image commons.FieldName = "image" 11 | 12 | // marketplace image 13 | Marketplace commons.FieldName = "marketplace" 14 | Publisher commons.FieldName = "publisher" 15 | Offer commons.FieldName = "offer" 16 | Sku commons.FieldName = "sku" 17 | Version commons.FieldName = "version" 18 | 19 | // custom image 20 | Custom commons.FieldName = "custom" 21 | ResourceGroupName commons.FieldName = "resource_group_name" 22 | ImageName commons.FieldName = "image_name" 23 | 24 | // gallery image 25 | GalleryImage commons.FieldName = "gallery_image" 26 | GalleryName commons.FieldName = "gallery_name" 27 | GalleryImageName commons.FieldName = "image_name" 28 | GalleryResourceGroupName commons.FieldName = "resource_group_name" 29 | GalleryVersion commons.FieldName = "version" 30 | SpotAccountId commons.FieldName = "spot_account_id" 31 | ) 32 | -------------------------------------------------------------------------------- /spotinst/azure_v3/elastigroup_azure_launchspecification/consts.go: -------------------------------------------------------------------------------- 1 | package elastigroup_azure_launchspecification 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | type TagField string 6 | 7 | const ( 8 | TagKey TagField = "key" 9 | TagValue TagField = "value" 10 | ) 11 | 12 | const ( 13 | CustomData commons.FieldName = "custom_data" 14 | ShutdownScript commons.FieldName = "shutdown_script" 15 | UserData commons.FieldName = "user_data" 16 | VmNamePrefix commons.FieldName = "vm_name_prefix" 17 | ) 18 | 19 | const ( 20 | ManagedServiceIdentity commons.FieldName = "managed_service_identity" 21 | ManagedServiceIdentityResourceGroupName commons.FieldName = "resource_group_name" 22 | ManagedServiceIdentityName commons.FieldName = "name" 23 | Tags commons.FieldName = "tags" 24 | ) 25 | 26 | const ( 27 | DataDisk commons.FieldName = "data_disk" 28 | DataDiskLUN commons.FieldName = "lun" 29 | DataDiskSizeGB commons.FieldName = "size_gb" 30 | DataDiskType commons.FieldName = "type" 31 | ) 32 | 33 | const ( 34 | OsDisk commons.FieldName = "os_disk" 35 | OsDiskSizeGB commons.FieldName = "size_gb" 36 | OsDiskType commons.FieldName = "type" 37 | ) 38 | 39 | const ( 40 | BootDiagnostics commons.FieldName = "boot_diagnostics" 41 | BootDiagnosticsIsEnabled commons.FieldName = "is_enabled" 42 | BootDiagnosticsStorageURL commons.FieldName = "storage_url" 43 | BootDiagnosticsType commons.FieldName = "type" 44 | ) 45 | 46 | const ( 47 | Security commons.FieldName = "security" 48 | SecureBootEnabled commons.FieldName = "secure_boot_enabled" 49 | SecurityType commons.FieldName = "security_type" 50 | VTpmEnabled commons.FieldName = "vtpm_enabled" 51 | ConfidentialOsDiskEncryption commons.FieldName = "confidential_os_disk_encryption" 52 | EncryptionAtHost commons.FieldName = "encryption_at_host" 53 | ) 54 | 55 | const ( 56 | ProximityPlacementGroups commons.FieldName = "proximity_placement_groups" 57 | PPGName commons.FieldName = "name" 58 | PPGResourceGroupName commons.FieldName = "resource_group_name" 59 | ) 60 | -------------------------------------------------------------------------------- /spotinst/azure_v3/elastigroup_azure_load_balancer/consts.go: -------------------------------------------------------------------------------- 1 | package elastigroup_azure_load_balancer 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | LoadBalancer commons.FieldName = "load_balancer" 7 | 8 | Type commons.FieldName = "type" 9 | Name commons.FieldName = "name" 10 | ResourceGroupName commons.FieldName = "resource_group_name" 11 | SKU commons.FieldName = "sku" 12 | BackendPoolNames commons.FieldName = "backend_pool_names" 13 | ) 14 | -------------------------------------------------------------------------------- /spotinst/azure_v3/elastigroup_azure_login/consts.go: -------------------------------------------------------------------------------- 1 | package elastigroup_azure_login 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Prefix = "azure_login_" 7 | ) 8 | 9 | const ( 10 | Login commons.FieldName = "login" 11 | UserName commons.FieldName = "user_name" 12 | SSHPublicKey commons.FieldName = "ssh_public_key" 13 | Password commons.FieldName = "password" 14 | ) 15 | -------------------------------------------------------------------------------- /spotinst/azure_v3/elastigroup_azure_network/consts.go: -------------------------------------------------------------------------------- 1 | package elastigroup_azure_network 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Network commons.FieldName = "network" 7 | VirtualNetworkName commons.FieldName = "virtual_network_name" 8 | SubnetName commons.FieldName = "subnet_name" 9 | ResourceGroupName commons.FieldName = "resource_group_name" 10 | AssignPublicIP commons.FieldName = "assign_public_ip" 11 | AdditionalIPConfigs commons.FieldName = "additional_ip_configs" 12 | NetworkInterfaces commons.FieldName = "network_interfaces" 13 | PrivateIPVersion commons.FieldName = "private_ip_version" 14 | IsPrimary commons.FieldName = "is_primary" 15 | Name commons.FieldName = "name" 16 | ApplicationSecurityGroup commons.FieldName = "application_security_group" 17 | EnableIPForwarding commons.FieldName = "enable_ip_forwarding" 18 | PrivateIPAddresses commons.FieldName = "private_ip_addresses" 19 | PublicIPs commons.FieldName = "public_ips" 20 | PublicIPSku commons.FieldName = "public_ip_sku" 21 | SecurityGroup commons.FieldName = "security_group" 22 | ) 23 | -------------------------------------------------------------------------------- /spotinst/azure_v3/elastigroup_azure_scaling_policies/consts.go: -------------------------------------------------------------------------------- 1 | package elastigroup_azure_scaling_policies 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | ScalingUpPolicy commons.FieldName = "scaling_up_policy" 7 | ScalingDownPolicy commons.FieldName = "scaling_down_policy" 8 | 9 | PolicyName commons.FieldName = "policy_name" 10 | MetricName commons.FieldName = "metric_name" 11 | Namespace commons.FieldName = "namespace" 12 | Statistic commons.FieldName = "statistic" 13 | Unit commons.FieldName = "unit" 14 | Cooldown commons.FieldName = "cooldown" 15 | Dimensions commons.FieldName = "dimensions" 16 | Action commons.FieldName = "action" 17 | Threshold commons.FieldName = "threshold" 18 | Operator commons.FieldName = "operator" 19 | EvaluationPeriods commons.FieldName = "evaluation_periods" 20 | Period commons.FieldName = "period" 21 | Source commons.FieldName = "source" 22 | IsEnabled commons.FieldName = "is_enabled" 23 | 24 | Adjustment commons.FieldName = "adjustment" 25 | Minimum commons.FieldName = "minimum" 26 | Maximum commons.FieldName = "maximum" 27 | Target commons.FieldName = "target" 28 | Type commons.FieldName = "type" 29 | 30 | DimensionName commons.FieldName = "name" 31 | DimensionValue commons.FieldName = "value" 32 | ) 33 | -------------------------------------------------------------------------------- /spotinst/azure_v3/elastigroup_azure_scheduling/consts.go: -------------------------------------------------------------------------------- 1 | package elastigroup_azure_scheduling 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | SchedulingTask commons.FieldName = "scheduling_task" 7 | IsEnabled commons.FieldName = "is_enabled" 8 | CronExpression commons.FieldName = "cron_expression" 9 | Type commons.FieldName = "type" 10 | ScaleMaxCapacity commons.FieldName = "scale_max_capacity" 11 | ScaleMinCapacity commons.FieldName = "scale_min_capacity" 12 | ScaleTargetCapacity commons.FieldName = "scale_target_capacity" 13 | Adjustment commons.FieldName = "adjustment" 14 | AdjustmentPercentage commons.FieldName = "adjustment_percentage" 15 | BatchSizePercentage commons.FieldName = "batch_size_percentage" 16 | GracePeriod commons.FieldName = "grace_period" 17 | ) 18 | -------------------------------------------------------------------------------- /spotinst/azure_v3/elastigroup_azure_secrets/consts.go: -------------------------------------------------------------------------------- 1 | package elastigroup_azure_secrets 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Secret commons.FieldName = "secret" 7 | 8 | SourceVault commons.FieldName = "source_vault" 9 | Name commons.FieldName = "name" 10 | ResourceGroupName commons.FieldName = "resource_group_name" 11 | 12 | VaultCertificates commons.FieldName = "vault_certificates" 13 | CertificateURL commons.FieldName = "certificate_url" 14 | CertificateStore commons.FieldName = "certificate_store" 15 | ) 16 | -------------------------------------------------------------------------------- /spotinst/azure_v3/elastigroup_azure_strategy/consts.go: -------------------------------------------------------------------------------- 1 | package elastigroup_azure_strategy 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Prefix = "strategy_" 7 | ) 8 | 9 | const ( 10 | Strategy commons.FieldName = "strategy" 11 | SpotPercentage commons.FieldName = "spot_percentage" 12 | OnDemandCount commons.FieldName = "on_demand_count" 13 | DrainingTimeout commons.FieldName = "draining_timeout" 14 | FallbackToOnDemand commons.FieldName = "fallback_to_on_demand" 15 | AvailabilityVsCost commons.FieldName = "availability_vs_cost" 16 | RevertToSpot commons.FieldName = "revert_to_spot" 17 | PerformAt commons.FieldName = "perform_at" 18 | OptimizationWindows commons.FieldName = "optimization_windows" 19 | ) 20 | 21 | const ( 22 | Signal commons.FieldName = "signal" 23 | Type commons.FieldName = "type" 24 | Timeout commons.FieldName = "timeout" 25 | ) 26 | 27 | const ( 28 | CapacityReservation commons.FieldName = "capacity_reservation" 29 | ShouldUtilize commons.FieldName = "should_utilize" 30 | UtilizationStrategy commons.FieldName = "utilization_strategy" 31 | CapacityReservationGroups commons.FieldName = "capacity_reservation_groups" 32 | CRGName commons.FieldName = "crg_name" 33 | CRGResourceGroupName commons.FieldName = "crg_resource_group_name" 34 | CRGShouldPrioritize commons.FieldName = "crg_should_prioritize" 35 | ) 36 | -------------------------------------------------------------------------------- /spotinst/azure_v3/elastigroup_azure_vm_sizes/consts.go: -------------------------------------------------------------------------------- 1 | package elastigroup_azure_vm_sizes 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Prefix = "azure_vm_sizes_" 7 | ) 8 | 9 | const ( 10 | VmSizes commons.FieldName = "vm_sizes" 11 | OnDemandSizes commons.FieldName = "od_sizes" 12 | SpotSizes commons.FieldName = "spot_sizes" 13 | PreferredSpotSizes commons.FieldName = "preferred_spot_sizes" 14 | ExcludedVmSizes commons.FieldName = "excluded_vm_sizes" 15 | 16 | SpotSizeAttributes commons.FieldName = "spot_size_attributes" 17 | MaxCpu commons.FieldName = "max_cpu" 18 | MaxMemory commons.FieldName = "max_memory" 19 | MaxStorage commons.FieldName = "max_storage" 20 | MinCpu commons.FieldName = "min_cpu" 21 | MinMemory commons.FieldName = "min_memory" 22 | MinStorage commons.FieldName = "min_storage" 23 | ) 24 | -------------------------------------------------------------------------------- /spotinst/azure_v3/stateful_node_azure_extension/consts.go: -------------------------------------------------------------------------------- 1 | package stateful_node_azure_extension 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Extension commons.FieldName = "extension" 7 | APIVersion commons.FieldName = "api_version" 8 | MinorVersionAutoUpgrade commons.FieldName = "minor_version_auto_upgrade" 9 | Name commons.FieldName = "name" 10 | Publisher commons.FieldName = "publisher" 11 | Type commons.FieldName = "type" 12 | ProtectedSettings commons.FieldName = "protected_settings" 13 | PublicSettings commons.FieldName = "public_settings" 14 | ) 15 | -------------------------------------------------------------------------------- /spotinst/azure_v3/stateful_node_azure_health/consts.go: -------------------------------------------------------------------------------- 1 | package stateful_node_azure_health 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Health commons.FieldName = "health" 7 | HealthCheckTypes commons.FieldName = "health_check_types" 8 | GracePeriod commons.FieldName = "grace_period" 9 | UnhealthyDuration commons.FieldName = "unhealthy_duration" 10 | AutoHealing commons.FieldName = "auto_healing" 11 | ) 12 | -------------------------------------------------------------------------------- /spotinst/azure_v3/stateful_node_azure_image/consts.go: -------------------------------------------------------------------------------- 1 | package stateful_node_azure_image 2 | 3 | import ( 4 | "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 5 | ) 6 | 7 | const ( 8 | Image commons.FieldName = "image" 9 | ) 10 | 11 | // MarketPlaceImage 12 | const ( 13 | MarketPlaceImage commons.FieldName = "marketplace_image" 14 | Publisher commons.FieldName = "publisher" 15 | Offer commons.FieldName = "offer" 16 | SKU commons.FieldName = "sku" 17 | Version commons.FieldName = "version" 18 | ) 19 | 20 | // CustomImage 21 | const ( 22 | CustomImage commons.FieldName = "custom_image" 23 | CustomImageResourceGroupName commons.FieldName = "custom_image_resource_group_name" 24 | Name commons.FieldName = "name" 25 | ) 26 | 27 | // Gallery 28 | const ( 29 | Gallery commons.FieldName = "gallery" 30 | GalleryResourceGroupName commons.FieldName = "gallery_resource_group_name" 31 | GalleryName commons.FieldName = "gallery_name" 32 | ImageName commons.FieldName = "image_name" 33 | VersionName commons.FieldName = "version_name" 34 | SpotAccountId commons.FieldName = "spot_account_id" 35 | ) 36 | -------------------------------------------------------------------------------- /spotinst/azure_v3/stateful_node_azure_launch_spec/consts.go: -------------------------------------------------------------------------------- 1 | package stateful_node_azure_launch_spec 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | // LaunchSpec 6 | const ( 7 | CustomData commons.FieldName = "custom_data" 8 | UserData commons.FieldName = "user_data" 9 | ShutdownScript commons.FieldName = "shutdown_script" 10 | VMName commons.FieldName = "vm_name" 11 | VMNamePrefix commons.FieldName = "vm_name_prefix" 12 | LicenseType commons.FieldName = "license_type" 13 | ) 14 | 15 | // Tags 16 | const ( 17 | Tag commons.FieldName = "tag" 18 | TagKey commons.FieldName = "tag_key" 19 | TagValue commons.FieldName = "tag_value" 20 | ) 21 | 22 | // Managed service identities 23 | const ( 24 | ManagedServiceIdentities commons.FieldName = "managed_service_identities" 25 | Name commons.FieldName = "name" 26 | ResourceGroupName commons.FieldName = "resource_group_name" 27 | ) 28 | 29 | // Proximity Placement Groups 30 | const ( 31 | ProximityPlacementGroups commons.FieldName = "proximity_placement_groups" 32 | PPGName commons.FieldName = "name" 33 | PPGResourceGroupName commons.FieldName = "resource_group_name" 34 | ) 35 | 36 | // OS disk 37 | const ( 38 | OSDisk commons.FieldName = "os_disk" 39 | OSDiskSizeGB commons.FieldName = "size_gb" 40 | OSDiskType commons.FieldName = "type" 41 | OSCaching commons.FieldName = "caching" 42 | ) 43 | 44 | // Data disk 45 | const ( 46 | DataDisk commons.FieldName = "data_disk" 47 | DataDiskSizeGB commons.FieldName = "size_gb" 48 | DataDiskType commons.FieldName = "type" 49 | DataDiskLUN commons.FieldName = "lun" 50 | ) 51 | 52 | // Boot diagnostics 53 | const ( 54 | BootDiagnostics commons.FieldName = "boot_diagnostics" 55 | BootDiagnosticsIsEnabled commons.FieldName = "is_enabled" 56 | BootDiagnosticsStorageURL commons.FieldName = "storage_url" 57 | BootDiagnosticsType commons.FieldName = "type" 58 | ) 59 | 60 | // Security 61 | const ( 62 | Security commons.FieldName = "security" 63 | SecureBootEnabled commons.FieldName = "secure_boot_enabled" 64 | SecurityType commons.FieldName = "security_type" 65 | VTpmEnabled commons.FieldName = "vtpm_enabled" 66 | EncryptionAtHost commons.FieldName = "encryption_at_host" 67 | ConfidentialOsDiskEncryption commons.FieldName = "confidential_os_disk_encryption" 68 | ) 69 | -------------------------------------------------------------------------------- /spotinst/azure_v3/stateful_node_azure_load_balancer/consts.go: -------------------------------------------------------------------------------- 1 | package stateful_node_azure_load_balancer 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | LoadBalancer commons.FieldName = "load_balancer" 7 | 8 | Type commons.FieldName = "type" 9 | Name commons.FieldName = "name" 10 | ResourceGroupName commons.FieldName = "resource_group_name" 11 | SKU commons.FieldName = "sku" 12 | BackendPoolNames commons.FieldName = "backend_pool_names" 13 | ) 14 | -------------------------------------------------------------------------------- /spotinst/azure_v3/stateful_node_azure_login/consts.go: -------------------------------------------------------------------------------- 1 | package stateful_node_azure_login 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Login commons.FieldName = "login" 7 | UserName commons.FieldName = "user_name" 8 | SSHPublicKey commons.FieldName = "ssh_public_key" 9 | Password commons.FieldName = "password" 10 | ) 11 | -------------------------------------------------------------------------------- /spotinst/azure_v3/stateful_node_azure_network/consts.go: -------------------------------------------------------------------------------- 1 | package stateful_node_azure_network 2 | 3 | import ( 4 | "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 5 | ) 6 | 7 | // Network 8 | const ( 9 | Network commons.FieldName = "network" 10 | VirtualNetworkName commons.FieldName = "virtual_network_name" 11 | ResourceGroupName commons.FieldName = "network_resource_group_name" 12 | NetworkInterface commons.FieldName = "network_interface" 13 | ) 14 | 15 | // NetworkInterfaces 16 | const ( 17 | SubnetName commons.FieldName = "subnet_name" 18 | AssignPublicIP commons.FieldName = "assign_public_ip" 19 | IsPrimary commons.FieldName = "is_primary" 20 | PublicIPSku commons.FieldName = "public_ip_sku" 21 | EnableIPForwarding commons.FieldName = "enable_ip_forwarding" 22 | PrivateIPAddresses commons.FieldName = "private_ip_addresses" 23 | NetworkSecurityGroup commons.FieldName = "network_security_group" 24 | AdditionalIPConfigurations commons.FieldName = "additional_ip_configurations" 25 | PublicIPs commons.FieldName = "public_ips" 26 | ApplicationSecurityGroups commons.FieldName = "application_security_groups" 27 | ) 28 | 29 | const ( 30 | Name commons.FieldName = "name" 31 | PrivateIPAddressVersion commons.FieldName = "private_ip_address_version" 32 | ) 33 | -------------------------------------------------------------------------------- /spotinst/azure_v3/stateful_node_azure_persistence/consts.go: -------------------------------------------------------------------------------- 1 | package stateful_node_azure_persistence 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | ShouldPersistOSDisk commons.FieldName = "should_persist_os_disk" 7 | OSDiskPersistenceMode commons.FieldName = "os_disk_persistence_mode" 8 | ShouldPersistDataDisks commons.FieldName = "should_persist_data_disks" 9 | DataDisksPersistenceMode commons.FieldName = "data_disks_persistence_mode" 10 | ShouldPersistNetwork commons.FieldName = "should_persist_network" 11 | ) 12 | -------------------------------------------------------------------------------- /spotinst/azure_v3/stateful_node_azure_scheduling/consts.go: -------------------------------------------------------------------------------- 1 | package stateful_node_azure_scheduling 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | SchedulingTask commons.FieldName = "scheduling_task" 7 | IsEnabled commons.FieldName = "is_enabled" 8 | CronExpression commons.FieldName = "cron_expression" 9 | Type commons.FieldName = "type" 10 | ) 11 | -------------------------------------------------------------------------------- /spotinst/azure_v3/stateful_node_azure_secret/consts.go: -------------------------------------------------------------------------------- 1 | package stateful_node_azure_secret 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Secret commons.FieldName = "secret" 7 | 8 | SourceVault commons.FieldName = "source_vault" 9 | Name commons.FieldName = "name" 10 | ResourceGroupName commons.FieldName = "resource_group_name" 11 | 12 | VaultCertificates commons.FieldName = "vault_certificates" 13 | CertificateURL commons.FieldName = "certificate_url" 14 | CertificateStore commons.FieldName = "certificate_store" 15 | ) 16 | -------------------------------------------------------------------------------- /spotinst/azure_v3/stateful_node_azure_strategy/consts.go: -------------------------------------------------------------------------------- 1 | package stateful_node_azure_strategy 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Strategy commons.FieldName = "strategy" 7 | PreferredLifecycle commons.FieldName = "preferred_life_cycle" 8 | FallbackToOnDemand commons.FieldName = "fallback_to_on_demand" 9 | DrainingTimeout commons.FieldName = "draining_timeout" 10 | RevertToSpot commons.FieldName = "revert_to_spot" 11 | PerformAt commons.FieldName = "perform_at" 12 | OptimizationWindows commons.FieldName = "optimization_windows" 13 | OdWindows commons.FieldName = "od_windows" 14 | AvailabilityVsCost commons.FieldName = "availability_vs_cost" 15 | VmAdmins commons.FieldName = "vm_admins" 16 | ) 17 | 18 | const ( 19 | Signal commons.FieldName = "signal" 20 | Type commons.FieldName = "type" 21 | Timeout commons.FieldName = "timeout" 22 | ) 23 | 24 | const ( 25 | CapacityReservation commons.FieldName = "capacity_reservation" 26 | ShouldUtilize commons.FieldName = "should_utilize" 27 | UtilizationStrategy commons.FieldName = "utilization_strategy" 28 | CapacityReservationGroups commons.FieldName = "capacity_reservation_groups" 29 | CRGName commons.FieldName = "crg_name" 30 | CRGResourceGroupName commons.FieldName = "crg_resource_group_name" 31 | CRGShouldPrioritize commons.FieldName = "crg_should_prioritize" 32 | ) 33 | -------------------------------------------------------------------------------- /spotinst/azure_v3/stateful_node_azure_vm_sizes/consts.go: -------------------------------------------------------------------------------- 1 | package stateful_node_azure_vm_sizes 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | VmSizes commons.FieldName = "vm_sizes" 7 | OnDemandSizes commons.FieldName = "od_sizes" 8 | SpotSizes commons.FieldName = "spot_sizes" 9 | PreferredSpotSizes commons.FieldName = "preferred_spot_sizes" 10 | ExcludedVmSizes commons.FieldName = "excluded_vm_sizes" 11 | 12 | SpotSizeAttributes commons.FieldName = "spot_size_attributes" 13 | MaxCpu commons.FieldName = "max_cpu" 14 | MaxMemory commons.FieldName = "max_memory" 15 | MaxStorage commons.FieldName = "max_storage" 16 | MinCpu commons.FieldName = "min_cpu" 17 | MinMemory commons.FieldName = "min_memory" 18 | MinStorage commons.FieldName = "min_storage" 19 | ) 20 | -------------------------------------------------------------------------------- /spotinst/commons/common_account.go: -------------------------------------------------------------------------------- 1 | package commons 2 | 3 | import ( 4 | "fmt" 5 | "log" 6 | 7 | "github.com/spotinst/spotinst-sdk-go/service/account/providers/common" 8 | 9 | "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" 10 | ) 11 | 12 | const ( 13 | AccountResourceName ResourceName = "spotinst_account" 14 | ) 15 | 16 | var AccountResource *AccountTerraformResource 17 | 18 | type AccountTerraformResource struct { 19 | GenericResource 20 | } 21 | 22 | type AccountWrapper struct { 23 | account *common.Account 24 | } 25 | 26 | func NewAccountResource(fieldsMap map[FieldName]*GenericField) *AccountTerraformResource { 27 | return &AccountTerraformResource{ 28 | GenericResource: GenericResource{ 29 | resourceName: AccountResourceName, 30 | fields: NewGenericFields(fieldsMap), 31 | }, 32 | } 33 | } 34 | 35 | func (res *AccountTerraformResource) OnCreate( 36 | resourceData *schema.ResourceData, 37 | meta interface{}) (*common.Account, error) { 38 | 39 | if res.fields == nil || res.fields.fieldsMap == nil || len(res.fields.fieldsMap) == 0 { 40 | return nil, fmt.Errorf("resource fields are nil or empty, cannot create") 41 | } 42 | 43 | accountWrapper := NewCommonAccountWrapper() 44 | 45 | for _, field := range res.fields.fieldsMap { 46 | if field.onCreate == nil { 47 | continue 48 | } 49 | log.Printf(string(ResourceFieldOnCreate), field.resourceAffinity, field.fieldNameStr) 50 | if err := field.onCreate(accountWrapper, resourceData, meta); err != nil { 51 | return nil, err 52 | } 53 | } 54 | return accountWrapper.GetAccount(), nil 55 | } 56 | 57 | func (res *AccountTerraformResource) OnRead( 58 | account *common.Account, 59 | resourceData *schema.ResourceData, 60 | meta interface{}) error { 61 | 62 | if res.fields == nil || res.fields.fieldsMap == nil || len(res.fields.fieldsMap) == 0 { 63 | return fmt.Errorf("resource fields are nil or empty, cannot read") 64 | } 65 | 66 | accountWrapper := NewCommonAccountWrapper() 67 | accountWrapper.SetAccount(account) 68 | 69 | for _, field := range res.fields.fieldsMap { 70 | if field.onRead == nil { 71 | continue 72 | } 73 | log.Printf(string(ResourceFieldOnRead), field.resourceAffinity, field.fieldNameStr) 74 | if err := field.onRead(accountWrapper, resourceData, meta); err != nil { 75 | return err 76 | } 77 | } 78 | 79 | return nil 80 | } 81 | 82 | func NewCommonAccountWrapper() *AccountWrapper { 83 | return &AccountWrapper{ 84 | account: &common.Account{}, 85 | } 86 | } 87 | 88 | func (accountWrapper *AccountWrapper) GetAccount() *common.Account { 89 | return accountWrapper.account 90 | } 91 | 92 | func (accountWrapper *AccountWrapper) SetAccount(account *common.Account) { 93 | accountWrapper.account = account 94 | } 95 | -------------------------------------------------------------------------------- /spotinst/commons/common_account_aws.go: -------------------------------------------------------------------------------- 1 | package commons 2 | 3 | import ( 4 | "fmt" 5 | "log" 6 | 7 | "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" 8 | "github.com/spotinst/spotinst-sdk-go/service/account/providers/aws" 9 | ) 10 | 11 | const ( 12 | AccountAWSResourceName ResourceName = "spotinst_account_aws" 13 | ) 14 | 15 | var AccountAWSResource *AccountAWSTerraformResource 16 | 17 | type AccountAWSTerraformResource struct { 18 | GenericResource 19 | } 20 | 21 | type AWSAccountWrapper struct { 22 | account *aws.Account 23 | } 24 | 25 | func NewAccountAWSResource(fieldsMap map[FieldName]*GenericField) *AccountAWSTerraformResource { 26 | return &AccountAWSTerraformResource{ 27 | GenericResource: GenericResource{ 28 | resourceName: AccountAWSResourceName, 29 | fields: NewGenericFields(fieldsMap), 30 | }, 31 | } 32 | } 33 | 34 | func (res *AccountAWSTerraformResource) OnCreate( 35 | resourceData *schema.ResourceData, 36 | meta interface{}) (*aws.Account, error) { 37 | 38 | if res.fields == nil || res.fields.fieldsMap == nil || len(res.fields.fieldsMap) == 0 { 39 | return nil, fmt.Errorf("resource fields are nil or empty, cannot create") 40 | } 41 | 42 | accountWrapper := NewAccountWrapper() 43 | 44 | for _, field := range res.fields.fieldsMap { 45 | if field.onCreate == nil { 46 | continue 47 | } 48 | log.Printf(string(ResourceFieldOnCreate), field.resourceAffinity, field.fieldNameStr) 49 | if err := field.onCreate(accountWrapper, resourceData, meta); err != nil { 50 | return nil, err 51 | } 52 | } 53 | return accountWrapper.GetAccount(), nil 54 | } 55 | 56 | func (res *AccountAWSTerraformResource) OnRead( 57 | account *aws.Account, 58 | resourceData *schema.ResourceData, 59 | meta interface{}) error { 60 | 61 | if res.fields == nil || res.fields.fieldsMap == nil || len(res.fields.fieldsMap) == 0 { 62 | return fmt.Errorf("resource fields are nil or empty, cannot read") 63 | } 64 | 65 | accountWrapper := NewAccountWrapper() 66 | accountWrapper.SetAccount(account) 67 | 68 | for _, field := range res.fields.fieldsMap { 69 | if field.onRead == nil { 70 | continue 71 | } 72 | log.Printf(string(ResourceFieldOnRead), field.resourceAffinity, field.fieldNameStr) 73 | if err := field.onRead(accountWrapper, resourceData, meta); err != nil { 74 | return err 75 | } 76 | } 77 | 78 | return nil 79 | } 80 | 81 | func NewAccountWrapper() *AWSAccountWrapper { 82 | return &AWSAccountWrapper{ 83 | account: &aws.Account{}, 84 | } 85 | } 86 | 87 | func (accountWrapper *AWSAccountWrapper) GetAccount() *aws.Account { 88 | return accountWrapper.account 89 | } 90 | 91 | func (accountWrapper *AWSAccountWrapper) SetAccount(account *aws.Account) { 92 | accountWrapper.account = account 93 | } 94 | -------------------------------------------------------------------------------- /spotinst/commons/common_credentials_aws.go: -------------------------------------------------------------------------------- 1 | package commons 2 | 3 | import ( 4 | "fmt" 5 | "log" 6 | 7 | "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" 8 | "github.com/spotinst/spotinst-sdk-go/service/account/providers/aws" 9 | ) 10 | 11 | const ( 12 | CredentialsAWSResourceName ResourceName = "spotinst_credentials_aws" 13 | ) 14 | 15 | var CredentialsAWSResource *CredentialsAWSTerraformResource 16 | 17 | type CredentialsAWSTerraformResource struct { 18 | GenericResource 19 | } 20 | 21 | type AWSCredentialsWrapper struct { 22 | credentials *aws.Credentials 23 | } 24 | 25 | func NewCredentialsAWSResource(fieldsMap map[FieldName]*GenericField) *CredentialsAWSTerraformResource { 26 | return &CredentialsAWSTerraformResource{ 27 | GenericResource: GenericResource{ 28 | resourceName: CredentialsAWSResourceName, 29 | fields: NewGenericFields(fieldsMap), 30 | }, 31 | } 32 | } 33 | 34 | func (res *CredentialsAWSTerraformResource) OnCreate( 35 | resourceData *schema.ResourceData, 36 | meta interface{}) (*aws.Credentials, error) { 37 | 38 | if res.fields == nil || res.fields.fieldsMap == nil || len(res.fields.fieldsMap) == 0 { 39 | return nil, fmt.Errorf("resource fields are nil or empty, cannot create") 40 | } 41 | 42 | credentialsWrapper := NewCredentialsWrapper() 43 | 44 | for _, field := range res.fields.fieldsMap { 45 | if field.onCreate == nil { 46 | continue 47 | } 48 | log.Printf(string(ResourceFieldOnCreate), field.resourceAffinity, field.fieldNameStr) 49 | if err := field.onCreate(credentialsWrapper, resourceData, meta); err != nil { 50 | return nil, err 51 | } 52 | } 53 | return credentialsWrapper.GetCredentials(), nil 54 | } 55 | 56 | func (res *CredentialsAWSTerraformResource) OnRead( 57 | credentials *aws.Credentials, 58 | resourceData *schema.ResourceData, 59 | meta interface{}) error { 60 | if res.fields == nil || res.fields.fieldsMap == nil || len(res.fields.fieldsMap) == 0 { 61 | return fmt.Errorf("resource fields are nil or empty, cannot read") 62 | } 63 | credentialsWrapper := NewCredentialsWrapper() 64 | credentialsWrapper.SetCredentials(credentials) 65 | for _, field := range res.fields.fieldsMap { 66 | if field.onRead == nil { 67 | continue 68 | } 69 | log.Printf(string(ResourceFieldOnRead), field.resourceAffinity, field.fieldNameStr) 70 | if err := field.onRead(credentialsWrapper, resourceData, meta); err != nil { 71 | return err 72 | } 73 | } 74 | return nil 75 | } 76 | 77 | func NewCredentialsWrapper() *AWSCredentialsWrapper { 78 | return &AWSCredentialsWrapper{ 79 | credentials: &aws.Credentials{}, 80 | } 81 | } 82 | 83 | func (credentialsWrapper *AWSCredentialsWrapper) GetCredentials() *aws.Credentials { 84 | return credentialsWrapper.credentials 85 | } 86 | 87 | func (credentialsWrapper *AWSCredentialsWrapper) SetCredentials(credentials *aws.Credentials) { 88 | credentialsWrapper.credentials = credentials 89 | } 90 | -------------------------------------------------------------------------------- /spotinst/commons/common_ocean_condintional_roll.go: -------------------------------------------------------------------------------- 1 | package commons 2 | 3 | var conditionedRollFieldsAWS = []string{"subnet_ids", "whitelist", "blacklist", "user_data", "image_id", "security_groups", 4 | "key_name", "iam_instance_profile", "associate_public_ip_address", "load_balancers", "instance_metadata_options", 5 | "ebs_optimized", "root_volume_size"} 6 | 7 | var conditionedRollFieldsECS = []string{"subnet_ids", "whitelist", "blacklist", "user_data", "image_id", "security_groups", 8 | "key_pair", "iam_instance_profile", "associate_public_ip_address", "block_device_mappings", "optimize_images", 9 | "instance_metadata_options"} 10 | 11 | var conditionedRollFieldsGKE = []string{"backend_services", "root_volume_type", "whitelist"} 12 | 13 | var conditionedRollFieldsAKS = []string{"availability_zones", "max_pods_per_node", "enable_node_public_ip", "os_disk_size_gb", "os_disk_type", "os_sku", "kubernetes_version", "vnet_subnet_ids", "pod_subnet_ids", "labels", "taints", "tags"} 14 | 15 | func contains(s []string, str string) bool { 16 | for _, v := range s { 17 | if v == str { 18 | return true 19 | } 20 | } 21 | 22 | return false 23 | } 24 | -------------------------------------------------------------------------------- /spotinst/commons/managed_instance_aws/consts.go: -------------------------------------------------------------------------------- 1 | package managed_instance_aws 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Name commons.FieldName = "name" 7 | Description commons.FieldName = "description" 8 | Region commons.FieldName = "region" 9 | 10 | // - Instance Action ---------------------- 11 | ManagedInstanceAction commons.FieldName = "managed_instance_action" 12 | ActionType commons.FieldName = "type" 13 | // ---------------------------------------- 14 | ) 15 | 16 | const ( 17 | Delete commons.FieldName = "delete" 18 | AmiBackupShouldDeleteImages commons.FieldName = "ami_backup_should_delete_images" 19 | DeallocationConfigShouldDeleteImages commons.FieldName = "deallocation_config_should_delete_images" 20 | ShouldDeleteNetworkInterfaces commons.FieldName = "should_delete_network_interfaces" 21 | ShouldDeleteSnapshots commons.FieldName = "should_delete_snapshots" 22 | ShouldDeleteVolumes commons.FieldName = "should_delete_volumes" 23 | ShouldTerminateInstance commons.FieldName = "should_terminate_instance" 24 | ) 25 | -------------------------------------------------------------------------------- /spotinst/commons/managed_instance_aws_compute/consts.go: -------------------------------------------------------------------------------- 1 | package managed_instance_aws_compute 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | SubnetIDs commons.FieldName = "subnet_ids" 7 | VpcID commons.FieldName = "vpc_id" 8 | ElasticIP commons.FieldName = "elastic_ip" 9 | PrivateIP commons.FieldName = "private_ip" 10 | ) 11 | -------------------------------------------------------------------------------- /spotinst/commons/managed_instance_aws_compute_instance_type/consts.go: -------------------------------------------------------------------------------- 1 | package managed_instance_aws_compute_instance_type 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Product commons.FieldName = "product" 7 | PreferredType commons.FieldName = "preferred_type" 8 | Types commons.FieldName = "instance_types" 9 | PreferredTypes commons.FieldName = "preferred_types" 10 | 11 | ResourceRequirements commons.FieldName = "resource_requirements" 12 | ExcludedInstanceFamilies commons.FieldName = "excluded_instance_families" 13 | ExcludedInstanceGenerations commons.FieldName = "excluded_instance_generations" 14 | ExcludedInstanceTypes commons.FieldName = "excluded_instance_types" 15 | RequiredGpuMinimum commons.FieldName = "required_gpu_minimum" 16 | RequiredGpuMaximum commons.FieldName = "required_gpu_maximum" 17 | RequiredMemoryMinimum commons.FieldName = "required_memory_minimum" 18 | RequiredMemoryMaximum commons.FieldName = "required_memory_maximum" 19 | RequiredVCpuMinimum commons.FieldName = "required_vcpu_minimum" 20 | RequiredVCpuMaximum commons.FieldName = "required_vcpu_maximum" 21 | ) 22 | -------------------------------------------------------------------------------- /spotinst/commons/managed_instance_aws_compute_launchspecification/consts.go: -------------------------------------------------------------------------------- 1 | package managed_instance_aws_compute_launchspecification 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | type TagField string 6 | 7 | const ( 8 | TagKey TagField = "key" 9 | TagValue TagField = "value" 10 | ) 11 | 12 | const ( 13 | EBSOptimized commons.FieldName = "ebs_optimized" 14 | EnableMonitoring commons.FieldName = "enable_monitoring" 15 | PlacementTenancy commons.FieldName = "placement_tenancy" 16 | IAMInstanceProfile commons.FieldName = "iam_instance_profile" 17 | SecurityGroupIDs commons.FieldName = "security_group_ids" 18 | ImageID commons.FieldName = "image_id" 19 | KeyPair commons.FieldName = "key_pair" 20 | Tags commons.FieldName = "tags" 21 | UserData commons.FieldName = "user_data" 22 | ShutdownScript commons.FieldName = "shutdown_script" 23 | CPUCredits commons.FieldName = "cpu_credits" 24 | BlockDeviceMappings commons.FieldName = "block_device_mappings" 25 | ) 26 | 27 | const ( 28 | ResourceTagSpecification commons.FieldName = "resource_tag_specification" 29 | ShouldTagVolumes commons.FieldName = "should_tag_volumes" 30 | ShouldTagSnapshots commons.FieldName = "should_tag_snapshots" 31 | ShouldTagENIs commons.FieldName = "should_tag_enis" 32 | ShouldTagAMIs commons.FieldName = "should_tag_amis" 33 | ) 34 | 35 | const ( 36 | DeviceName commons.FieldName = "device_name" 37 | EBS commons.FieldName = "ebs" 38 | DeleteOnTermination commons.FieldName = "delete_on_termination" 39 | IOPS commons.FieldName = "iops" 40 | VolumeSize commons.FieldName = "volume_size" 41 | VolumeType commons.FieldName = "volume_type" 42 | Throughput commons.FieldName = "throughput" 43 | SnapshotId commons.FieldName = "snapshot_id" 44 | Encrypted commons.FieldName = "encrypted" 45 | KmsKeyId commons.FieldName = "kms_key_id" 46 | ) 47 | 48 | const ( 49 | MetadataOptions commons.FieldName = "metadata_options" 50 | HttpPutResponseHopLimit commons.FieldName = "http_put_response_hop_limit" 51 | HttpTokens commons.FieldName = "http_tokens" 52 | InstanceMetadataTags commons.FieldName = "instance_metadata_tags" 53 | ) 54 | -------------------------------------------------------------------------------- /spotinst/commons/managed_instance_aws_integrations/consts.go: -------------------------------------------------------------------------------- 1 | package managed_instance_aws_integrations 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | type BalancerType string 6 | 7 | const ( 8 | // - ROUTE53 ------------------------- 9 | IntegrationRoute53 commons.FieldName = "integration_route53" 10 | Domains commons.FieldName = "domains" 11 | HostedZoneId commons.FieldName = "hosted_zone_id" 12 | SpotinstAcctID commons.FieldName = "spotinst_acct_id" 13 | RecordSetType commons.FieldName = "record_set_type" 14 | RecordSets commons.FieldName = "record_sets" 15 | UsePublicIP commons.FieldName = "use_public_ip" 16 | UsePublicDNS commons.FieldName = "use_public_dns" 17 | Route53Name commons.FieldName = "name" 18 | // ----------------------------------- 19 | 20 | LoadBalancers commons.FieldName = "load_balancers" 21 | Arn commons.FieldName = "arn" 22 | LoadBalancerName commons.FieldName = "name" 23 | Type commons.FieldName = "type" 24 | ) 25 | -------------------------------------------------------------------------------- /spotinst/commons/managed_instance_aws_integrations/fields_spotinst_managed_instance_integration_aws.go: -------------------------------------------------------------------------------- 1 | package managed_instance_aws_integrations 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | func Setup(fieldsMap map[commons.FieldName]*commons.GenericField) { 6 | SetupRoute53(fieldsMap) 7 | SetupLoadBalancers(fieldsMap) 8 | } 9 | -------------------------------------------------------------------------------- /spotinst/commons/managed_instance_healthcheck/consts.go: -------------------------------------------------------------------------------- 1 | package managed_instance_healthcheck 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | HealthCheckType commons.FieldName = "health_check_type" 7 | AutoHealing commons.FieldName = "auto_healing" 8 | GracePeriod commons.FieldName = "grace_period" 9 | UnhealthyDuration commons.FieldName = "unhealthy_duration" 10 | ) 11 | -------------------------------------------------------------------------------- /spotinst/commons/managed_instance_persistence/consts.go: -------------------------------------------------------------------------------- 1 | package managed_instance_persistence 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | PersistBlockDevices commons.FieldName = "persist_block_devices" 7 | PersistRootDevice commons.FieldName = "persist_root_device" 8 | PersistPrivateIp commons.FieldName = "persist_private_ip" 9 | BlockDevicesMode commons.FieldName = "block_devices_mode" 10 | ) 11 | -------------------------------------------------------------------------------- /spotinst/commons/managed_instance_scheduling/consts.go: -------------------------------------------------------------------------------- 1 | package managed_instance_scheduling 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | ScheduledTask commons.FieldName = "scheduled_task" 7 | Tasks commons.FieldName = "tasks" 8 | IsEnabled commons.FieldName = "is_enabled" 9 | Frequency commons.FieldName = "frequency" 10 | StartTime commons.FieldName = "start_time" 11 | CronExpression commons.FieldName = "cron_expression" 12 | TaskType commons.FieldName = "task_type" 13 | ) 14 | -------------------------------------------------------------------------------- /spotinst/commons/managed_instance_strategy/consts.go: -------------------------------------------------------------------------------- 1 | package managed_instance_strategy 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | LifeCycle commons.FieldName = "life_cycle" 7 | Orientation commons.FieldName = "orientation" 8 | DrainingTimeout commons.FieldName = "draining_timeout" 9 | FallbackToOd commons.FieldName = "fallback_to_ondemand" 10 | UtilizeReservedInstances commons.FieldName = "utilize_reserved_instances" 11 | OptimizationWindows commons.FieldName = "optimization_windows" 12 | RevertToSpot commons.FieldName = "revert_to_spot" 13 | PerformAt commons.FieldName = "perform_at" 14 | MinimumInstanceLifetime commons.FieldName = "minimum_instance_lifetime" 15 | ) 16 | -------------------------------------------------------------------------------- /spotinst/commons/managed_instances_aws_compute_launchspecification_networkinterfaces/consts.go: -------------------------------------------------------------------------------- 1 | package managed_instances_aws_compute_launchspecification_networkinterfaces 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | NetworkInterface commons.FieldName = "network_interface" 7 | NetworkInterfaceID commons.FieldName = "network_interface_id" 8 | DeviceIndex commons.FieldName = "device_index" 9 | AssociatePublicIPAddress commons.FieldName = "associate_public_ip_address" 10 | AssociateIPV6Address commons.FieldName = "associate_ipv6_address" 11 | ) 12 | -------------------------------------------------------------------------------- /spotinst/credentials_aws/consts.go: -------------------------------------------------------------------------------- 1 | package credentials_aws 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | IamRole commons.FieldName = "iamrole" 7 | AccountId commons.FieldName = "account_id" 8 | ) 9 | -------------------------------------------------------------------------------- /spotinst/credentials_azure/consts.go: -------------------------------------------------------------------------------- 1 | package credentials_azure 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | AccountId commons.FieldName = "account_id" 7 | ClientId commons.FieldName = "client_id" 8 | ClientSecret commons.FieldName = "client_secret" 9 | TenantId commons.FieldName = "tenant_id" 10 | SubscriptionId commons.FieldName = "subscription_id" 11 | ExpirationDate commons.FieldName = "expiration_date" 12 | ) 13 | -------------------------------------------------------------------------------- /spotinst/credentials_gcp/consts.go: -------------------------------------------------------------------------------- 1 | package credentials_gcp 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | AccountId commons.FieldName = "account_id" 7 | Type commons.FieldName = "type" 8 | ProjectId commons.FieldName = "project_id" 9 | PrivateKeyId commons.FieldName = "private_key_id" 10 | PrivateKey commons.FieldName = "private_key" 11 | ClientEmail commons.FieldName = "client_email" 12 | ClientId commons.FieldName = "client_id" 13 | AuthUri commons.FieldName = "auth_uri" 14 | TokenUri commons.FieldName = "token_uri" 15 | AuthProviderX509CertUrl commons.FieldName = "auth_provider_x509_cert_url" 16 | ClientX509CertUrl commons.FieldName = "client_x509_cert_url" 17 | ) 18 | -------------------------------------------------------------------------------- /spotinst/dataintegration/consts.go: -------------------------------------------------------------------------------- 1 | package dataintegration 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | DataIntegrationName commons.FieldName = "name" 7 | S3 commons.FieldName = "s3" 8 | Status commons.FieldName = "status" 9 | 10 | BucketName commons.FieldName = "bucket_name" 11 | SubDir commons.FieldName = "subdir" 12 | ) 13 | -------------------------------------------------------------------------------- /spotinst/elastigroup_aws_beanstalk/consts.go: -------------------------------------------------------------------------------- 1 | package elastigroup_aws_beanstalk 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Prefix = "elastigroup_aws_beanstalk" 7 | ) 8 | 9 | const ( 10 | Name commons.FieldName = "name" 11 | Region commons.FieldName = "region" 12 | Product commons.FieldName = "product" 13 | Minimum commons.FieldName = "min_size" 14 | Maximum commons.FieldName = "max_size" 15 | Target commons.FieldName = "desired_capacity" 16 | BeanstalkEnvironmentName commons.FieldName = "beanstalk_environment_name" 17 | BeanstalkEnvironmentId commons.FieldName = "beanstalk_environment_id" 18 | SpotInstanceTypes commons.FieldName = "instance_types_spot" 19 | Maintenance commons.FieldName = "maintenance" 20 | ManagedActions commons.FieldName = "managed_actions" 21 | PlatformUpdate commons.FieldName = "platform_update" 22 | PerformAt commons.FieldName = "perform_at" 23 | TimeWindow commons.FieldName = "time_window" 24 | UpdateLevel commons.FieldName = "update_level" 25 | DeploymentPreferences commons.FieldName = "deployment_preferences" 26 | AutomaticRoll commons.FieldName = "automatic_roll" 27 | BatchSizePercentage commons.FieldName = "batch_size_percentage" 28 | GracePeriod commons.FieldName = "grace_period" 29 | Strategy commons.FieldName = "strategy" 30 | Action commons.FieldName = "action" 31 | ShouldDrainInstances commons.FieldName = "should_drain_instances" 32 | ) 33 | -------------------------------------------------------------------------------- /spotinst/elastigroup_aws_beanstalk_scheduled_task/consts.go: -------------------------------------------------------------------------------- 1 | package elastigroup_aws_beanstalk_scheduled_task 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const TaskTypeStatefulUpdateCapacity = "statefulUpdateCapacity" 6 | 7 | const ( 8 | ScheduledTask commons.FieldName = "scheduled_task" 9 | IsEnabled commons.FieldName = "is_enabled" 10 | TaskType commons.FieldName = "task_type" 11 | Frequency commons.FieldName = "frequency" 12 | CronExpression commons.FieldName = "cron_expression" 13 | StartTime commons.FieldName = "start_time" 14 | ScaleTargetCapacity commons.FieldName = "scale_target_capacity" 15 | ScaleMinCapacity commons.FieldName = "scale_min_capacity" 16 | ScaleMaxCapacity commons.FieldName = "scale_max_capacity" 17 | BatchSizePercentage commons.FieldName = "batch_size_percentage" 18 | GracePeriod commons.FieldName = "grace_period" 19 | TargetCapacity commons.FieldName = "target_capacity" 20 | MinCapacity commons.FieldName = "min_capacity" 21 | MaxCapacity commons.FieldName = "max_capacity" 22 | Adjustment commons.FieldName = "adjustment" 23 | AdjustmentPercentage commons.FieldName = "adjustment_percentage" 24 | ) 25 | -------------------------------------------------------------------------------- /spotinst/elastigroup_aws_block_devices/consts.go: -------------------------------------------------------------------------------- 1 | package elastigroup_aws_block_devices 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Prefix = "ebs_block_device" 7 | ) 8 | 9 | const ( 10 | // - COMMON ----------------------------------------------------- 11 | DeviceName commons.FieldName = "device_name" 12 | // -------------------------------------------------------------- 13 | 14 | // - EBS -------------------------------------------------------- 15 | EbsBlockDevice commons.FieldName = "ebs_block_device" 16 | SnapshotId commons.FieldName = "snapshot_id" 17 | VolumeType commons.FieldName = "volume_type" 18 | VolumeSize commons.FieldName = "volume_size" 19 | Iops commons.FieldName = "iops" 20 | DeleteOnTermination commons.FieldName = "delete_on_termination" 21 | Encrypted commons.FieldName = "encrypted" 22 | KmsKeyId commons.FieldName = "kms_key_id" 23 | NoDevice commons.FieldName = "nodevice" 24 | Throughput commons.FieldName = "throughput" 25 | 26 | EphemeralBlockDevice commons.FieldName = "ephemeral_block_device" 27 | VirtualName commons.FieldName = "virtual_name" 28 | 29 | DynamicVolumeSize commons.FieldName = "dynamic_volume_size" 30 | BaseSize commons.FieldName = "base_size" 31 | Resource commons.FieldName = "resource" 32 | SizePerResourceUnit commons.FieldName = "size_per_resource_unit" 33 | ) 34 | const ( 35 | DynamicIops commons.FieldName = "dynamic_iops" 36 | IopsBaseSize commons.FieldName = "base_size" 37 | IopsResource commons.FieldName = "resource" 38 | IopsSizePerResourceUnit commons.FieldName = "size_per_resource_unit" 39 | ) 40 | -------------------------------------------------------------------------------- /spotinst/elastigroup_aws_instance_types/consts.go: -------------------------------------------------------------------------------- 1 | package elastigroup_aws_instance_types 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Prefix = "instance_types_" 7 | ) 8 | 9 | const ( 10 | OnDemand commons.FieldName = Prefix + "ondemand" 11 | Spot commons.FieldName = Prefix + "spot" 12 | PreferredSpot commons.FieldName = Prefix + "preferred_spot" 13 | OnDemandTypes commons.FieldName = "on_demand_types" 14 | 15 | InstanceTypeWeights commons.FieldName = Prefix + "weights" 16 | InstanceType commons.FieldName = "instance_type" 17 | Weight commons.FieldName = "weight" 18 | 19 | ResourceRequirements commons.FieldName = "resource_requirements" 20 | ExcludedInstanceFamilies commons.FieldName = "excluded_instance_families" 21 | ExcludedInstanceGenerations commons.FieldName = "excluded_instance_generations" 22 | ExcludedInstanceTypes commons.FieldName = "excluded_instance_types" 23 | RequiredGpuMinimum commons.FieldName = "required_gpu_minimum" 24 | RequiredGpuMaximum commons.FieldName = "required_gpu_maximum" 25 | RequiredMemoryMinimum commons.FieldName = "required_memory_minimum" 26 | RequiredMemoryMaximum commons.FieldName = "required_memory_maximum" 27 | RequiredVCpuMinimum commons.FieldName = "required_vcpu_minimum" 28 | RequiredVCpuMaximum commons.FieldName = "required_vcpu_maximum" 29 | ) 30 | -------------------------------------------------------------------------------- /spotinst/elastigroup_aws_integrations/fields_spotinst_elastigroup_aws_integrations.go: -------------------------------------------------------------------------------- 1 | package elastigroup_aws_integrations 2 | 3 | import ( 4 | "github.com/spotinst/spotinst-sdk-go/service/elastigroup/providers/aws" 5 | "github.com/spotinst/spotinst-sdk-go/spotinst" 6 | "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 7 | ) 8 | 9 | func Setup(fieldsMap map[commons.FieldName]*commons.GenericField) { 10 | SetupEcs(fieldsMap) 11 | SetupNomad(fieldsMap) 12 | SetupGitlab(fieldsMap) 13 | SetupRancher(fieldsMap) 14 | SetupKubernetes(fieldsMap) 15 | SetupMesosphere(fieldsMap) 16 | SetupCodeDeploy(fieldsMap) 17 | SetupRoute53(fieldsMap) 18 | SetupDockerSwarm(fieldsMap) 19 | SetupElasticBeanstalk(fieldsMap) 20 | } 21 | 22 | func expandAWSGroupAutoScaleHeadroom(data interface{}) (*aws.AutoScaleHeadroom, error) { 23 | if list := data.([]interface{}); len(list) > 0 { 24 | headroom := &aws.AutoScaleHeadroom{} 25 | if list != nil && list[0] != nil { 26 | m := list[0].(map[string]interface{}) 27 | 28 | if v, ok := m[string(CpuPerUnit)].(int); ok && v > 0 { 29 | headroom.SetCPUPerUnit(spotinst.Int(v)) 30 | } 31 | 32 | if v, ok := m[string(MemoryPerUnit)].(int); ok && v > 0 { 33 | headroom.SetMemoryPerUnit(spotinst.Int(v)) 34 | } 35 | 36 | if v, ok := m[string(NumOfUnits)].(int); ok && v > 0 { 37 | headroom.SetNumOfUnits(spotinst.Int(v)) 38 | } 39 | } 40 | return headroom, nil 41 | } 42 | 43 | return nil, nil 44 | } 45 | 46 | func expandAWSGroupAutoScaleDown(data interface{}, isMaxScaleDownPercentageExist bool) (*aws.AutoScaleDown, error) { 47 | if list := data.([]interface{}); len(list) > 0 { 48 | autoScaleDown := &aws.AutoScaleDown{} 49 | if list != nil && list[0] != nil { 50 | m := list[0].(map[string]interface{}) 51 | var maxScaleDownPercentage *float64 = nil 52 | 53 | if v, ok := m[string(EvaluationPeriods)].(int); ok && v > 0 { 54 | autoScaleDown.SetEvaluationPeriods(spotinst.Int(v)) 55 | } 56 | 57 | if v, ok := m[string(MaxScaleDownPercentage)].(float64); ok && v > 0 { 58 | maxScaleDownPercentage = spotinst.Float64(v) 59 | } 60 | if isMaxScaleDownPercentageExist { 61 | autoScaleDown.SetMaxScaleDownPercentage(maxScaleDownPercentage) 62 | } 63 | } 64 | return autoScaleDown, nil 65 | } 66 | 67 | return nil, nil 68 | } 69 | -------------------------------------------------------------------------------- /spotinst/elastigroup_aws_logging/const.go: -------------------------------------------------------------------------------- 1 | package elastigroup_aws_logging 2 | 3 | import ( 4 | "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 5 | ) 6 | 7 | const ( 8 | Logging commons.FieldName = "logging" 9 | Export commons.FieldName = "export" 10 | S3 commons.FieldName = "s3" 11 | Id commons.FieldName = "id" 12 | ) 13 | -------------------------------------------------------------------------------- /spotinst/elastigroup_aws_network_interface/consts.go: -------------------------------------------------------------------------------- 1 | package elastigroup_aws_network_interface 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Prefix = "network_interface_" 7 | ) 8 | 9 | const ( 10 | NetworkInterface commons.FieldName = "network_interface" 11 | Description commons.FieldName = "description" 12 | DeviceIndex commons.FieldName = "device_index" 13 | SecondaryPrivateIpAddressCount commons.FieldName = "secondary_private_ip_address_count" 14 | AssociatePublicIpAddress commons.FieldName = "associate_public_ip_address" 15 | AssociateIPV6Address commons.FieldName = "associate_ipv6_address" 16 | DeleteOnTermination commons.FieldName = "delete_on_termination" 17 | NetworkInterfaceId commons.FieldName = "network_interface_id" 18 | PrivateIpAddress commons.FieldName = "private_ip_address" 19 | ) 20 | -------------------------------------------------------------------------------- /spotinst/elastigroup_aws_scaling_policies/consts.go: -------------------------------------------------------------------------------- 1 | package elastigroup_aws_scaling_policies 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | type DimensionField string 6 | 7 | const ( 8 | ScalingUpPolicy commons.FieldName = "scaling_up_policy" 9 | ScalingDownPolicy commons.FieldName = "scaling_down_policy" 10 | ScalingTargetPolicy commons.FieldName = "scaling_target_policy" 11 | MultipleMetrics commons.FieldName = "multiple_metrics" 12 | 13 | Expressions commons.FieldName = "expressions" 14 | Metrics commons.FieldName = "metrics" 15 | 16 | Expression commons.FieldName = "expression" 17 | Name commons.FieldName = "name" 18 | 19 | PolicyName commons.FieldName = "policy_name" 20 | MetricName commons.FieldName = "metric_name" 21 | Namespace commons.FieldName = "namespace" 22 | Source commons.FieldName = "source" 23 | Statistic commons.FieldName = "statistic" 24 | Unit commons.FieldName = "unit" 25 | Cooldown commons.FieldName = "cooldown" 26 | Dimensions commons.FieldName = "dimensions" 27 | 28 | Threshold commons.FieldName = "threshold" 29 | Adjustment commons.FieldName = "adjustment" 30 | MinTargetCapacity commons.FieldName = "min_target_capacity" 31 | MaxTargetCapacity commons.FieldName = "max_target_capacity" 32 | Operator commons.FieldName = "operator" 33 | EvaluationPeriods commons.FieldName = "evaluation_periods" 34 | Period commons.FieldName = "period" 35 | Minimum commons.FieldName = "minimum" 36 | Maximum commons.FieldName = "maximum" 37 | Target commons.FieldName = "target" 38 | ActionType commons.FieldName = "action_type" 39 | IsEnabled commons.FieldName = "is_enabled" 40 | PredictiveMode commons.FieldName = "predictive_mode" 41 | MaxCapacityPerScale commons.FieldName = "max_capacity_per_scale" 42 | StepAdjustments commons.FieldName = "step_adjustments" 43 | Action commons.FieldName = "action" 44 | Type commons.FieldName = "type" 45 | ExtendedStatistic commons.FieldName = "extended_statistic" 46 | 47 | DimensionName DimensionField = "name" 48 | DimensionValue DimensionField = "value" 49 | ) 50 | -------------------------------------------------------------------------------- /spotinst/elastigroup_aws_scheduled_task/consts.go: -------------------------------------------------------------------------------- 1 | package elastigroup_aws_scheduled_task 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Prefix = "scheduled_task" 7 | ) 8 | 9 | const TaskTypeStatefulUpdateCapacity = "statefulUpdateCapacity" 10 | 11 | const ( 12 | ScheduledTask commons.FieldName = "scheduled_task" 13 | IsEnabled commons.FieldName = "is_enabled" 14 | TaskType commons.FieldName = "task_type" 15 | Frequency commons.FieldName = "frequency" 16 | CronExpression commons.FieldName = "cron_expression" 17 | StartTime commons.FieldName = "start_time" 18 | ScaleTargetCapacity commons.FieldName = "scale_target_capacity" 19 | ScaleMinCapacity commons.FieldName = "scale_min_capacity" 20 | ScaleMaxCapacity commons.FieldName = "scale_max_capacity" 21 | BatchSizePercentage commons.FieldName = "batch_size_percentage" 22 | GracePeriod commons.FieldName = "grace_period" 23 | TargetCapacity commons.FieldName = "target_capacity" 24 | MinCapacity commons.FieldName = "min_capacity" 25 | MaxCapacity commons.FieldName = "max_capacity" 26 | Adjustment commons.FieldName = "adjustment" 27 | AdjustmentPercentage commons.FieldName = "adjustment_percentage" 28 | ) 29 | -------------------------------------------------------------------------------- /spotinst/elastigroup_aws_stateful/consts.go: -------------------------------------------------------------------------------- 1 | package elastigroup_aws_stateful 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | PersistRootDevice commons.FieldName = "persist_root_device" 7 | PersistBlockDevices commons.FieldName = "persist_block_devices" 8 | PersistPrivateIp commons.FieldName = "persist_private_ip" 9 | BlockDevicesMode commons.FieldName = "block_devices_mode" 10 | PrivateIps commons.FieldName = "private_ips" 11 | 12 | // - Deallocation ------------------------- 13 | StatefulDeallocation commons.FieldName = "stateful_deallocation" 14 | ShouldDeleteImages commons.FieldName = "should_delete_images" 15 | ShouldDeleteNetworkInterfaces commons.FieldName = "should_delete_network_interfaces" 16 | ShouldDeleteVolumes commons.FieldName = "should_delete_volumes" 17 | ShouldDeleteSnapshots commons.FieldName = "should_delete_snapshots" 18 | // ---------------------------------------- 19 | 20 | // - Instance Action ---------------------- 21 | StatefulInstanceAction commons.FieldName = "stateful_instance_action" 22 | StatefulInstanceID commons.FieldName = "stateful_instance_id" 23 | ActionType commons.FieldName = "type" 24 | // ---------------------------------------- 25 | ) 26 | -------------------------------------------------------------------------------- /spotinst/elastigroup_aws_strategy/consts.go: -------------------------------------------------------------------------------- 1 | package elastigroup_aws_strategy 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Prefix = "strategy_" 7 | ) 8 | 9 | const ( 10 | SpotPercentage commons.FieldName = "spot_percentage" 11 | OnDemandCount commons.FieldName = "ondemand_count" 12 | Orientation commons.FieldName = "orientation" 13 | LifetimePeriod commons.FieldName = "lifetime_period" 14 | DrainingTimeout commons.FieldName = "draining_timeout" 15 | UtilizeReservedInstances commons.FieldName = "utilize_reserved_instances" 16 | FallbackToOnDemand commons.FieldName = "fallback_to_ondemand" 17 | ScalingStrategy commons.FieldName = "scaling_strategy" 18 | TerminateAtEndOfBillingHour commons.FieldName = "terminate_at_end_of_billing_hour" 19 | TerminationPolicy commons.FieldName = "termination_policy" 20 | UtilizeCommitments commons.FieldName = "utilize_commitments" 21 | MinimumInstanceLifetime commons.FieldName = "minimum_instance_lifetime" 22 | ConsiderODPricing commons.FieldName = "consider_od_pricing" 23 | ImmediateODRecoverThreshold commons.FieldName = "immediate_od_recover_threshold" 24 | RestrictSingleAz commons.FieldName = "restrict_single_az" 25 | MaxReplacementsPercentage commons.FieldName = "max_replacements_percentage" 26 | ) 27 | -------------------------------------------------------------------------------- /spotinst/elastigroup_aws_suspend_processes/consts.go: -------------------------------------------------------------------------------- 1 | package elastigroup_aws_suspend_processes 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | GroupID commons.FieldName = "group_id" 7 | Suspension commons.FieldName = "suspension" 8 | Name commons.FieldName = "name" 9 | ) 10 | -------------------------------------------------------------------------------- /spotinst/elastigroup_gcp/consts.go: -------------------------------------------------------------------------------- 1 | package elastigroup_gcp 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Name commons.FieldName = "name" 7 | Description commons.FieldName = "description" 8 | 9 | AutoHealing commons.FieldName = "auto_healing" 10 | AvailabilityZones commons.FieldName = "availability_zones" 11 | HealthCheckGracePeriod commons.FieldName = "health_check_grace_period" 12 | HealthCheckType commons.FieldName = "health_check_type" 13 | MaxSize commons.FieldName = "max_size" 14 | MinSize commons.FieldName = "min_size" 15 | TargetCapacity commons.FieldName = "desired_capacity" 16 | Subnets commons.FieldName = "subnets" 17 | Region commons.FieldName = "region" 18 | SubnetNames commons.FieldName = "subnet_names" 19 | UnhealthyDuration commons.FieldName = "unhealthy_duration" 20 | PreferredAvailabilityZones commons.FieldName = "preferred_availability_zones" 21 | ) 22 | -------------------------------------------------------------------------------- /spotinst/elastigroup_gcp_disk/consts.go: -------------------------------------------------------------------------------- 1 | package elastigroup_gcp_disk 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Disk commons.FieldName = "disk" 7 | AutoDelete commons.FieldName = "auto_delete" 8 | Boot commons.FieldName = "boot" 9 | DeviceName commons.FieldName = "device_name" 10 | InitializeParams commons.FieldName = "initialize_params" 11 | Interface commons.FieldName = "interface" 12 | Mode commons.FieldName = "mode" 13 | Source commons.FieldName = "source" 14 | Type commons.FieldName = "type" 15 | 16 | DiskSizeGB commons.FieldName = "disk_size_gb" 17 | DiskType commons.FieldName = "disk_type" 18 | SourceImage commons.FieldName = "source_image" 19 | ) 20 | -------------------------------------------------------------------------------- /spotinst/elastigroup_gcp_gpu/consts.go: -------------------------------------------------------------------------------- 1 | package elastigroup_gcp_gpu 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | GPU commons.FieldName = "gpu" 7 | Count commons.FieldName = "count" 8 | Type commons.FieldName = "type" 9 | ) 10 | -------------------------------------------------------------------------------- /spotinst/elastigroup_gcp_gpu/fields_spotinst_elastigroup_gcp_gpu.go: -------------------------------------------------------------------------------- 1 | package elastigroup_gcp_gpu 2 | 3 | import ( 4 | "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" 5 | "github.com/spotinst/spotinst-sdk-go/service/elastigroup/providers/gcp" 6 | "github.com/spotinst/spotinst-sdk-go/spotinst" 7 | "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 8 | ) 9 | 10 | func Setup(fieldsMap map[commons.FieldName]*commons.GenericField) { 11 | fieldsMap[GPU] = commons.NewGenericField( 12 | commons.ElastigroupGCPGPU, 13 | GPU, 14 | &schema.Schema{ 15 | Type: schema.TypeSet, 16 | Optional: true, 17 | Elem: &schema.Resource{ 18 | Schema: map[string]*schema.Schema{ 19 | string(Count): { 20 | Type: schema.TypeInt, 21 | Required: true, 22 | }, 23 | 24 | string(Type): { 25 | Type: schema.TypeString, 26 | Required: true, 27 | }, 28 | }, 29 | }, 30 | // 31 | }, 32 | func(resourceObject interface{}, resourceData *schema.ResourceData, meta interface{}) error { 33 | return nil 34 | }, 35 | func(resourceObject interface{}, resourceData *schema.ResourceData, meta interface{}) error { 36 | egWrapper := resourceObject.(*commons.ElastigroupGCPWrapper) 37 | elastigroup := egWrapper.GetElastigroup() 38 | if v, ok := resourceData.GetOk(string(GPU)); ok { 39 | if gpu, err := expandGPU(v); err != nil { 40 | return err 41 | } else { 42 | elastigroup.Compute.SetGPU(gpu) 43 | } 44 | } 45 | return nil 46 | }, 47 | func(resourceObject interface{}, resourceData *schema.ResourceData, meta interface{}) error { 48 | egWrapper := resourceObject.(*commons.ElastigroupGCPWrapper) 49 | elastigroup := egWrapper.GetElastigroup() 50 | var result *gcp.GPU = nil 51 | if v, ok := resourceData.GetOk(string(GPU)); ok { 52 | if gpu, err := expandGPU(v); err != nil { 53 | return err 54 | } else { 55 | result = gpu 56 | } 57 | } 58 | elastigroup.Compute.SetGPU(result) 59 | return nil 60 | }, 61 | nil, 62 | ) 63 | 64 | } 65 | 66 | func expandGPU(data interface{}) (*gcp.GPU, error) { 67 | list := data.(*schema.Set).List() 68 | gpu := &gcp.GPU{} 69 | for _, item := range list { 70 | m := item.(map[string]interface{}) 71 | 72 | if v, ok := m[string(Count)].(int); ok && v >= 0 { 73 | gpu.SetCount(spotinst.Int(v)) 74 | } 75 | if v, ok := m[string(Type)].(string); ok && v != "" { 76 | gpu.SetType(spotinst.String(v)) 77 | } 78 | } 79 | return gpu, nil 80 | } 81 | -------------------------------------------------------------------------------- /spotinst/elastigroup_gcp_instance_types/consts.go: -------------------------------------------------------------------------------- 1 | package elastigroup_gcp_instance_types 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Prefix = "instance_types_" 7 | ) 8 | 9 | const ( 10 | OnDemand commons.FieldName = Prefix + "ondemand" 11 | Preemptible commons.FieldName = Prefix + "preemptible" 12 | Custom commons.FieldName = Prefix + "custom" 13 | 14 | VCPU commons.FieldName = "vcpu" 15 | MemoryGiB commons.FieldName = "memory_gib" 16 | ) 17 | -------------------------------------------------------------------------------- /spotinst/elastigroup_gcp_integrations/consts.go: -------------------------------------------------------------------------------- 1 | package elastigroup_gcp_integrations 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | // - DOCKER-SWARM -------------------- 7 | IntegrationDockerSwarm commons.FieldName = "integration_docker_swarm" 8 | MasterHost commons.FieldName = "master_host" 9 | MasterPort commons.FieldName = "master_port" 10 | // ----------------------------------- 11 | 12 | // - GKE ----------------------------- 13 | ClusterID commons.FieldName = "cluster_id" 14 | Location commons.FieldName = "location" 15 | IntegrationGKE commons.FieldName = "integration_gke" 16 | AutoUpdate commons.FieldName = "auto_update" 17 | Autoscale commons.FieldName = "autoscale" 18 | AutoscaleIsEnabled commons.FieldName = "autoscale_is_enabled" 19 | AutoscaleIsAutoConfig commons.FieldName = "autoscale_is_auto_config" 20 | AutoscaleCooldown commons.FieldName = "autoscale_cooldown" 21 | 22 | AutoscaleHeadroom commons.FieldName = "autoscale_headroom" 23 | CpuPerUnit commons.FieldName = "cpu_per_unit" 24 | MemoryPerUnit commons.FieldName = "memory_per_unit" 25 | NumOfUnits commons.FieldName = "num_of_units" 26 | 27 | AutoscaleDown commons.FieldName = "autoscale_down" 28 | EvaluationPeriods commons.FieldName = "evaluation_periods" 29 | 30 | AutoscaleLabels commons.FieldName = "autoscale_labels" 31 | Key commons.FieldName = "key" 32 | Value commons.FieldName = "value" 33 | // ----------------------------------- 34 | ) 35 | -------------------------------------------------------------------------------- /spotinst/elastigroup_gcp_integrations/fields_spotinst_elastigroup_gcp_integrations.go: -------------------------------------------------------------------------------- 1 | package elastigroup_gcp_integrations 2 | 3 | import ( 4 | "github.com/spotinst/spotinst-sdk-go/service/elastigroup/providers/gcp" 5 | "github.com/spotinst/spotinst-sdk-go/spotinst" 6 | "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 7 | ) 8 | 9 | func Setup(fieldsMap map[commons.FieldName]*commons.GenericField) { 10 | SetupDockerSwarm(fieldsMap) 11 | SetupGKE(fieldsMap) 12 | } 13 | 14 | func expandGCPGroupAutoScaleHeadroom(data interface{}) (*gcp.AutoScaleHeadroom, error) { 15 | if list := data.([]interface{}); len(list) > 0 { 16 | headroom := &gcp.AutoScaleHeadroom{} 17 | if list != nil && list[0] != nil { 18 | m := list[0].(map[string]interface{}) 19 | 20 | if v, ok := m[string(CpuPerUnit)].(int); ok && v > 0 { 21 | headroom.SetCPUPerUnit(spotinst.Int(v)) 22 | } 23 | 24 | if v, ok := m[string(MemoryPerUnit)].(int); ok && v > 0 { 25 | headroom.SetMemoryPerUnit(spotinst.Int(v)) 26 | } 27 | 28 | if v, ok := m[string(NumOfUnits)].(int); ok && v > 0 { 29 | headroom.SetNumOfUnits(spotinst.Int(v)) 30 | } 31 | } 32 | return headroom, nil 33 | } 34 | 35 | return nil, nil 36 | } 37 | 38 | func expandGCPGroupAutoScaleDown(data interface{}) (*gcp.AutoScaleDown, error) { 39 | if list := data.([]interface{}); len(list) > 0 { 40 | autoScaleDown := &gcp.AutoScaleDown{} 41 | if list != nil && list[0] != nil { 42 | m := list[0].(map[string]interface{}) 43 | 44 | if v, ok := m[string(EvaluationPeriods)].(int); ok && v > 0 { 45 | autoScaleDown.SetEvaluationPeriods(spotinst.Int(v)) 46 | } 47 | } 48 | return autoScaleDown, nil 49 | } 50 | 51 | return nil, nil 52 | } 53 | -------------------------------------------------------------------------------- /spotinst/elastigroup_gcp_launch_configuration/consts.go: -------------------------------------------------------------------------------- 1 | package elastigroup_gcp_launch_configuration 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | type LabelField string 6 | type MetadataField string 7 | 8 | const ( 9 | LabelKey LabelField = "key" 10 | LabelValue LabelField = "value" 11 | 12 | MetadataKey MetadataField = "key" 13 | MetadataValue MetadataField = "value" 14 | ) 15 | 16 | const ( 17 | Labels commons.FieldName = "labels" 18 | Metadata commons.FieldName = "metadata" 19 | Tags commons.FieldName = "tags" 20 | 21 | BackendServices commons.FieldName = "backend_services" 22 | Name commons.FieldName = "name" 23 | LocationType commons.FieldName = "location_type" 24 | Scheme commons.FieldName = "scheme" 25 | NamedPorts commons.FieldName = "named_ports" 26 | 27 | Ports commons.FieldName = "ports" 28 | ServiceName commons.FieldName = "service_name" 29 | ServiceAccount commons.FieldName = "service_account" 30 | StartupScript commons.FieldName = "startup_script" 31 | ShutdownScript commons.FieldName = "shutdown_script" 32 | IPForwarding commons.FieldName = "ip_forwarding" 33 | InstanceNamePrefix commons.FieldName = "instance_name_prefix" 34 | MinCpuPlatform commons.FieldName = "min_cpu_platform" 35 | ) 36 | 37 | const ( 38 | ShieldedInstanceConfig commons.FieldName = "shielded_instance_config" 39 | EnableSecureBoot commons.FieldName = "enable_secure_boot" 40 | EnableIntegrityMonitoring commons.FieldName = "enable_integrity_monitoring" 41 | ) 42 | -------------------------------------------------------------------------------- /spotinst/elastigroup_gcp_network_interface/consts.go: -------------------------------------------------------------------------------- 1 | package elastigroup_gcp_network_interface 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | NetworkInterface commons.FieldName = "network_interface" 7 | Network commons.FieldName = "network" 8 | AccessConfigs commons.FieldName = "access_configs" 9 | AliasIPRanges commons.FieldName = "alias_ip_ranges" 10 | 11 | IPCIDRRange commons.FieldName = "ip_cidr_range" 12 | SubnetworkRangeName commons.FieldName = "subnetwork_range_name" 13 | Name commons.FieldName = "name" 14 | Type commons.FieldName = "type" 15 | ) 16 | -------------------------------------------------------------------------------- /spotinst/elastigroup_gcp_scaling_policies/consts.go: -------------------------------------------------------------------------------- 1 | package elastigroup_gcp_scaling_policies 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | ScalingDownPolicy commons.FieldName = "scaling_down_policy" 7 | ScalingUpPolicy commons.FieldName = "scaling_up_policy" 8 | 9 | Cooldown commons.FieldName = "cooldown" 10 | Dimensions commons.FieldName = "dimensions" 11 | MetricName commons.FieldName = "metric_name" 12 | Namespace commons.FieldName = "namespace" 13 | PolicyName commons.FieldName = "policy_name" 14 | Source commons.FieldName = "source" 15 | Statistic commons.FieldName = "statistic" 16 | Unit commons.FieldName = "unit" 17 | 18 | ActionType commons.FieldName = "action_type" 19 | Adjustment commons.FieldName = "adjustment" 20 | EvaluationPeriods commons.FieldName = "evaluation_periods" 21 | Operator commons.FieldName = "operator" 22 | Period commons.FieldName = "period" 23 | Threshold commons.FieldName = "threshold" 24 | 25 | DimensionName commons.FieldName = "name" 26 | DimensionValue commons.FieldName = "value" 27 | ) 28 | -------------------------------------------------------------------------------- /spotinst/elastigroup_gcp_scheduled_task/consts.go: -------------------------------------------------------------------------------- 1 | package elastigroup_gcp_scheduled_task 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | ScheduledTask commons.FieldName = "scheduled_task" 7 | IsEnabled commons.FieldName = "is_enabled" 8 | TaskType commons.FieldName = "task_type" 9 | CronExpression commons.FieldName = "cron_expression" 10 | TargetCapacity commons.FieldName = "target_capacity" 11 | MinCapacity commons.FieldName = "min_capacity" 12 | MaxCapacity commons.FieldName = "max_capacity" 13 | ) 14 | -------------------------------------------------------------------------------- /spotinst/elastigroup_gcp_strategy/consts.go: -------------------------------------------------------------------------------- 1 | package elastigroup_gcp_strategy 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | PreemptiblePercentage commons.FieldName = "preemptible_percentage" 7 | OnDemandCount commons.FieldName = "ondemand_count" 8 | DrainingTimeout commons.FieldName = "draining_timeout" 9 | FallbackToOnDemand commons.FieldName = "fallback_to_ondemand" 10 | ProvisioningModel commons.FieldName = "provisioning_model" 11 | OptimizationWindows commons.FieldName = "optimization_windows" 12 | RevertToPreemptible commons.FieldName = "revert_to_preemptible" 13 | PerformAt commons.FieldName = "perform_at" 14 | ShouldUtilizeCommitments commons.FieldName = "should_utilize_commitments" 15 | ) 16 | -------------------------------------------------------------------------------- /spotinst/elastigroup_gke/consts.go: -------------------------------------------------------------------------------- 1 | package elastigroup_gke 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Name commons.FieldName = "name" 7 | NodeImage commons.FieldName = "node_image" 8 | Location commons.FieldName = "location" 9 | 10 | MaxSize commons.FieldName = "max_size" 11 | MinSize commons.FieldName = "min_size" 12 | TargetCapacity commons.FieldName = "desired_capacity" 13 | AvailabilityZones commons.FieldName = "availability_zones" 14 | PreemptiblePercentage commons.FieldName = "preemptible_percentage" 15 | 16 | // - GKE ----------------------------- 17 | ClusterZoneName commons.FieldName = "cluster_zone_name" 18 | ClusterID commons.FieldName = "cluster_id" 19 | // ----------------------------------- 20 | ) 21 | -------------------------------------------------------------------------------- /spotinst/elastigroup_sweeper_test.go: -------------------------------------------------------------------------------- 1 | package spotinst 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | "strings" 7 | "testing" 8 | 9 | "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" 10 | ) 11 | 12 | func TestMain(m *testing.M) { 13 | resource.TestMain(m) 14 | } 15 | 16 | // getProviderClient returns a spotinst client setup with the correct cloud provider configs 17 | func getProviderClient(provider string) (interface{}, error) { 18 | token := "SPOTINST_TOKEN_" + strings.ToUpper(provider) 19 | account := "SPOTINST_ACCOUNT_" + strings.ToUpper(provider) 20 | if os.Getenv(token) == "" && (os.Getenv(account) == "") { 21 | return nil, fmt.Errorf("must provide environment variables SPOTINST_TOKEN_AWS and SPOTINST_ACCOUNT_AWS") 22 | } 23 | 24 | conf := &Config{ 25 | Token: os.Getenv(token), 26 | Account: os.Getenv(account), 27 | } 28 | 29 | // configures a default client for the given provider 30 | client, err := conf.Client() 31 | if err != nil { 32 | return nil, fmt.Errorf("error getting Spotinst client") 33 | } 34 | 35 | return client, nil 36 | } 37 | -------------------------------------------------------------------------------- /spotinst/health_check/consts.go: -------------------------------------------------------------------------------- 1 | package health_check 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Name commons.FieldName = "name" 7 | ResourceId commons.FieldName = "resource_id" 8 | ProxyAddr commons.FieldName = "proxy_address" 9 | ProxyPort commons.FieldName = "proxy_port" 10 | Check commons.FieldName = "check" 11 | Protocol commons.FieldName = "protocol" 12 | Port commons.FieldName = "port" 13 | Endpoint commons.FieldName = "endpoint" 14 | Interval commons.FieldName = "interval" 15 | Timeout commons.FieldName = "timeout" 16 | Unhealthy commons.FieldName = "unhealthy" 17 | Healthy commons.FieldName = "healthy" 18 | 19 | // Deprecated: EndPoint is obsolete, exists for backward compatibility only, 20 | // and should not be used. Please use Endpoint instead. 21 | EndPoint commons.FieldName = "end_point" 22 | 23 | // Deprecated: TimeOut is obsolete, exists for backward compatibility only, 24 | // and should not be used. Please use Timeout instead. 25 | TimeOut commons.FieldName = "time_out" 26 | ) 27 | -------------------------------------------------------------------------------- /spotinst/mrscaler_aws/consts.go: -------------------------------------------------------------------------------- 1 | package mrscaler_aws 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | type TagField string 6 | 7 | const ( 8 | TagKey TagField = "key" 9 | TagValue TagField = "value" 10 | ) 11 | 12 | const ( 13 | Name commons.FieldName = "name" 14 | Description commons.FieldName = "description" 15 | Region commons.FieldName = "region" 16 | Strategy commons.FieldName = "strategy" 17 | AvailabilityZones commons.FieldName = "availability_zones" 18 | Tags commons.FieldName = "tags" 19 | ClusterID commons.FieldName = "cluster_id" 20 | ExposeClusterID commons.FieldName = "expose_cluster_id" 21 | OutputClusterID commons.FieldName = "output_cluster_id" 22 | 23 | ConfigurationsFile commons.FieldName = "configurations_file" 24 | BootstrapActionsFile commons.FieldName = "bootstrap_actions_file" 25 | StepsFile commons.FieldName = "steps_file" 26 | Bucket commons.FieldName = "bucket" 27 | Key commons.FieldName = "key" 28 | 29 | EBSRootVolumeSize commons.FieldName = "ebs_root_volume_size" 30 | ManagedPrimarySecurityGroup commons.FieldName = "managed_primary_security_group" 31 | ManagedReplicaSecurityGroup commons.FieldName = "managed_replica_security_group" 32 | ServiceAccessSecurityGroup commons.FieldName = "service_access_security_group" 33 | AddlPrimarySecurityGroups commons.FieldName = "additional_primary_security_groups" 34 | AddlReplicaSecurityGroups commons.FieldName = "additional_replica_security_groups" 35 | CustomAMIID commons.FieldName = "custom_ami_id" 36 | RepoUpgradeOnBoot commons.FieldName = "repo_upgrade_on_boot" 37 | EC2KeyName commons.FieldName = "ec2_key_name" 38 | 39 | Applications commons.FieldName = "applications" 40 | Args commons.FieldName = "args" 41 | AppName commons.FieldName = "name" 42 | Version commons.FieldName = "version" 43 | 44 | InstanceWeights commons.FieldName = "instance_weights" 45 | InstanceType commons.FieldName = "instance_type" 46 | WeightedCapacity commons.FieldName = "weighted_capacity" 47 | ) 48 | -------------------------------------------------------------------------------- /spotinst/mrscaler_aws_cluster/consts.go: -------------------------------------------------------------------------------- 1 | package mrscaler_aws_cluster 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Cluster commons.FieldName = "cluster" 7 | LogURI commons.FieldName = "log_uri" 8 | AdditionalInfo commons.FieldName = "additional_info" 9 | JobFlowRole commons.FieldName = "job_flow_role" 10 | SecurityConfig commons.FieldName = "security_config" 11 | ServiceRole commons.FieldName = "service_role" 12 | VisibleToAllUsers commons.FieldName = "visible_to_all_users" 13 | TerminationProtected commons.FieldName = "termination_protected" 14 | KeepJobFlowAlive commons.FieldName = "keep_job_flow_alive" 15 | ) 16 | -------------------------------------------------------------------------------- /spotinst/mrscaler_aws_instance_groups/consts.go: -------------------------------------------------------------------------------- 1 | package mrscaler_aws_instance_groups 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | TaskInstanceTypes commons.FieldName = "task_instance_types" 7 | TaskMin commons.FieldName = "task_min_size" 8 | TaskMax commons.FieldName = "task_max_size" 9 | TaskTarget commons.FieldName = "task_desired_capacity" 10 | TaskUnit commons.FieldName = "task_unit" 11 | TaskLifecycle commons.FieldName = "task_lifecycle" 12 | TaskEBSBlockDevice commons.FieldName = "task_ebs_block_device" 13 | TaskEBSOptimized commons.FieldName = "task_ebs_optimized" 14 | 15 | MasterInstanceTypes commons.FieldName = "master_instance_types" 16 | MasterLifecycle commons.FieldName = "master_lifecycle" 17 | MasterEBSBlockDevice commons.FieldName = "master_ebs_block_device" 18 | MasterEBSOptimized commons.FieldName = "master_ebs_optimized" 19 | MasterTarget commons.FieldName = "master_target" 20 | 21 | CoreInstanceTypes commons.FieldName = "core_instance_types" 22 | CoreMin commons.FieldName = "core_min_size" 23 | CoreMax commons.FieldName = "core_max_size" 24 | CoreTarget commons.FieldName = "core_desired_capacity" 25 | CoreLifecycle commons.FieldName = "core_lifecycle" 26 | CoreUnit commons.FieldName = "core_unit" 27 | CoreEBSBlockDevice commons.FieldName = "core_ebs_block_device" 28 | CoreEBSOptimized commons.FieldName = "core_ebs_optimized" 29 | 30 | VolumesPerInstance commons.FieldName = "volumes_per_instance" 31 | VolumeType commons.FieldName = "volume_type" 32 | SizeInGB commons.FieldName = "size_in_gb" 33 | IOPS commons.FieldName = "iops" 34 | ) 35 | -------------------------------------------------------------------------------- /spotinst/mrscaler_aws_instance_groups/fields_spotinst_mrscaler_aws_instance_groups.go: -------------------------------------------------------------------------------- 1 | package mrscaler_aws_instance_groups 2 | 3 | import ( 4 | "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" 5 | "github.com/spotinst/spotinst-sdk-go/service/mrscaler" 6 | "github.com/spotinst/spotinst-sdk-go/spotinst" 7 | "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 8 | ) 9 | 10 | func Setup(fieldsMap map[commons.FieldName]*commons.GenericField) { 11 | SetupCoreGroup(fieldsMap) 12 | SetupMasterGroup(fieldsMap) 13 | SetupTaskGroup(fieldsMap) 14 | } 15 | 16 | func expandScalerAWSBlockDevices(data interface{}) ([]*mrscaler.BlockDeviceConfig, error) { 17 | list := data.(*schema.Set).List() 18 | devices := make([]*mrscaler.BlockDeviceConfig, 0, len(list)) 19 | for _, item := range list { 20 | m := item.(map[string]interface{}) 21 | blockDevice := &mrscaler.BlockDeviceConfig{VolumeSpecification: &mrscaler.VolumeSpecification{}} 22 | 23 | if v, ok := m[string(VolumesPerInstance)].(int); ok { 24 | blockDevice.SetVolumesPerInstance(spotinst.Int(v)) 25 | } 26 | 27 | if v, ok := m[string(VolumeType)].(string); ok { 28 | blockDevice.VolumeSpecification.SetVolumeType(spotinst.String(v)) 29 | } 30 | 31 | if v, ok := m[string(SizeInGB)].(int); ok { 32 | blockDevice.VolumeSpecification.SetSizeInGB(spotinst.Int(v)) 33 | } 34 | 35 | if v, ok := m[string(IOPS)].(int); ok && v > 0 { 36 | blockDevice.VolumeSpecification.SetIOPS(spotinst.Int(v)) 37 | } 38 | 39 | devices = append(devices, blockDevice) 40 | } 41 | 42 | return devices, nil 43 | } 44 | 45 | func expandInstanceTypesList(instanceTypes interface{}) []string { 46 | list := instanceTypes.([]interface{}) 47 | types := make([]string, 0, len(list)) 48 | for _, str := range list { 49 | if typ, ok := str.(string); ok { 50 | types = append(types, typ) 51 | } 52 | } 53 | return types 54 | } 55 | 56 | func flattenMRscalerEBSBlockDevices(devices []*mrscaler.BlockDeviceConfig) []interface{} { 57 | result := make([]interface{}, 0, len(devices)) 58 | for _, dev := range devices { 59 | m := make(map[string]interface{}) 60 | 61 | m[string(VolumesPerInstance)] = spotinst.IntValue(dev.VolumesPerInstance) 62 | 63 | if dev.VolumeSpecification != nil { 64 | m[string(SizeInGB)] = spotinst.IntValue(dev.VolumeSpecification.SizeInGB) 65 | m[string(VolumeType)] = spotinst.StringValue(dev.VolumeSpecification.VolumeType) 66 | m[string(IOPS)] = spotinst.IntValue(dev.VolumeSpecification.IOPS) 67 | } 68 | result = append(result, m) 69 | } 70 | return result 71 | } 72 | -------------------------------------------------------------------------------- /spotinst/mrscaler_aws_scaling_policies/consts.go: -------------------------------------------------------------------------------- 1 | package mrscaler_aws_scaling_policies 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | TaskScalingUpPolicy commons.FieldName = "task_scaling_up_policy" 7 | TaskScalingDownPolicy commons.FieldName = "task_scaling_down_policy" 8 | CoreScalingUpPolicy commons.FieldName = "core_scaling_up_policy" 9 | CoreScalingDownPolicy commons.FieldName = "core_scaling_down_policy" 10 | 11 | //ScalingDownPolicy commons.FieldName = "scaling_down_policy" 12 | //ScalingUpPolicy commons.FieldName = "scaling_up_policy" 13 | 14 | Cooldown commons.FieldName = "cooldown" 15 | Dimensions commons.FieldName = "dimensions" 16 | MetricName commons.FieldName = "metric_name" 17 | Namespace commons.FieldName = "namespace" 18 | PolicyName commons.FieldName = "policy_name" 19 | Statistic commons.FieldName = "statistic" 20 | Unit commons.FieldName = "unit" 21 | 22 | ActionType commons.FieldName = "action_type" 23 | Adjustment commons.FieldName = "adjustment" 24 | EvaluationPeriods commons.FieldName = "evaluation_periods" 25 | Operator commons.FieldName = "operator" 26 | Period commons.FieldName = "period" 27 | Threshold commons.FieldName = "threshold" 28 | Minimum commons.FieldName = "minimum" 29 | Maximum commons.FieldName = "maximum" 30 | Target commons.FieldName = "target" 31 | MinTargetCapacity commons.FieldName = "min_target_capacity" 32 | MaxTargetCapacity commons.FieldName = "max_target_capacity" 33 | ) 34 | -------------------------------------------------------------------------------- /spotinst/mrscaler_aws_scheduled_task/consts.go: -------------------------------------------------------------------------------- 1 | package mrscaler_aws_scheduled_task 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | ScheduledTask commons.FieldName = "scheduled_task" 7 | IsEnabled commons.FieldName = "is_enabled" 8 | TaskType commons.FieldName = "task_type" 9 | InstanceGroupType commons.FieldName = "instance_group_type" 10 | CronExpression commons.FieldName = "cron" 11 | TargetCapacity commons.FieldName = "desired_capacity" 12 | MinCapacity commons.FieldName = "min_capacity" 13 | MaxCapacity commons.FieldName = "max_capacity" 14 | ) 15 | -------------------------------------------------------------------------------- /spotinst/mrscaler_aws_strategy/consts.go: -------------------------------------------------------------------------------- 1 | package mrscaler_aws_strategy 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Clone = "clone" 7 | Wrap = "wrap" 8 | New = "new" 9 | ) 10 | 11 | const ( 12 | Strategy commons.FieldName = "strategy" 13 | 14 | ProvisioningTimeout commons.FieldName = "provisioning_timeout" 15 | TimeoutAction commons.FieldName = "timeout_action" 16 | Timeout commons.FieldName = "timeout" 17 | ReleaseLabel commons.FieldName = "release_label" 18 | Retries commons.FieldName = "retries" 19 | ) 20 | -------------------------------------------------------------------------------- /spotinst/mrscaler_aws_terminationPolicies/consts.go: -------------------------------------------------------------------------------- 1 | package mrscaler_aws_terminationPolicies 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | TerminationPolicies commons.FieldName = "termination_policies" 7 | Statements commons.FieldName = "statements" 8 | Namespace commons.FieldName = "namespace" 9 | MetricName commons.FieldName = "metric_name" 10 | Statistic commons.FieldName = "statistic" 11 | Unit commons.FieldName = "unit" 12 | Threshold commons.FieldName = "threshold" 13 | Period commons.FieldName = "period" 14 | EvaluationPeriods commons.FieldName = "evaluation_periods" 15 | Operator commons.FieldName = "operator" 16 | ) 17 | -------------------------------------------------------------------------------- /spotinst/ocean_aks_np/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_aks_np 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Name commons.FieldName = "name" 7 | ControllerClusterID commons.FieldName = "controller_cluster_id" 8 | AvailabilityZones commons.FieldName = "availability_zones" 9 | AKSClusterName commons.FieldName = "aks_cluster_name" 10 | AKSResourceGroupName commons.FieldName = "aks_resource_group_name" 11 | AKSRegion commons.FieldName = "aks_region" 12 | AKSInfrastructureResourceGroupName commons.FieldName = "aks_infrastructure_resource_group_name" 13 | 14 | UpdatePolicy commons.FieldName = "update_policy" 15 | ShouldRoll commons.FieldName = "should_roll" 16 | ConditionedRoll commons.FieldName = "conditioned_roll" 17 | 18 | RollConfig commons.FieldName = "roll_config" 19 | BatchSizePercentage commons.FieldName = "batch_size_percentage" 20 | VngIDs commons.FieldName = "vng_ids" 21 | BatchMinHealthyPercentage commons.FieldName = "batch_min_healthy_percentage" 22 | RespectPDB commons.FieldName = "respect_pdb" 23 | Comment commons.FieldName = "comment" 24 | NodePoolNames commons.FieldName = "node_pool_names" 25 | RespectRestrictScaleDown commons.FieldName = "respect_restrict_scale_down" 26 | NodeNames commons.FieldName = "node_names" 27 | ) 28 | const ( 29 | VNG_Template_Scheduling commons.FieldName = "vng_template_scheduling" 30 | ShutdownHours commons.FieldName = "vng_template_shutdown_hours" 31 | TimeWindows commons.FieldName = "time_windows" 32 | ShutdownHoursIsEnabled commons.FieldName = "is_enabled" 33 | ) 34 | -------------------------------------------------------------------------------- /spotinst/ocean_aks_np_auto_scale/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_aks_np_auto_scale 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Headrooms commons.FieldName = "headrooms" 7 | CpuPerUnit commons.FieldName = "cpu_per_unit" 8 | MemoryPerUnit commons.FieldName = "memory_per_unit" 9 | GpuPerUnit commons.FieldName = "gpu_per_unit" 10 | NumOfUnits commons.FieldName = "num_of_units" 11 | ) 12 | -------------------------------------------------------------------------------- /spotinst/ocean_aks_np_auto_scaler/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_aks_np_auto_scaler 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | AutoScaler commons.FieldName = "autoscaler" 7 | AutoscaleIsEnabled commons.FieldName = "autoscale_is_enabled" 8 | ) 9 | 10 | const ( 11 | ResourceLimits commons.FieldName = "resource_limits" 12 | MaxVCPU commons.FieldName = "max_vcpu" 13 | MaxMemoryGib commons.FieldName = "max_memory_gib" 14 | ) 15 | 16 | const ( 17 | Down commons.FieldName = "autoscale_down" 18 | MaxScaleDownPercentage commons.FieldName = "max_scale_down_percentage" 19 | ) 20 | 21 | const ( 22 | Headroom commons.FieldName = "autoscale_headroom" 23 | Automatic commons.FieldName = "automatic" 24 | Percentage commons.FieldName = "percentage" 25 | IsEnabled commons.FieldName = "is_enabled" 26 | ) 27 | -------------------------------------------------------------------------------- /spotinst/ocean_aks_np_health/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_aks_np_health 2 | 3 | import ( 4 | "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 5 | ) 6 | 7 | const ( 8 | Health commons.FieldName = "health" 9 | GracePeriod commons.FieldName = "grace_period" 10 | ) 11 | -------------------------------------------------------------------------------- /spotinst/ocean_aks_np_logging/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_aks_np_logging 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Logging commons.FieldName = "logging" 7 | Export commons.FieldName = "export" 8 | AzureBlob commons.FieldName = "azure_blob" 9 | Id commons.FieldName = "id" 10 | ) 11 | -------------------------------------------------------------------------------- /spotinst/ocean_aks_np_node_count_limits/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_aks_np_node_count_limits 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | type TaintField string 6 | 7 | const ( 8 | MinCount commons.FieldName = "min_count" 9 | MaxCount commons.FieldName = "max_count" 10 | ) 11 | 12 | const ( 13 | Tags commons.FieldName = "tags" 14 | ) 15 | 16 | const ( 17 | Label commons.FieldName = "labels" 18 | ) 19 | 20 | const ( 21 | Taint commons.FieldName = "taints" 22 | TaintKey TaintField = "key" 23 | TaintValue TaintField = "value" 24 | TaintEffect TaintField = "effect" 25 | ) 26 | -------------------------------------------------------------------------------- /spotinst/ocean_aks_np_node_pool_properties/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_aks_np_node_pool_properties 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | MaxPodsPerNode commons.FieldName = "max_pods_per_node" 7 | EnableNodePublicIP commons.FieldName = "enable_node_public_ip" 8 | OsDiskSizeGB commons.FieldName = "os_disk_size_gb" 9 | OsDiskType commons.FieldName = "os_disk_type" 10 | OsType commons.FieldName = "os_type" 11 | OsSKU commons.FieldName = "os_sku" 12 | KubernetesVersion commons.FieldName = "kubernetes_version" 13 | PodSubnetIDs commons.FieldName = "pod_subnet_ids" 14 | VnetSubnetIDs commons.FieldName = "vnet_subnet_ids" 15 | LinuxOSConfig commons.FieldName = "linux_os_config" 16 | Sysctls commons.FieldName = "sysctls" 17 | VmMaxMapCount commons.FieldName = "vm_max_map_count" 18 | ) 19 | -------------------------------------------------------------------------------- /spotinst/ocean_aks_np_scheduling/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_aks_np_scheduling 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Scheduling commons.FieldName = "scheduling" 7 | ShutdownHours commons.FieldName = "shutdown_hours" 8 | TimeWindows commons.FieldName = "time_windows" 9 | SchedulingIsEnabled commons.FieldName = "is_enabled" 10 | SuspensionHours commons.FieldName = "suspension_hours" 11 | ) 12 | const ( 13 | Tasks commons.FieldName = "tasks" 14 | TasksIsEnabled commons.FieldName = "is_enabled" 15 | Parameters commons.FieldName = "parameters" 16 | ParametersClusterRoll commons.FieldName = "parameters_cluster_roll" 17 | TaskType commons.FieldName = "task_type" 18 | CronExpression commons.FieldName = "cron_expression" 19 | BatchMinHealthyPercentage commons.FieldName = "batch_min_healthy_percentage" 20 | BatchSizePercentage commons.FieldName = "batch_size_percentage" 21 | Comment commons.FieldName = "comment" 22 | RespectPdb commons.FieldName = "respect_pdb" 23 | RespectRestrictScaleDown commons.FieldName = "respect_restrict_scale_down" 24 | VngIDs commons.FieldName = "vng_ids" 25 | ) 26 | const ( 27 | ParametersUpgradeConfig commons.FieldName = "parameters_upgrade_config" 28 | ApplyRoll commons.FieldName = "apply_roll" 29 | ScopeVersion commons.FieldName = "scope_version" 30 | RollParameters commons.FieldName = "roll_parameters" 31 | ) 32 | -------------------------------------------------------------------------------- /spotinst/ocean_aks_np_strategy/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_aks_np_strategy 2 | 3 | import ( 4 | "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 5 | ) 6 | 7 | const ( 8 | SpotPercentage commons.FieldName = "spot_percentage" 9 | FallbackToOnDemand commons.FieldName = "fallback_to_ondemand" 10 | ) 11 | -------------------------------------------------------------------------------- /spotinst/ocean_aks_np_virtual_node_group/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_aks_np_virtual_node_group 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | OceanID commons.FieldName = "ocean_id" 7 | Name commons.FieldName = "name" 8 | AvailabilityZones commons.FieldName = "availability_zones" 9 | Tags commons.FieldName = "tags" 10 | Labels commons.FieldName = "labels" 11 | ) 12 | 13 | const ( 14 | Taints commons.FieldName = "taints" 15 | TaintKey commons.FieldName = "key" 16 | TaintValue commons.FieldName = "value" 17 | TaintEffect commons.FieldName = "effect" 18 | 19 | UpdatePolicy commons.FieldName = "update_policy" 20 | ShouldRoll commons.FieldName = "should_roll" 21 | ConditionedRoll commons.FieldName = "conditioned_roll" 22 | 23 | RollConfig commons.FieldName = "roll_config" 24 | BatchSizePercentage commons.FieldName = "batch_size_percentage" 25 | VngIDs commons.FieldName = "vng_ids" 26 | BatchMinHealthyPercentage commons.FieldName = "batch_min_healthy_percentage" 27 | RespectPDB commons.FieldName = "respect_pdb" 28 | Comment commons.FieldName = "comment" 29 | NodePoolNames commons.FieldName = "node_pool_names" 30 | RespectRestrictScaleDown commons.FieldName = "respect_restrict_scale_down" 31 | NodeNames commons.FieldName = "node_names" 32 | ) 33 | -------------------------------------------------------------------------------- /spotinst/ocean_aks_np_virtual_node_group_auto_scale/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_aks_np_virtual_node_group_auto_scale 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Headrooms commons.FieldName = "headrooms" 7 | CpuPerUnit commons.FieldName = "cpu_per_unit" 8 | MemoryPerUnit commons.FieldName = "memory_per_unit" 9 | GpuPerUnit commons.FieldName = "gpu_per_unit" 10 | NumOfUnits commons.FieldName = "num_of_units" 11 | ) 12 | -------------------------------------------------------------------------------- /spotinst/ocean_aks_np_virtual_node_group_node_count_limits/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_aks_np_virtual_node_group_node_count_limits 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | MinCount commons.FieldName = "min_count" 7 | MaxCount commons.FieldName = "max_count" 8 | ) 9 | -------------------------------------------------------------------------------- /spotinst/ocean_aks_np_virtual_node_group_node_pool_properties/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_aks_np_virtual_node_group_node_pool_properties 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | MaxPodsPerNode commons.FieldName = "max_pods_per_node" 7 | EnableNodePublicIP commons.FieldName = "enable_node_public_ip" 8 | OsDiskSizeGB commons.FieldName = "os_disk_size_gb" 9 | OsDiskType commons.FieldName = "os_disk_type" 10 | OsType commons.FieldName = "os_type" 11 | OsSKU commons.FieldName = "os_sku" 12 | KubernetesVersion commons.FieldName = "kubernetes_version" 13 | PodSubnetIDs commons.FieldName = "pod_subnet_ids" 14 | VnetSubnetIDs commons.FieldName = "vnet_subnet_ids" 15 | LinuxOSConfig commons.FieldName = "linux_os_config" 16 | Sysctls commons.FieldName = "sysctls" 17 | VmMaxMapCount commons.FieldName = "vm_max_map_count" 18 | ) 19 | -------------------------------------------------------------------------------- /spotinst/ocean_aks_np_virtual_node_group_scheduling/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_aks_np_virtual_node_group_scheduling 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Scheduling commons.FieldName = "scheduling" 7 | ShutdownHours commons.FieldName = "shutdown_hours" 8 | TimeWindows commons.FieldName = "time_windows" 9 | ShutdownHoursIsEnabled commons.FieldName = "is_enabled" 10 | ) 11 | -------------------------------------------------------------------------------- /spotinst/ocean_aks_np_virtual_node_group_strategy/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_aks_np_virtual_node_group_strategy 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | SpotPercentage commons.FieldName = "spot_percentage" 7 | FallbackToOnDemand commons.FieldName = "fallback_to_ondemand" 8 | ) 9 | -------------------------------------------------------------------------------- /spotinst/ocean_aks_np_virtual_node_group_vm_sizes/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_aks_np_virtual_node_group_vm_sizes 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Filters commons.FieldName = "filters" 7 | MinVcpu commons.FieldName = "min_vcpu" 8 | MaxVcpu commons.FieldName = "max_vcpu" 9 | MinMemoryGiB commons.FieldName = "min_memory_gib" 10 | MaxMemoryGiB commons.FieldName = "max_memory_gib" 11 | Series commons.FieldName = "series" 12 | Architectures commons.FieldName = "architectures" 13 | ExcludeSeries commons.FieldName = "exclude_series" 14 | AcceleratedNetworking commons.FieldName = "accelerated_networking" 15 | DiskPerformance commons.FieldName = "disk_performance" 16 | MinGpu commons.FieldName = "min_gpu" 17 | MaxGpu commons.FieldName = "max_gpu" 18 | MinNICs commons.FieldName = "min_nics" 19 | MinDisk commons.FieldName = "min_disk" 20 | VmTypes commons.FieldName = "vm_types" 21 | GpuTypes commons.FieldName = "gpu_types" 22 | ) 23 | -------------------------------------------------------------------------------- /spotinst/ocean_aks_np_vm_sizes/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_aks_np_vm_sizes 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Filters commons.FieldName = "filters" 7 | MinVcpu commons.FieldName = "min_vcpu" 8 | MaxVcpu commons.FieldName = "max_vcpu" 9 | MinMemoryGiB commons.FieldName = "min_memory_gib" 10 | MaxMemoryGiB commons.FieldName = "max_memory_gib" 11 | Series commons.FieldName = "series" 12 | Architectures commons.FieldName = "architectures" 13 | ExcludeSeries commons.FieldName = "exclude_series" 14 | AcceleratedNetworking commons.FieldName = "accelerated_networking" 15 | DiskPerformance commons.FieldName = "disk_performance" 16 | MinGpu commons.FieldName = "min_gpu" 17 | MaxGpu commons.FieldName = "max_gpu" 18 | MinNICs commons.FieldName = "min_nics" 19 | MinDisk commons.FieldName = "min_disk" 20 | VmTypes commons.FieldName = "vm_types" 21 | GpuTypes commons.FieldName = "gpu_types" 22 | ) 23 | -------------------------------------------------------------------------------- /spotinst/ocean_aws/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_aws 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | type TagField string 6 | 7 | const ( 8 | TagKey TagField = "key" 9 | TagValue TagField = "value" 10 | ) 11 | 12 | const ( 13 | Name commons.FieldName = "name" 14 | ControllerClusterID commons.FieldName = "controller_id" 15 | 16 | MaxSize commons.FieldName = "max_size" 17 | MinSize commons.FieldName = "min_size" 18 | DesiredCapacity commons.FieldName = "desired_capacity" 19 | 20 | Region commons.FieldName = "region" 21 | SubnetIDs commons.FieldName = "subnet_ids" 22 | 23 | Tags commons.FieldName = "tags" 24 | 25 | UpdatePolicy commons.FieldName = "update_policy" 26 | ShouldRoll commons.FieldName = "should_roll" 27 | ConditionedRoll commons.FieldName = "conditioned_roll" 28 | AutoApplyTags commons.FieldName = "auto_apply_tags" 29 | ConditionedRollParams commons.FieldName = "conditioned_roll_params" 30 | 31 | RollConfig commons.FieldName = "roll_config" 32 | BatchSizePercentage commons.FieldName = "batch_size_percentage" 33 | LaunchSpecIDs commons.FieldName = "launch_spec_ids" 34 | BatchMinHealthyPercentage commons.FieldName = "batch_min_healthy_percentage" 35 | RespectPDB commons.FieldName = "respect_pdb" 36 | ) 37 | 38 | const ( 39 | AttachLoadBalancer commons.FieldName = "attach_load_balancer" 40 | LoadBalancerArn commons.FieldName = "arn" 41 | LoadBalancerName commons.FieldName = "name" 42 | LoadBalancerType commons.FieldName = "type" 43 | DetachLoadBalancer commons.FieldName = "detach_load_balancer" 44 | ) 45 | -------------------------------------------------------------------------------- /spotinst/ocean_aws_auto_scaling/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_aws_auto_scaling 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Autoscaler commons.FieldName = "autoscaler" 7 | AutoscaleCooldown commons.FieldName = "autoscale_cooldown" 8 | AutoHeadroomPercentage commons.FieldName = "auto_headroom_percentage" 9 | AutoscaleDown commons.FieldName = "autoscale_down" 10 | AutoscaleHeadroom commons.FieldName = "autoscale_headroom" 11 | AutoscaleIsAutoConfig commons.FieldName = "autoscale_is_auto_config" 12 | AutoscaleIsEnabled commons.FieldName = "autoscale_is_enabled" 13 | EvaluationPeriods commons.FieldName = "evaluation_periods" 14 | MaxScaleDownPercentage commons.FieldName = "max_scale_down_percentage" 15 | CPUPerUnit commons.FieldName = "cpu_per_unit" 16 | GPUPerUnit commons.FieldName = "gpu_per_unit" 17 | MaxVCPU commons.FieldName = "max_vcpu" 18 | MaxMemoryGIB commons.FieldName = "max_memory_gib" 19 | MemoryPerUnit commons.FieldName = "memory_per_unit" 20 | NumOfUnits commons.FieldName = "num_of_units" 21 | ResourceLimits commons.FieldName = "resource_limits" 22 | EnableAutomaticAndManualHeadroom commons.FieldName = "enable_automatic_and_manual_headroom" 23 | ExtendedResourceDefinitions commons.FieldName = "extended_resource_definitions" 24 | IsAggressiveScaleDownEnabled commons.FieldName = "is_aggressive_scale_down_enabled" 25 | ) 26 | -------------------------------------------------------------------------------- /spotinst/ocean_aws_extended_resource_definition/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_aws_extended_resource_definition 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | ExtendedResourceName commons.FieldName = "name" 7 | Mapping commons.FieldName = "resource_mapping" 8 | ) 9 | -------------------------------------------------------------------------------- /spotinst/ocean_aws_instance_types/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_aws_instance_types 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Whitelist commons.FieldName = "whitelist" 7 | Blacklist commons.FieldName = "blacklist" 8 | ) 9 | 10 | const ( 11 | Filters commons.FieldName = "filters" 12 | Architectures commons.FieldName = "architectures" 13 | Categories commons.FieldName = "categories" 14 | DiskTypes commons.FieldName = "disk_types" 15 | ExcludeFamilies commons.FieldName = "exclude_families" 16 | ExcludeMetal commons.FieldName = "exclude_metal" 17 | Hypervisor commons.FieldName = "hypervisor" 18 | IncludeFamilies commons.FieldName = "include_families" 19 | IsEnaSupported commons.FieldName = "is_ena_supported" 20 | MaxGpu commons.FieldName = "max_gpu" 21 | MaxMemoryGiB commons.FieldName = "max_memory_gib" 22 | MaxNetworkPerformance commons.FieldName = "max_network_performance" 23 | MaxVcpu commons.FieldName = "max_vcpu" 24 | MinEnis commons.FieldName = "min_enis" 25 | MinGpu commons.FieldName = "min_gpu" 26 | MinMemoryGiB commons.FieldName = "min_memory_gib" 27 | MinNetworkPerformance commons.FieldName = "min_network_performance" 28 | MinVcpu commons.FieldName = "min_vcpu" 29 | RootDeviceTypes commons.FieldName = "root_device_types" 30 | VirtualizationTypes commons.FieldName = "virtualization_types" 31 | ) 32 | -------------------------------------------------------------------------------- /spotinst/ocean_aws_logging/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_aws_logging 2 | 3 | import ( 4 | "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 5 | ) 6 | 7 | const ( 8 | Logging commons.FieldName = "logging" 9 | Export commons.FieldName = "export" 10 | S3 commons.FieldName = "s3" 11 | Id commons.FieldName = "id" 12 | ) 13 | -------------------------------------------------------------------------------- /spotinst/ocean_aws_scheduling/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_aws_scheduling 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | ScheduledTask commons.FieldName = "scheduled_task" 7 | ShutdownHours commons.FieldName = "shutdown_hours" 8 | TimeWindows commons.FieldName = "time_windows" 9 | ShutdownHoursIsEnabled commons.FieldName = "is_enabled" 10 | Tasks commons.FieldName = "tasks" 11 | TasksIsEnabled commons.FieldName = "is_enabled" 12 | CronExpression commons.FieldName = "cron_expression" 13 | TaskType commons.FieldName = "task_type" 14 | Parameters commons.FieldName = "parameters" 15 | ParametersClusterRoll commons.FieldName = "parameters_cluster_roll" 16 | ApplyRoll commons.FieldName = "apply_roll" 17 | AmiAutoUpdate commons.FieldName = "ami_auto_update" 18 | AmiAutoUpdateClusterRoll commons.FieldName = "ami_auto_update_cluster_roll" 19 | MinorVersion commons.FieldName = "minor_version" 20 | Patch commons.FieldName = "patch" 21 | BatchMinHealthyPercentage commons.FieldName = "batch_min_healthy_percentage" 22 | BatchSizePercentage commons.FieldName = "batch_size_percentage" 23 | Comment commons.FieldName = "comment" 24 | RespectPdb commons.FieldName = "respect_pdb" 25 | ) 26 | -------------------------------------------------------------------------------- /spotinst/ocean_aws_strategy/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_aws_strategy 2 | 3 | import ( 4 | "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 5 | ) 6 | 7 | const ( 8 | SpotPercentage commons.FieldName = "spot_percentage" 9 | FallbackToOnDemand commons.FieldName = "fallback_to_ondemand" 10 | UtilizeReservedInstances commons.FieldName = "utilize_reserved_instances" 11 | DrainingTimeout commons.FieldName = "draining_timeout" 12 | GracePeriod commons.FieldName = "grace_period" 13 | UtilizeCommitments commons.FieldName = "utilize_commitments" 14 | ClusterOrientation commons.FieldName = "cluster_orientation" 15 | AvailabilityVsCost commons.FieldName = "availability_vs_cost" 16 | SpreadNodesBy commons.FieldName = "spread_nodes_by" 17 | ) 18 | -------------------------------------------------------------------------------- /spotinst/ocean_ecs/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_ecs 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | type TagField string 6 | 7 | const ( 8 | Region commons.FieldName = "region" 9 | Name commons.FieldName = "name" 10 | ClusterName commons.FieldName = "cluster_name" 11 | MaxSize commons.FieldName = "max_size" 12 | MinSize commons.FieldName = "min_size" 13 | DesiredCapacity commons.FieldName = "desired_capacity" 14 | SubnetIDs commons.FieldName = "subnet_ids" 15 | UpdatePolicy commons.FieldName = "update_policy" 16 | ShouldRoll commons.FieldName = "should_roll" 17 | ConditionedRoll commons.FieldName = "conditioned_roll" 18 | AutoApplyTags commons.FieldName = "auto_apply_tags" 19 | RollConfig commons.FieldName = "roll_config" 20 | BatchSizePercentage commons.FieldName = "batch_size_percentage" 21 | BatchMinHealthyPercentage commons.FieldName = "batch_min_healthy_percentage" 22 | Tags commons.FieldName = "tags" 23 | TagKey TagField = "key" 24 | TagValue TagField = "value" 25 | ) 26 | -------------------------------------------------------------------------------- /spotinst/ocean_ecs_autoscaler/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_ecs_autoscaler 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Autoscaler commons.FieldName = "autoscaler" 7 | IsAutoConfig commons.FieldName = "is_auto_config" 8 | IsEnabled commons.FieldName = "is_enabled" 9 | Cooldown commons.FieldName = "cooldown" 10 | Headroom commons.FieldName = "headroom" 11 | CpuPerUnit commons.FieldName = "cpu_per_unit" 12 | MemoryPerUnit commons.FieldName = "memory_per_unit" 13 | NumOfUnits commons.FieldName = "num_of_units" 14 | ResourceLimits commons.FieldName = "resource_limits" 15 | MaxVCpu commons.FieldName = "max_vcpu" 16 | MaxMemoryGib commons.FieldName = "max_memory_gib" 17 | Down commons.FieldName = "down" 18 | MaxScaleDownPercentage commons.FieldName = "max_scale_down_percentage" 19 | AutoHeadroomPercentage commons.FieldName = "auto_headroom_percentage" 20 | ShouldScaleDownNonServiceTasks commons.FieldName = "should_scale_down_non_service_tasks" 21 | EnableAutomaticAndManualHeadroom commons.FieldName = "enable_automatic_and_manual_headroom" 22 | ) 23 | -------------------------------------------------------------------------------- /spotinst/ocean_ecs_instance_types/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_ecs_instance_types 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Whitelist commons.FieldName = "whitelist" 7 | Blacklist commons.FieldName = "blacklist" 8 | ) 9 | 10 | const ( 11 | Filters commons.FieldName = "filters" 12 | Architectures commons.FieldName = "architectures" 13 | Categories commons.FieldName = "categories" 14 | DiskTypes commons.FieldName = "disk_types" 15 | ExcludeFamilies commons.FieldName = "exclude_families" 16 | ExcludeMetal commons.FieldName = "exclude_metal" 17 | Hypervisor commons.FieldName = "hypervisor" 18 | IncludeFamilies commons.FieldName = "include_families" 19 | IsEnaSupported commons.FieldName = "is_ena_supported" 20 | MaxGpu commons.FieldName = "max_gpu" 21 | MaxMemoryGiB commons.FieldName = "max_memory_gib" 22 | MaxNetworkPerformance commons.FieldName = "max_network_performance" 23 | MaxVcpu commons.FieldName = "max_vcpu" 24 | MinEnis commons.FieldName = "min_enis" 25 | MinGpu commons.FieldName = "min_gpu" 26 | MinMemoryGiB commons.FieldName = "min_memory_gib" 27 | MinNetworkPerformance commons.FieldName = "min_network_performance" 28 | MinVcpu commons.FieldName = "min_vcpu" 29 | RootDeviceTypes commons.FieldName = "root_device_types" 30 | VirtualizationTypes commons.FieldName = "virtualization_types" 31 | ) 32 | -------------------------------------------------------------------------------- /spotinst/ocean_ecs_launch_specification/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_ecs_launch_specification 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | SecurityGroupIds commons.FieldName = "security_group_ids" 7 | IamInstanceProfile commons.FieldName = "iam_instance_profile" 8 | KeyPair commons.FieldName = "key_pair" 9 | UserData commons.FieldName = "user_data" 10 | AssociatePublicIpAddress commons.FieldName = "associate_public_ip_address" 11 | ImageID commons.FieldName = "image_id" 12 | Monitoring commons.FieldName = "monitoring" 13 | EBSOptimized commons.FieldName = "ebs_optimized" 14 | UseAsTemplateOnly commons.FieldName = "use_as_template_only" 15 | ) 16 | 17 | const ( 18 | BlockDeviceMappings commons.FieldName = "block_device_mappings" 19 | DeviceName commons.FieldName = "device_name" 20 | EBS commons.FieldName = "ebs" 21 | DeleteOnTermination commons.FieldName = "delete_on_termination" 22 | Encrypted commons.FieldName = "encrypted" 23 | IOPS commons.FieldName = "iops" 24 | KMSKeyID commons.FieldName = "kms_key_id" 25 | SnapshotID commons.FieldName = "snapshot_id" 26 | VolumeSize commons.FieldName = "volume_size" 27 | DynamicVolumeSize commons.FieldName = "dynamic_volume_size" 28 | BaseSize commons.FieldName = "base_size" 29 | Resource commons.FieldName = "resource" 30 | SizePerResourceUnit commons.FieldName = "size_per_resource_unit" 31 | VolumeType commons.FieldName = "volume_type" 32 | NoDevice commons.FieldName = "no_device" 33 | VirtualName commons.FieldName = "virtual_name" 34 | Throughput commons.FieldName = "throughput" 35 | ) 36 | 37 | const ( 38 | InstanceMetadataOptions commons.FieldName = "instance_metadata_options" 39 | HTTPTokens commons.FieldName = "http_tokens" 40 | HTTPPutResponseHopLimit commons.FieldName = "http_put_response_hop_limit" 41 | ) 42 | -------------------------------------------------------------------------------- /spotinst/ocean_ecs_logging/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_ecs_logging 2 | 3 | import ( 4 | "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 5 | ) 6 | 7 | const ( 8 | Logging commons.FieldName = "logging" 9 | Export commons.FieldName = "export" 10 | S3 commons.FieldName = "s3" 11 | Id commons.FieldName = "id" 12 | ) 13 | -------------------------------------------------------------------------------- /spotinst/ocean_ecs_optimize_images/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_ecs_optimize_images 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | OptimizeImages commons.FieldName = "optimize_images" 7 | PerformAt commons.FieldName = "perform_at" 8 | TimeWindows commons.FieldName = "time_windows" 9 | ShouldOptimizeECSAMI commons.FieldName = "should_optimize_ecs_ami" 10 | ) 11 | -------------------------------------------------------------------------------- /spotinst/ocean_ecs_scheduling/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_ecs_scheduling 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | ScheduledTask commons.FieldName = "scheduled_task" 7 | ShutdownHours commons.FieldName = "shutdown_hours" 8 | TimeWindows commons.FieldName = "time_windows" 9 | ShutdownHoursIsEnabled commons.FieldName = "is_enabled" 10 | Tasks commons.FieldName = "tasks" 11 | TasksIsEnabled commons.FieldName = "is_enabled" 12 | CronExpression commons.FieldName = "cron_expression" 13 | TaskType commons.FieldName = "task_type" 14 | ) 15 | -------------------------------------------------------------------------------- /spotinst/ocean_ecs_strategy/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_ecs_strategy 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | DrainingTimeout commons.FieldName = "draining_timeout" 7 | UtilizeReservedInstances commons.FieldName = "utilize_reserved_instances" 8 | UtilizeCommitments commons.FieldName = "utilize_commitments" 9 | SpotPercentage commons.FieldName = "spot_percentage" 10 | ClusterOrientation commons.FieldName = "cluster_orientation" 11 | AvailabilityVsCost commons.FieldName = "availability_vs_cost" 12 | FallbackToOnDemand commons.FieldName = "fallback_to_ondemand" 13 | ) 14 | -------------------------------------------------------------------------------- /spotinst/ocean_gke/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_gke 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Name commons.FieldName = "name" 7 | ControllerClusterID commons.FieldName = "controller_id" 8 | MaxSize commons.FieldName = "max_size" 9 | MinSize commons.FieldName = "min_size" 10 | DesiredCapacity commons.FieldName = "desired_capacity" 11 | SubnetName commons.FieldName = "subnet_name" 12 | ClusterName commons.FieldName = "cluster_name" 13 | MasterLocation commons.FieldName = "master_location" 14 | AvailabilityZones commons.FieldName = "availability_zones" 15 | 16 | BackendServices commons.FieldName = "backend_services" 17 | LocationType commons.FieldName = "location_type" 18 | Scheme commons.FieldName = "scheme" 19 | NamedPorts commons.FieldName = "named_ports" 20 | Ports commons.FieldName = "ports" 21 | ServiceName commons.FieldName = "service_name" 22 | ) 23 | 24 | type LabelField string 25 | type MetadataField string 26 | 27 | const ( 28 | LabelKey LabelField = "key" 29 | LabelValue LabelField = "value" 30 | 31 | MetadataKey MetadataField = "key" 32 | MetadataValue MetadataField = "value" 33 | 34 | TaintKey MetadataField = "key" 35 | TaintValue MetadataField = "value" 36 | TaintEffect MetadataField = "effect" 37 | ) 38 | 39 | const ( 40 | SourceImage commons.FieldName = "source_image" 41 | Metadata commons.FieldName = "metadata" 42 | Labels commons.FieldName = "labels" 43 | Taints commons.FieldName = "taints" 44 | ) 45 | -------------------------------------------------------------------------------- /spotinst/ocean_gke_auto_scaling/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_gke_auto_scaling 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Autoscaler commons.FieldName = "autoscaler" 7 | AutoscaleCooldown commons.FieldName = "autoscale_cooldown" 8 | AutoscaleDown commons.FieldName = "autoscale_down" 9 | AutoscaleHeadroom commons.FieldName = "autoscale_headroom" 10 | AutoscaleIsAutoConfig commons.FieldName = "autoscale_is_auto_config" 11 | AutoscaleIsEnabled commons.FieldName = "autoscale_is_enabled" 12 | EvaluationPeriods commons.FieldName = "evaluation_periods" 13 | CPUPerUnit commons.FieldName = "cpu_per_unit" 14 | GPUPerUnit commons.FieldName = "gpu_per_unit" 15 | MaxVCPU commons.FieldName = "max_vcpu" 16 | MaxMemoryGIB commons.FieldName = "max_memory_gib" 17 | MemoryPerUnit commons.FieldName = "memory_per_unit" 18 | NumOfUnits commons.FieldName = "num_of_units" 19 | ResourceLimits commons.FieldName = "resource_limits" 20 | IsAggressiveScaleDownEnabled commons.FieldName = "is_aggressive_scale_down_enabled" 21 | ) 22 | -------------------------------------------------------------------------------- /spotinst/ocean_gke_import/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_gke_import 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | ClusterName commons.FieldName = "cluster_name" 7 | Location commons.FieldName = "location" 8 | Whitelist commons.FieldName = "whitelist" 9 | Blacklist commons.FieldName = "blacklist" 10 | BackendServices commons.FieldName = "backend_services" 11 | LocationType commons.FieldName = "location_type" 12 | Scheme commons.FieldName = "scheme" 13 | NamedPorts commons.FieldName = "named_ports" 14 | Ports commons.FieldName = "ports" 15 | ServiceName commons.FieldName = "service_name" 16 | Name commons.FieldName = "name" 17 | MaxSize commons.FieldName = "max_size" 18 | MinSize commons.FieldName = "min_size" 19 | DesiredCapacity commons.FieldName = "desired_capacity" 20 | ControllerClusterID commons.FieldName = "controller_cluster_id" 21 | 22 | // Deprecated: Please use ControllerClusterID instead. 23 | ClusterControllerID commons.FieldName = "cluster_controller_id" 24 | 25 | UpdatePolicy commons.FieldName = "update_policy" 26 | ShouldRoll commons.FieldName = "should_roll" 27 | ConditionedRoll commons.FieldName = "conditioned_roll" 28 | 29 | RollConfig commons.FieldName = "roll_config" 30 | BatchSizePercentage commons.FieldName = "batch_size_percentage" 31 | LaunchSpecIDs commons.FieldName = "launch_spec_ids" 32 | BatchMinHealthyPercentage commons.FieldName = "batch_min_healthy_percentage" 33 | RespectPdb commons.FieldName = "respect_pdb" 34 | ) 35 | 36 | const ( 37 | Filters commons.FieldName = "filters" 38 | ExcludeFamilies commons.FieldName = "exclude_families" 39 | IncludeFamilies commons.FieldName = "include_families" 40 | MaxMemoryGiB commons.FieldName = "max_memory_gib" 41 | MaxVcpu commons.FieldName = "max_vcpu" 42 | MinMemoryGiB commons.FieldName = "min_memory_gib" 43 | MinVcpu commons.FieldName = "min_vcpu" 44 | AutoUpdate commons.FieldName = "auto_update" 45 | IsEnabled commons.FieldName = "is_enabled" 46 | ) 47 | -------------------------------------------------------------------------------- /spotinst/ocean_gke_import_autoscaler/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_gke_import_autoscaler 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Autoscaler commons.FieldName = "autoscaler" 7 | IsAutoConfig commons.FieldName = "is_auto_config" 8 | IsEnabled commons.FieldName = "is_enabled" 9 | Cooldown commons.FieldName = "cooldown" 10 | Headroom commons.FieldName = "headroom" 11 | CpuPerUnit commons.FieldName = "cpu_per_unit" 12 | MemoryPerUnit commons.FieldName = "memory_per_unit" 13 | NumOfUnits commons.FieldName = "num_of_units" 14 | ResourceLimits commons.FieldName = "resource_limits" 15 | MaxVCpu commons.FieldName = "max_vcpu" 16 | MaxMemoryGib commons.FieldName = "max_memory_gib" 17 | Down commons.FieldName = "down" 18 | MaxScaleDownPercentage commons.FieldName = "max_scale_down_percentage" 19 | EvaluationPeriods commons.FieldName = "evaluation_periods" 20 | GPUPerUnit commons.FieldName = "gpu_per_unit" 21 | AutoHeadroomPercentage commons.FieldName = "auto_headroom_percentage" 22 | EnableAutomaticAndManualHeadroom commons.FieldName = "enable_automatic_and_manual_headroom" 23 | IsAggressiveScaleDownEnabled commons.FieldName = "is_aggressive_scale_down_enabled" 24 | ) 25 | -------------------------------------------------------------------------------- /spotinst/ocean_gke_import_launch_specification/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_gke_import_launch_specification 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | RootVolumeType commons.FieldName = "root_volume_type" 7 | UseAsTemplateOnly commons.FieldName = "use_as_template_only" 8 | ) 9 | 10 | const ( 11 | ShieldedInstanceConfig commons.FieldName = "shielded_instance_config" 12 | EnableSecureBoot commons.FieldName = "enable_secure_boot" 13 | EnableIntegrityMonitoring commons.FieldName = "enable_integrity_monitoring" 14 | ) 15 | -------------------------------------------------------------------------------- /spotinst/ocean_gke_import_scheduling/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_gke_import_scheduling 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | ScheduledTask commons.FieldName = "scheduled_task" 7 | ShutdownHours commons.FieldName = "shutdown_hours" 8 | TimeWindows commons.FieldName = "time_windows" 9 | ShutdownHoursIsEnabled commons.FieldName = "is_enabled" 10 | Tasks commons.FieldName = "tasks" 11 | TasksIsEnabled commons.FieldName = "is_enabled" 12 | CronExpression commons.FieldName = "cron_expression" 13 | TaskType commons.FieldName = "task_type" 14 | BatchSizePercentage commons.FieldName = "batch_size_percentage" 15 | TaskParameters commons.FieldName = "task_parameters" 16 | BatchMinHealthyPercentage commons.FieldName = "batch_min_healthy_percentage" 17 | Comment commons.FieldName = "comment" 18 | RespectPdb commons.FieldName = "respect_pdb" 19 | ClusterRoll commons.FieldName = "cluster_roll" 20 | ) 21 | -------------------------------------------------------------------------------- /spotinst/ocean_gke_import_strategy/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_gke_import_strategy 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Strategy commons.FieldName = "strategy" 7 | DrainingTimeout commons.FieldName = "draining_timeout" 8 | ProvisioningModel commons.FieldName = "provisioning_model" 9 | PreemptiblePercentage commons.FieldName = "preemptible_percentage" 10 | ShouldUtilizeCommitments commons.FieldName = "should_utilize_commitments" 11 | ScalingOrientation commons.FieldName = "scaling_orientation" 12 | ) 13 | -------------------------------------------------------------------------------- /spotinst/ocean_gke_instance_types/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_gke_instance_types 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Whitelist commons.FieldName = "whitelist" 7 | ) 8 | -------------------------------------------------------------------------------- /spotinst/ocean_gke_instance_types/fields_spotinst_ocean_gke_instance_types.go: -------------------------------------------------------------------------------- 1 | package ocean_gke_instance_types 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" 7 | "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 8 | ) 9 | 10 | func Setup(fieldsMap map[commons.FieldName]*commons.GenericField) { 11 | 12 | fieldsMap[Whitelist] = commons.NewGenericField( 13 | commons.OceanGKEInstanceTypes, 14 | Whitelist, 15 | &schema.Schema{ 16 | Type: schema.TypeList, 17 | Optional: true, 18 | Elem: &schema.Schema{Type: schema.TypeString}, 19 | }, 20 | func(resourceObject interface{}, resourceData *schema.ResourceData, meta interface{}) error { 21 | clusterWrapper := resourceObject.(*commons.GKEClusterWrapper) 22 | cluster := clusterWrapper.GetCluster() 23 | var result []string 24 | if cluster.Compute != nil && cluster.Compute.InstanceTypes != nil && 25 | cluster.Compute.InstanceTypes.Whitelist != nil { 26 | result = append(result, cluster.Compute.InstanceTypes.Whitelist...) 27 | } 28 | if err := resourceData.Set(string(Whitelist), result); err != nil { 29 | return fmt.Errorf(string(commons.FailureFieldReadPattern), string(Whitelist), err) 30 | } 31 | return nil 32 | }, 33 | func(resourceObject interface{}, resourceData *schema.ResourceData, meta interface{}) error { 34 | clusterWrapper := resourceObject.(*commons.GKEClusterWrapper) 35 | cluster := clusterWrapper.GetCluster() 36 | if v, ok := resourceData.GetOk(string(Whitelist)); ok { 37 | instances := v.([]interface{}) 38 | instanceTypes := make([]string, len(instances)) 39 | for i, j := range instances { 40 | instanceTypes[i] = j.(string) 41 | } 42 | cluster.Compute.InstanceTypes.SetWhitelist(instanceTypes) 43 | } 44 | return nil 45 | }, 46 | func(resourceObject interface{}, resourceData *schema.ResourceData, meta interface{}) error { 47 | clusterWrapper := resourceObject.(*commons.GKEClusterWrapper) 48 | cluster := clusterWrapper.GetCluster() 49 | var instanceTypes []string = nil 50 | if v, ok := resourceData.GetOk(string(Whitelist)); ok { 51 | instances := v.([]interface{}) 52 | instanceTypes = make([]string, len(instances)) 53 | for i, v := range instances { 54 | instanceTypes[i] = v.(string) 55 | } 56 | } 57 | cluster.Compute.InstanceTypes.SetWhitelist(instanceTypes) 58 | return nil 59 | }, 60 | nil, 61 | ) 62 | } 63 | -------------------------------------------------------------------------------- /spotinst/ocean_gke_launch_spec_import/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_gke_launch_spec_import 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | type LabelField string 6 | type MetadataField string 7 | 8 | const ( 9 | OceanId commons.FieldName = "ocean_id" 10 | NodePoolName commons.FieldName = "node_pool_name" 11 | ) 12 | -------------------------------------------------------------------------------- /spotinst/ocean_gke_launch_spec_import/fields_spotinst_ocean_gke_launch_spec_import.go: -------------------------------------------------------------------------------- 1 | package ocean_gke_launch_spec_import 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" 7 | "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 8 | ) 9 | 10 | func Setup(fieldsMap map[commons.FieldName]*commons.GenericField) { 11 | 12 | fieldsMap[OceanId] = commons.NewGenericField( 13 | commons.OceanGKELaunchSpecImport, 14 | OceanId, 15 | &schema.Schema{ 16 | Type: schema.TypeString, 17 | Required: true, 18 | ForceNew: true, 19 | }, 20 | func(resourceObject interface{}, resourceData *schema.ResourceData, meta interface{}) error { 21 | return nil 22 | }, 23 | func(resourceObject interface{}, resourceData *schema.ResourceData, meta interface{}) error { 24 | return nil 25 | }, 26 | func(resourceObject interface{}, resourceData *schema.ResourceData, meta interface{}) error { 27 | err := fmt.Errorf(string(commons.FieldUpdateNotAllowedPattern), 28 | string(OceanId)) 29 | return err 30 | }, 31 | nil, 32 | ) 33 | 34 | fieldsMap[NodePoolName] = commons.NewGenericField( 35 | commons.OceanGKELaunchSpecImport, 36 | NodePoolName, 37 | &schema.Schema{ 38 | Type: schema.TypeString, 39 | Required: true, 40 | ForceNew: true, 41 | }, 42 | func(resourceObject interface{}, resourceData *schema.ResourceData, meta interface{}) error { 43 | return nil 44 | }, 45 | func(resourceObject interface{}, resourceData *schema.ResourceData, meta interface{}) error { 46 | return nil 47 | }, 48 | func(resourceObject interface{}, resourceData *schema.ResourceData, meta interface{}) error { 49 | err := fmt.Errorf(string(commons.FieldUpdateNotAllowedPattern), 50 | string(NodePoolName)) 51 | return err 52 | }, 53 | nil, 54 | ) 55 | } 56 | -------------------------------------------------------------------------------- /spotinst/ocean_gke_launch_spec_scheduling/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_gke_launch_spec_scheduling 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | SchedulingTask commons.FieldName = "scheduling_task" 7 | ) 8 | 9 | const ( 10 | IsEnabled commons.FieldName = "is_enabled" 11 | CronExpression commons.FieldName = "cron_expression" 12 | TaskType commons.FieldName = "task_type" 13 | TaskHeadroom commons.FieldName = "task_headroom" 14 | ) 15 | 16 | const ( 17 | CPUPerUnit commons.FieldName = "cpu_per_unit" 18 | GPUPerUnit commons.FieldName = "gpu_per_unit" 19 | MemoryPerUnit commons.FieldName = "memory_per_unit" 20 | NumOfUnits commons.FieldName = "num_of_units" 21 | ) 22 | -------------------------------------------------------------------------------- /spotinst/ocean_gke_launch_spec_strategy/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_gke_launch_spec_strategy 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Strategy commons.FieldName = "strategy" 7 | PreemptiblePercentage commons.FieldName = "preemptible_percentage" 8 | ScalingOrientation commons.FieldName = "scaling_orientation" 9 | ) 10 | -------------------------------------------------------------------------------- /spotinst/ocean_gke_network_interface/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_gke_network_interface 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | NetworkInterface commons.FieldName = "network_interface" 7 | Network commons.FieldName = "network" 8 | 9 | AccessConfigs commons.FieldName = "access_configs" 10 | Name commons.FieldName = "name" 11 | Type commons.FieldName = "type" 12 | 13 | AliasIPRanges commons.FieldName = "alias_ip_ranges" 14 | IPCIDRRange commons.FieldName = "ip_cidr_range" 15 | SubnetworkRangeName commons.FieldName = "subnetwork_range_name" 16 | ) 17 | -------------------------------------------------------------------------------- /spotinst/ocean_gke_strategy/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_gke_strategy 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | DrainingTimeout commons.FieldName = "draining_timeout" 7 | ) 8 | -------------------------------------------------------------------------------- /spotinst/ocean_gke_strategy/fields_spotinst_ocean_gke_strategy.go: -------------------------------------------------------------------------------- 1 | package ocean_gke_strategy 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" 7 | "github.com/spotinst/spotinst-sdk-go/spotinst" 8 | "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 9 | ) 10 | 11 | func Setup(fieldsMap map[commons.FieldName]*commons.GenericField) { 12 | 13 | fieldsMap[DrainingTimeout] = commons.NewGenericField( 14 | commons.OceanGKEStrategy, 15 | DrainingTimeout, 16 | &schema.Schema{ 17 | Type: schema.TypeInt, 18 | Optional: true, 19 | }, 20 | func(resourceObject interface{}, resourceData *schema.ResourceData, meta interface{}) error { 21 | clusterWrapper := resourceObject.(*commons.GKEClusterWrapper) 22 | cluster := clusterWrapper.GetCluster() 23 | var value *int = nil 24 | 25 | if cluster.Strategy != nil && cluster.Strategy.DrainingTimeout != nil { 26 | value = cluster.Strategy.DrainingTimeout 27 | } 28 | if value != nil { 29 | if err := resourceData.Set(string(DrainingTimeout), spotinst.IntValue(value)); err != nil { 30 | return fmt.Errorf(string(commons.FailureFieldReadPattern), string(DrainingTimeout), err) 31 | } 32 | } 33 | 34 | return nil 35 | }, 36 | func(resourceObject interface{}, resourceData *schema.ResourceData, meta interface{}) error { 37 | clusterWrapper := resourceObject.(*commons.GKEClusterWrapper) 38 | cluster := clusterWrapper.GetCluster() 39 | 40 | if v, ok := resourceData.GetOkExists(string(DrainingTimeout)); ok { 41 | cluster.Strategy.SetDrainingTimeout(spotinst.Int(v.(int))) 42 | } 43 | 44 | return nil 45 | }, 46 | func(resourceObject interface{}, resourceData *schema.ResourceData, meta interface{}) error { 47 | clusterWrapper := resourceObject.(*commons.GKEClusterWrapper) 48 | cluster := clusterWrapper.GetCluster() 49 | var dt *int = nil 50 | 51 | if v, ok := resourceData.Get(string(DrainingTimeout)).(int); ok && v > 0 { 52 | dt = spotinst.Int(v) 53 | } 54 | 55 | cluster.Strategy.SetDrainingTimeout(dt) 56 | 57 | return nil 58 | }, 59 | nil, 60 | ) 61 | } 62 | -------------------------------------------------------------------------------- /spotinst/ocean_spark/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_spark 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | OceanClusterID commons.FieldName = "ocean_cluster_id" 7 | ) 8 | -------------------------------------------------------------------------------- /spotinst/ocean_spark/fields_spotinst_ocean_spark.go: -------------------------------------------------------------------------------- 1 | package ocean_spark 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" 7 | "github.com/spotinst/spotinst-sdk-go/spotinst" 8 | 9 | "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 10 | ) 11 | 12 | func Setup(fieldsMap map[commons.FieldName]*commons.GenericField) { 13 | 14 | fieldsMap[OceanClusterID] = commons.NewGenericField( 15 | commons.OceanSpark, 16 | OceanClusterID, 17 | &schema.Schema{ 18 | Type: schema.TypeString, 19 | Required: true, 20 | ForceNew: true, 21 | }, 22 | func(resourceObject interface{}, resourceData *schema.ResourceData, meta interface{}) error { 23 | clusterWrapper := resourceObject.(*commons.SparkClusterWrapper) 24 | cluster := clusterWrapper.GetCluster() 25 | var value *string = nil 26 | if cluster.OceanClusterID != nil { 27 | value = cluster.OceanClusterID 28 | } 29 | if err := resourceData.Set(string(OceanClusterID), value); err != nil { 30 | return fmt.Errorf(commons.FailureFieldReadPattern, string(OceanClusterID), err) 31 | } 32 | return nil 33 | }, 34 | func(resourceObject interface{}, resourceData *schema.ResourceData, meta interface{}) error { 35 | clusterWrapper := resourceObject.(*commons.SparkClusterWrapper) 36 | cluster := clusterWrapper.GetCluster() 37 | cluster.OceanClusterID = spotinst.String(resourceData.Get(string(OceanClusterID)).(string)) 38 | return nil 39 | }, 40 | func(resourceObject interface{}, resourceData *schema.ResourceData, meta interface{}) error { 41 | return fmt.Errorf(string(commons.FieldUpdateNotAllowedPattern), string(OceanClusterID)) 42 | }, 43 | nil, 44 | ) 45 | } 46 | -------------------------------------------------------------------------------- /spotinst/ocean_spark_compute/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_spark_compute 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Compute commons.FieldName = "compute" 7 | UseTaints commons.FieldName = "use_taints" 8 | CreateVNGs commons.FieldName = "create_vngs" 9 | ) 10 | -------------------------------------------------------------------------------- /spotinst/ocean_spark_ingress/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_spark_ingress 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Ingress commons.FieldName = "ingress" 7 | ServiceAnnotations commons.FieldName = "service_annotations" 8 | Controller commons.FieldName = "controller" 9 | LoadBalancer commons.FieldName = "load_balancer" 10 | CustomEndpoint commons.FieldName = "custom_endpoint" 11 | PrivateLink commons.FieldName = "private_link" 12 | Managed commons.FieldName = "managed" 13 | Enabled commons.FieldName = "enabled" 14 | TargetGroupARN commons.FieldName = "target_group_arn" 15 | Address commons.FieldName = "address" 16 | VPCEndpointService commons.FieldName = "vpc_endpoint_service" 17 | ) 18 | -------------------------------------------------------------------------------- /spotinst/ocean_spark_log_collection/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_spark_log_collection 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | LogCollection commons.FieldName = "log_collection" 7 | CollectAppLogs commons.FieldName = "collect_app_logs" 8 | ) 9 | -------------------------------------------------------------------------------- /spotinst/ocean_spark_spark/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_spark_spark 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Spark commons.FieldName = "spark" 7 | AdditionalAppNamespaces commons.FieldName = "additional_app_namespaces" 8 | ) 9 | -------------------------------------------------------------------------------- /spotinst/ocean_spark_virtual_node_group/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_spark_virtual_node_group 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | OceanSparkClusterID commons.FieldName = "ocean_spark_cluster_id" 7 | VngID commons.FieldName = "virtual_node_group_id" 8 | ) 9 | -------------------------------------------------------------------------------- /spotinst/ocean_spark_virtual_node_group/fields_spotinst_ocean_spark_virtual_node_group.go: -------------------------------------------------------------------------------- 1 | package ocean_spark_virtual_node_group 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" 7 | "github.com/spotinst/spotinst-sdk-go/spotinst" 8 | 9 | "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 10 | ) 11 | 12 | func Setup(fieldsMap map[commons.FieldName]*commons.GenericField) { 13 | 14 | fieldsMap[OceanSparkClusterID] = commons.NewGenericField( 15 | commons.OceanSparkVirtualNodeGroup, 16 | OceanSparkClusterID, 17 | &schema.Schema{ 18 | Type: schema.TypeString, 19 | Required: true, 20 | ForceNew: true, 21 | }, 22 | func(resourceObject interface{}, resourceData *schema.ResourceData, meta interface{}) error { 23 | vngWrapper := resourceObject.(*commons.SparkVirtualNodeGroupWrapper) 24 | vng := vngWrapper.GetVirtualNodeGroup() 25 | var value *string = nil 26 | if vng.OceanSparkClusterID != nil { 27 | value = vng.OceanSparkClusterID 28 | } 29 | if err := resourceData.Set(string(OceanSparkClusterID), value); err != nil { 30 | return fmt.Errorf(commons.FailureFieldReadPattern, string(OceanSparkClusterID), err) 31 | } 32 | return nil 33 | }, 34 | func(resourceObject interface{}, resourceData *schema.ResourceData, meta interface{}) error { 35 | vngWrapper := resourceObject.(*commons.SparkVirtualNodeGroupWrapper) 36 | vng := vngWrapper.GetVirtualNodeGroup() 37 | vng.OceanSparkClusterID = spotinst.String(resourceData.Get(string(OceanSparkClusterID)).(string)) 38 | return nil 39 | }, 40 | func(resourceObject interface{}, resourceData *schema.ResourceData, meta interface{}) error { 41 | return nil 42 | }, 43 | nil, 44 | ) 45 | 46 | fieldsMap[VngID] = commons.NewGenericField( 47 | commons.OceanSparkVirtualNodeGroup, 48 | VngID, 49 | &schema.Schema{ 50 | Type: schema.TypeString, 51 | Required: true, 52 | }, 53 | func(resourceObject interface{}, resourceData *schema.ResourceData, meta interface{}) error { 54 | vngWrapper := resourceObject.(*commons.SparkVirtualNodeGroupWrapper) 55 | vng := vngWrapper.GetVirtualNodeGroup() 56 | var value *string = nil 57 | if vng.VngID != nil { 58 | value = vng.VngID 59 | } 60 | if err := resourceData.Set(string(VngID), value); err != nil { 61 | return fmt.Errorf(commons.FailureFieldReadPattern, string(VngID), err) 62 | } 63 | return nil 64 | }, 65 | func(resourceObject interface{}, resourceData *schema.ResourceData, meta interface{}) error { 66 | vngWrapper := resourceObject.(*commons.SparkVirtualNodeGroupWrapper) 67 | vng := vngWrapper.GetVirtualNodeGroup() 68 | vng.VngID = spotinst.String(resourceData.Get(string(VngID)).(string)) 69 | return nil 70 | }, 71 | func(resourceObject interface{}, resourceData *schema.ResourceData, meta interface{}) error { 72 | return nil 73 | }, 74 | nil, 75 | ) 76 | } 77 | -------------------------------------------------------------------------------- /spotinst/ocean_spark_webhook/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_spark_webhook 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Webhook commons.FieldName = "webhook" 7 | UseHostNetwork commons.FieldName = "use_host_network" 8 | HostNetworkPorts commons.FieldName = "host_network_ports" 9 | ) 10 | -------------------------------------------------------------------------------- /spotinst/ocean_spark_workspaces/consts.go: -------------------------------------------------------------------------------- 1 | package ocean_spark_workspaces 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Workspaces commons.FieldName = "workspaces" 7 | Storage commons.FieldName = "storage" 8 | Defaults commons.FieldName = "defaults" 9 | StorageClassName commons.FieldName = "storage_class_name" 10 | ) 11 | -------------------------------------------------------------------------------- /spotinst/oceancd_rollout_spec/consts.go: -------------------------------------------------------------------------------- 1 | package oceancd_rollout_spec 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Name commons.FieldName = "rollout_spec_name" 7 | FailurePolicy commons.FieldName = "failure_policy" 8 | Action commons.FieldName = "action" 9 | ) 10 | -------------------------------------------------------------------------------- /spotinst/oceancd_rollout_spec_spot_deployment/consts.go: -------------------------------------------------------------------------------- 1 | package oceancd_rollout_spec_spot_deployment 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | SpotDeployment commons.FieldName = "spot_deployment" 7 | SpotDeploymentClusterId commons.FieldName = "spot_deployment_cluster_id" 8 | SpotDeploymentName commons.FieldName = "spot_deployment_name" 9 | SpotDeploymentNamespace commons.FieldName = "spot_deployment_namespace" 10 | ) 11 | 12 | const ( 13 | SpotDeployments commons.FieldName = "spot_deployments" 14 | SpotDeploymentsClusterId commons.FieldName = "spot_deployments_cluster_id" 15 | SpotDeploymentsName commons.FieldName = "spot_deployments_name" 16 | SpotDeploymentsNamespace commons.FieldName = "spot_deployments_namespace" 17 | ) 18 | -------------------------------------------------------------------------------- /spotinst/oceancd_rollout_spec_strategy/consts.go: -------------------------------------------------------------------------------- 1 | package oceancd_rollout_spec_strategy 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Strategy commons.FieldName = "strategy" 7 | Name commons.FieldName = "strategy_name" 8 | ) 9 | 10 | const ( 11 | Args commons.FieldName = "args" 12 | ArgName commons.FieldName = "arg_name" 13 | ArgValue commons.FieldName = "arg_value" 14 | ValueFrom commons.FieldName = "value_from" 15 | FieldRef commons.FieldName = "field_ref" 16 | FieldPath commons.FieldName = "field_path" 17 | ) 18 | -------------------------------------------------------------------------------- /spotinst/oceancd_rollout_spec_traffic/consts.go: -------------------------------------------------------------------------------- 1 | package oceancd_rollout_spec_traffic 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Traffic commons.FieldName = "traffic" 7 | CanaryService commons.FieldName = "canary_service" 8 | StableService commons.FieldName = "stable_service" 9 | ) 10 | 11 | const ( 12 | Alb commons.FieldName = "alb" 13 | AlbAnnotationPrefix commons.FieldName = "alb_annotation_prefix" 14 | AlbIngress commons.FieldName = "alb_ingress" 15 | AlbRootService commons.FieldName = "alb_root_service" 16 | ServicePort commons.FieldName = "service_port" 17 | StickinessConfig commons.FieldName = "stickiness_config" 18 | StickinessDuration commons.FieldName = "duration_seconds" 19 | StickinessEnabled commons.FieldName = "enabled" 20 | ) 21 | 22 | const ( 23 | Ambassador commons.FieldName = "ambassador" 24 | Mappings commons.FieldName = "mappings" 25 | ) 26 | 27 | const ( 28 | Istio commons.FieldName = "istio" 29 | DestinationRule commons.FieldName = "destination_rule" 30 | CanarySubsetName commons.FieldName = "canary_subset_name" 31 | DestinationRuleName commons.FieldName = "destination_rule_name" 32 | StableSubsetName commons.FieldName = "stable_subset_name" 33 | VirtualServices commons.FieldName = "virtual_services" 34 | VirtualServiceName commons.FieldName = "virtual_service_name" 35 | VirtualServiceRoutes commons.FieldName = "virtual_service_routes" 36 | TlsRoutes commons.FieldName = "tls_routes" 37 | Port commons.FieldName = "port" 38 | SniHosts commons.FieldName = "sni_hosts" 39 | ) 40 | 41 | const ( 42 | Nginx commons.FieldName = "nginx" 43 | AdditionalIngressAnnotation commons.FieldName = "additional_ingress_annotation" 44 | CanaryByHeader commons.FieldName = "canary_by_header" 45 | Key1 commons.FieldName = "key1" 46 | NginxAnnotationPrefix commons.FieldName = "nginx_annotation_prefix" 47 | StableIngress commons.FieldName = "stable_ingress" 48 | ) 49 | 50 | const ( 51 | PingPong commons.FieldName = "ping_pong" 52 | PingService commons.FieldName = "ping_service" 53 | PongService commons.FieldName = "pong_service" 54 | ) 55 | 56 | const ( 57 | Smi commons.FieldName = "smi" 58 | SmiRootService commons.FieldName = "smi_root_service" 59 | TrafficSplitName commons.FieldName = "traffic_split_name" 60 | ) 61 | -------------------------------------------------------------------------------- /spotinst/oceancd_strategy_canary/consts.go: -------------------------------------------------------------------------------- 1 | package oceancd_strategy_canary 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Name commons.FieldName = "strategy_name" 7 | Canary commons.FieldName = "canary" 8 | ) 9 | 10 | const ( 11 | Steps commons.FieldName = "steps" 12 | StepName commons.FieldName = "step_name" 13 | SetWeight commons.FieldName = "set_weight" 14 | ) 15 | 16 | const ( 17 | BackgroundVerification commons.FieldName = "background_verification" 18 | BGTemplateNames commons.FieldName = "template_names" 19 | ) 20 | 21 | const ( 22 | Pause commons.FieldName = "pause" 23 | Duration commons.FieldName = "duration" 24 | ) 25 | 26 | const ( 27 | SetCanaryScale commons.FieldName = "set_canary_scale" 28 | MatchTrafficWeight commons.FieldName = "match_traffic_weight" 29 | Replicas commons.FieldName = "replicas" 30 | Weight commons.FieldName = "weight" 31 | ) 32 | 33 | const ( 34 | SetHeaderRoute commons.FieldName = "set_header_route" 35 | HeaderRouteName commons.FieldName = "header_route_name" 36 | Match commons.FieldName = "match" 37 | HeaderName commons.FieldName = "header_name" 38 | HeaderValue commons.FieldName = "header_value" 39 | Exact commons.FieldName = "exact" 40 | Prefix commons.FieldName = "prefix" 41 | Regex commons.FieldName = "regex" 42 | ) 43 | 44 | const ( 45 | Verification commons.FieldName = "verification" 46 | TemplateNames commons.FieldName = "template_names" 47 | ) 48 | -------------------------------------------------------------------------------- /spotinst/oceancd_strategy_rolling/consts.go: -------------------------------------------------------------------------------- 1 | package oceancd_strategy_rolling 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Rolling commons.FieldName = "rolling" 7 | ) 8 | 9 | const ( 10 | RollingSteps commons.FieldName = "steps" 11 | RollingStepsName commons.FieldName = "steps_name" 12 | ) 13 | 14 | const ( 15 | RollingStepsPause commons.FieldName = "pause" 16 | RollingStepsDuration commons.FieldName = "duration" 17 | ) 18 | 19 | const ( 20 | RollingStepsVerification commons.FieldName = "verification" 21 | RollingStepsTemplateNames commons.FieldName = "template_names" 22 | ) 23 | -------------------------------------------------------------------------------- /spotinst/oceancd_verification_provider/const.go: -------------------------------------------------------------------------------- 1 | package oceancd_verification_provider 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | ClusterIDs commons.FieldName = "cluster_ids" 7 | Name commons.FieldName = "name" 8 | ) 9 | -------------------------------------------------------------------------------- /spotinst/oceancd_verification_provider_cloud_watch/const.go: -------------------------------------------------------------------------------- 1 | package oceancd_verification_provider_cloud_watch 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | CloudWatch commons.FieldName = "cloud_watch" 7 | IamArn commons.FieldName = "iam_arn" 8 | ) 9 | -------------------------------------------------------------------------------- /spotinst/oceancd_verification_provider_datadog/const.go: -------------------------------------------------------------------------------- 1 | package oceancd_verification_provider_datadog 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Datadog commons.FieldName = "datadog" 7 | Address commons.FieldName = "address" 8 | ApiKey commons.FieldName = "api_key" 9 | AppKey commons.FieldName = "app_key" 10 | ) 11 | -------------------------------------------------------------------------------- /spotinst/oceancd_verification_provider_jenkins/const.go: -------------------------------------------------------------------------------- 1 | package oceancd_verification_provider_jenkins 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Jenkins commons.FieldName = "jenkins" 7 | ApiToken commons.FieldName = "api_token" 8 | BaseUrl commons.FieldName = "base_url" 9 | Username commons.FieldName = "username" 10 | ) 11 | -------------------------------------------------------------------------------- /spotinst/oceancd_verification_provider_new_relic/const.go: -------------------------------------------------------------------------------- 1 | package oceancd_verification_provider_new_relic 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | NewRelic commons.FieldName = "new_relic" 7 | AccountId commons.FieldName = "account_id" 8 | BaseUrlNerdGraph commons.FieldName = "base_url_nerd_graph" 9 | BaseUrlRest commons.FieldName = "base_url_rest" 10 | PersonalApiKey commons.FieldName = "personal_api_key" 11 | Region commons.FieldName = "region" 12 | ) 13 | -------------------------------------------------------------------------------- /spotinst/oceancd_verification_provider_prometheus/const.go: -------------------------------------------------------------------------------- 1 | package oceancd_verification_provider_prometheus 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Prometheus commons.FieldName = "prometheus" 7 | Address commons.FieldName = "address" 8 | ) 9 | -------------------------------------------------------------------------------- /spotinst/oceancd_verification_template/consts.go: -------------------------------------------------------------------------------- 1 | package oceancd_verification_template 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Name commons.FieldName = "name" 7 | ) 8 | -------------------------------------------------------------------------------- /spotinst/oceancd_verification_template/fields_spotinst_oceancd_verification_provider.go: -------------------------------------------------------------------------------- 1 | package oceancd_verification_template 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/spotinst/spotinst-sdk-go/spotinst" 7 | 8 | "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" 9 | "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 10 | ) 11 | 12 | func Setup(fieldsMap map[commons.FieldName]*commons.GenericField) { 13 | 14 | fieldsMap[Name] = commons.NewGenericField( 15 | commons.OceanCDVerificationTemplate, 16 | Name, 17 | &schema.Schema{ 18 | Type: schema.TypeString, 19 | Required: true, 20 | }, 21 | func(resourceObject interface{}, resourceData *schema.ResourceData, meta interface{}) error { 22 | verificationTemplateWrapper := resourceObject.(*commons.OceanCDVerificationTemplateWrapper) 23 | verificationTemplate := verificationTemplateWrapper.GetVerificationTemplate() 24 | var value *string = nil 25 | if verificationTemplate.Name != nil { 26 | value = verificationTemplate.Name 27 | } 28 | if err := resourceData.Set(string(Name), value); err != nil { 29 | return fmt.Errorf(string(commons.FailureFieldReadPattern), string(Name), err) 30 | } 31 | return nil 32 | }, 33 | func(resourceObject interface{}, resourceData *schema.ResourceData, meta interface{}) error { 34 | verificationTemplateWrapper := resourceObject.(*commons.OceanCDVerificationTemplateWrapper) 35 | verificationTemplate := verificationTemplateWrapper.GetVerificationTemplate() 36 | if value, ok := resourceData.Get(string(Name)).(string); ok && value != "" { 37 | verificationTemplate.SetName(spotinst.String(value)) 38 | } 39 | return nil 40 | }, 41 | func(resourceObject interface{}, resourceData *schema.ResourceData, meta interface{}) error { 42 | return nil 43 | }, 44 | nil, 45 | ) 46 | } 47 | -------------------------------------------------------------------------------- /spotinst/oceancd_verification_template_args/consts.go: -------------------------------------------------------------------------------- 1 | package oceancd_verification_template_args 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Args commons.FieldName = "args" 7 | ArgName commons.FieldName = "arg_name" 8 | Value commons.FieldName = "value" 9 | ValueFrom commons.FieldName = "value_from" 10 | SecretKeyRef commons.FieldName = "secret_key_ref" 11 | Key commons.FieldName = "key" 12 | Name commons.FieldName = "name" 13 | ) 14 | -------------------------------------------------------------------------------- /spotinst/organization_policy/consts.go: -------------------------------------------------------------------------------- 1 | package organization_policy 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Name commons.FieldName = "name" 7 | Description commons.FieldName = "description" 8 | PolicyContent commons.FieldName = "policy_content" 9 | Statements commons.FieldName = "statements" 10 | Actions commons.FieldName = "actions" 11 | Effect commons.FieldName = "effect" 12 | Resources commons.FieldName = "resources" 13 | ) 14 | -------------------------------------------------------------------------------- /spotinst/organization_programmatic_user/consts.go: -------------------------------------------------------------------------------- 1 | package organization_programmatic_user 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Name commons.FieldName = "name" 7 | Description commons.FieldName = "description" 8 | Accounts commons.FieldName = "accounts" 9 | AccountId commons.FieldName = "account_id" 10 | AccountRole commons.FieldName = "account_role" 11 | Policies commons.FieldName = "policies" 12 | PolicyAccountIds commons.FieldName = "policy_account_ids" 13 | PolicyId commons.FieldName = "policy_id" 14 | UserGroupIds commons.FieldName = "user_group_ids" 15 | ) 16 | -------------------------------------------------------------------------------- /spotinst/organization_user/consts.go: -------------------------------------------------------------------------------- 1 | package organization_user 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Email commons.FieldName = "email" 7 | FirstName commons.FieldName = "first_name" 8 | LastName commons.FieldName = "last_name" 9 | Password commons.FieldName = "password" 10 | Role commons.FieldName = "role" 11 | Policies commons.FieldName = "policies" 12 | PolicyAccountIds commons.FieldName = "policy_account_ids" 13 | PolicyId commons.FieldName = "policy_id" 14 | UserGroupIds commons.FieldName = "user_group_ids" 15 | ) 16 | -------------------------------------------------------------------------------- /spotinst/organization_user_group/consts.go: -------------------------------------------------------------------------------- 1 | package organization_user_group 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Name commons.FieldName = "name" 7 | Description commons.FieldName = "description" 8 | UserIds commons.FieldName = "user_ids" 9 | Policies commons.FieldName = "policies" 10 | AccountIds commons.FieldName = "account_ids" 11 | PolicyId commons.FieldName = "policy_id" 12 | ) 13 | -------------------------------------------------------------------------------- /spotinst/provider_test.go: -------------------------------------------------------------------------------- 1 | package spotinst 2 | 3 | import ( 4 | "context" 5 | "os" 6 | "testing" 7 | 8 | "github.com/hashicorp/terraform-plugin-sdk/v2/diag" 9 | 10 | "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" 11 | ) 12 | 13 | var TestAccProviders map[string]*schema.Provider 14 | 15 | var testAccProviderGCP *schema.Provider 16 | var testAccProviderAWS *schema.Provider 17 | var testAccProviderAzure *schema.Provider 18 | var testAccProviderAzureV3 *schema.Provider 19 | 20 | func init() { 21 | testAccProviderGCP = Provider() 22 | testAccProviderAWS = Provider() 23 | testAccProviderAzure = Provider() 24 | testAccProviderAzureV3 = Provider() 25 | 26 | testAccProviderGCP.ConfigureContextFunc = providerConfigureGCP 27 | testAccProviderAWS.ConfigureContextFunc = providerConfigureAWS 28 | testAccProviderAzure.ConfigureContextFunc = providerConfigureAzure 29 | testAccProviderAzureV3.ConfigureContextFunc = providerConfigureAzure 30 | 31 | TestAccProviders = map[string]*schema.Provider{ 32 | "gcp": testAccProviderGCP, 33 | "aws": testAccProviderAWS, 34 | "azure": testAccProviderAzure, 35 | "azurev3": testAccProviderAzureV3, 36 | } 37 | } 38 | 39 | func TestProvider(t *testing.T) { 40 | if err := Provider().InternalValidate(); err != nil { 41 | t.Fatalf("err: %s", err) 42 | } 43 | } 44 | 45 | func TestProvider_impl(t *testing.T) { 46 | _ = Provider() 47 | } 48 | 49 | func testAccPreCheck(t *testing.T, provider string) { 50 | tokens := map[string]string{ 51 | "gcp": os.Getenv("SPOTINST_TOKEN_GCP"), 52 | "aws": os.Getenv("SPOTINST_TOKEN_AWS"), 53 | "azure": os.Getenv("SPOTINST_TOKEN_AZURE"), 54 | } 55 | 56 | if tokens[provider] == "" { 57 | t.Fatal(ErrNoValidCredentials.Error()) 58 | } 59 | } 60 | 61 | func providerConfigureGCP(context.Context, *schema.ResourceData) (interface{}, diag.Diagnostics) { 62 | config := Config{ 63 | Token: os.Getenv("SPOTINST_TOKEN_GCP"), 64 | Account: os.Getenv("SPOTINST_ACCOUNT_GCP"), 65 | } 66 | 67 | return config.Client() 68 | } 69 | 70 | func providerConfigureAWS(context.Context, *schema.ResourceData) (interface{}, diag.Diagnostics) { 71 | config := Config{ 72 | Token: os.Getenv("SPOTINST_TOKEN_AWS"), 73 | Account: os.Getenv("SPOTINST_ACCOUNT_AWS"), 74 | } 75 | 76 | return config.Client() 77 | } 78 | 79 | func providerConfigureAzure(context.Context, *schema.ResourceData) (interface{}, diag.Diagnostics) { 80 | config := Config{ 81 | Token: os.Getenv("SPOTINST_TOKEN_AZURE"), 82 | Account: os.Getenv("SPOTINST_ACCOUNT_AZURE"), 83 | } 84 | 85 | return config.Client() 86 | } 87 | -------------------------------------------------------------------------------- /spotinst/subscription/consts.go: -------------------------------------------------------------------------------- 1 | package subscription 2 | 3 | import "github.com/spotinst/terraform-provider-spotinst/spotinst/commons" 4 | 5 | const ( 6 | Prefix = "subscription_" 7 | ) 8 | 9 | const ( 10 | ResourceId commons.FieldName = "resource_id" 11 | EventType commons.FieldName = "event_type" 12 | Protocol commons.FieldName = "protocol" 13 | Endpoint commons.FieldName = "endpoint" 14 | Format commons.FieldName = "format" 15 | ) 16 | -------------------------------------------------------------------------------- /tools.go: -------------------------------------------------------------------------------- 1 | //go:build tools 2 | // +build tools 3 | 4 | package main 5 | 6 | //go:generate go install github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs 7 | 8 | import ( 9 | _ "github.com/bflad/tfproviderlint/cmd/tfproviderlint" 10 | _ "github.com/client9/misspell/cmd/misspell" 11 | _ "github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs" 12 | _ "golang.org/x/lint/golint" 13 | ) 14 | -------------------------------------------------------------------------------- /version/version.go: -------------------------------------------------------------------------------- 1 | package version 2 | 3 | import ( 4 | "strings" 5 | 6 | "github.com/hashicorp/go-version" 7 | ) 8 | 9 | var ( 10 | // Version represents the main version number. 11 | // 12 | // Read-only. 13 | Version = "1.220.2" 14 | 15 | // Prerelease represents an optional pre-release label for the version. 16 | // If this is "" (empty string) then it means that it is a final release. 17 | // Otherwise, this is a pre-release such as "beta", "rc1", etc. 18 | // 19 | // Read-only. 20 | Prerelease = "" 21 | 22 | // SemVer is an instance of SemVer version (https://semver.org/) used to 23 | // verify that the full version is a proper semantic version. 24 | // 25 | // Populated at runtime. 26 | // Read-only. 27 | SemVer *version.Version 28 | ) 29 | 30 | func init() { 31 | v := Version 32 | 33 | if Prerelease != "" { 34 | v += "-" + strings.TrimPrefix(Prerelease, "-") 35 | } 36 | 37 | // Parse and verify the given version. 38 | SemVer = version.Must(version.NewSemver(v)) 39 | } 40 | 41 | // String returns the complete version string, including prerelease and metadata. 42 | func String() string { 43 | return SemVer.String() 44 | } 45 | --------------------------------------------------------------------------------