-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle the creation of default scaling policies #443
base: master
Are you sure you want to change the base?
Conversation
ab66291
to
4e4021a
Compare
bumping the SDK causes tests to fail, I will report that to the relevant teams. |
For each connected cluster, a default scaling policy is created. An existing scaling policy can be imported into the | ||
Terraform state using the `terraform import` command or the [`import`](https://developer.hashicorp.com/terraform/language/import#syntax) block. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For each connected cluster, a default scaling policy is created. An existing scaling policy can be imported into the | |
Terraform state using the `terraform import` command or the [`import`](https://developer.hashicorp.com/terraform/language/import#syntax) block. | |
For each connected cluster, a default scaling policy is created. An existing scaling policy can be imported into the | |
Terraform state using the `terraform import` command or the [`import`](https://developer.hashicorp.com/terraform/language/import#syntax) block (recommended for Terraform 1.5.0+). |
3. Review the `generated.tf` file and ensure that the imported scaling policy is correct. Terraform sets zero values, | ||
e.g., for `look_back_period_seconds`. All such properties can be removed to use the defaults. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3. Review the `generated.tf` file and ensure that the imported scaling policy is correct. Terraform sets zero values, | |
e.g., for `look_back_period_seconds`. All such properties can be removed to use the defaults. | |
3. Review the `generated.tf` file and ensure the imported scaling policy is correct. Terraform will generate this file by setting values equal to zero for certain configuration parameters. | |
For example: | |
```hcl | |
cpu { | |
look_back_period_seconds = 0 | |
} |
You can simplify the configuration by:
- Removing fields set to
0
to use default values - Keeping only the fields you want to configure explicitly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The zero values were a little unclear to me.
I have yet to figure out how to include a code block in a suggestion without breaking the suggestion syntax...
terraform apply "import.plan" | ||
``` | ||
|
||
### Import using `terraform import` command |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
### Import using `terraform import` command | |
### Import using the `terraform import` command |
|
||
The recommended way is to [import](#importing) the scaling policy and then apply the changes to the policy. | ||
However, if that’s not possible, you can define the default policy resource yourself. The CAST AI Terraform provider, | ||
will update the existing policy instead of returning an error. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
## Upsert scaling policy | |
The recommended way is to [import](#importing) the scaling policy and then apply the changes to the policy. | |
However, if that’s not possible, you can define the default policy resource yourself. The CAST AI Terraform provider, | |
will update the existing policy instead of returning an error. | |
## Upsert scaling policy | |
The recommended way is to [import](#importing) the scaling policy and then apply the changes to the policy. | |
However, if that’s not possible, you can define the default policy resource yourself. The CAST AI Terraform provider | |
will update the existing policy instead of returning an error. |
Description
This PR allows to manage default scaling policies without importing them. If there is create operation against the default scaling policy, it's changed to update.
Without this PR, the following error is thrown:
I also update the import section to describe easier way of doing that.
Limitations