-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
azurerm_redis_cache
- Check if redis_configuration.rdb_backup_enabled
and redis_configuration.aof_backup_enabled
configured
#22309
Conversation
hi @xuzhang3, we using this provider with version 3.0.0. Please help me consider releasing this tag |
@em-le-ts I'm afraid you may need to upgrade to the latest version of AzureRM provider. One workaround not upgrade the AzureRM provider you can build a private package. |
if connStr := raw["rdb_storage_connection_string"].(string); connStr == "" { | ||
return nil, fmt.Errorf("The rdb_storage_connection_string property must be set when rdb_backup_enabled is true") | ||
} | ||
config := d.GetRawConfig().AsValueMap()["redis_configuration"].AsValueSlice()[0].AsValueMap() |
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.
We can't be using GetRawConfig
since this functionality won't be available when we move to framework.
There is a wrapper function that can be used instead pluginsdk.IsExplicitlyNullInConfig
.
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.
rdb_storage_connection_string
is nested in redis_configuration
. Cannot get it with pluginsdk.IsExplicitlyNullInConfig(d, "redis_configuration.0.rdb_backup_enabled")
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.
In this case there's no need to use either IsExplicitlyNullInConfig
or d.GetRawConfig().AsValueMap()
- this should only be set if the value is set to true
?
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.
rdb_backup_enabled
can be false
or true
and it can only be set when SKU is Premium
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.
@avendretter @em-le-ts rdb_backup_enabled
can be set when SKU is Premium
. Current V2 SDK will auto set a default value(false
) to it even not configured. So I need to know if this is configured in the HCL, One way to get it is use d.GetRawConfig().AsValueMap()
but this function is not compatible with the terraform framework plugin. Currently we are blocked here.
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.
@xuzhang3 I used the Basic
SKU and it was failing, saying that the rdb_backup_enabled
option is only allowed for Premium
, so I assume it will be set to true regardless of the inputs of SKU
@stephybun |
any update sir @xuzhang3 ? |
g'day @xuzhang3, |
@avendretter I updated the PR |
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.
Thanks for updating @xuzhang3. I think this looks ok, but we should also check for the opposite scenario (see inline comment below).
return nil, fmt.Errorf("The rdb_storage_connection_string property must be set when rdb_backup_enabled is true") | ||
skuName := d.Get("sku_name").(string) | ||
// rdb_backup_enabled is available when SKU is Premium | ||
if strings.EqualFold(skuName, string(redis.SkuNamePremium)) { |
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.
Can we also check if the SKU is not valid for this property, and return an error in case the user sets rdb_backup_enabled = true
?
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.
Add a new constraint to cover the rdb_backup_enabled = true
scenario.
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.
Thanks for the update @xuzhang3, this LGTM
@manicminer I am still getting error on 3.66.0 for the field aof_backup_enabled for a Standard SKU of redis. Are you sure this has been released? I have also tried by adding the field to ignore_changes block. But still I get the error. This is my code
|
After upgrading to 3.66.0 problem still persists, only rolling back to 3.53.0 helped to get successfull run |
@xuzhang3 Could you take a look into this? |
@raswinraaj Remove the |
@xuzhang3 if I remove that, i get this below error for a Redis with Standard SKU . I have actually imported this resource into my existing TF State. unexpected status 400 with error: BadRequest: Feature properties.redisConfiguration.aof-backup-enabled requires a Premium sku to be set. |
@raswinraaj I see, this is the same issue like |
ok. so is there a solution for this? I currently got it working by setting redis_configuration under ignore_changes lifecycle.
|
@raswinraaj add a constraint to make sure the configuration is map to the required SKU type. Bool type will auto set to a default value |
We are currently using the most recent version of the provider, |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
Fixes: #21967
Check if
redis_configuration.rdb_backup_enabled
andredis_configuration.aof_backup_enabled
configured. Ignore the default values.