opentelekomcloud / terraform-provider-opentelekomcloud

Terraform OpenTelekomCloud provider
https://registry.terraform.io/providers/opentelekomcloud/opentelekomcloud/latest
Mozilla Public License 2.0
85 stars 77 forks source link

Cannot create RDS Paramater Group V3 with `values` #2354

Closed hanife-Orthopy closed 5 months ago

hanife-Orthopy commented 11 months ago

Terraform provider version

provider registry.terraform.io/providers/opentelekomcloud/opentelekomcloud v1.31.5

Affected Resource(s)

Terraform Configuration Files

resource "opentelekomcloud_rds_parametergroup_v3" "pg_test" {
  name        = "pg_test"

  values = {
    max_connections = "100"
    jit             = "off"
  }
  datastore {
    type    = "PostgreSQL"
    version = "13"
  }
}

Debug Output/Panic Output

error message: {"error_msg":"Operation not allowed.","error_code":"DBS.212003"}

Steps to Reproduce

  1. Execute 'terraform apply' to create the RDS Parameter group using the provided example code.
  2. Parameter group has max_connections = "100" and jit = "off"
  3. Attempting to create the RDS parameter group with these or any other custom values may result in an "Operation not allowed" error.
  4. When values part is arranged as an empty set ( values = {} ), then it works. After the initial creation, you can modify the 'values' as needed. The problem occurs specifically during the initial creation.

Expected Behavior

The parameter group should be created with expected values.

Actual Behavior

It is necessary to create a parameter group initially with empty values and subsequently modify the values as a second step.

artem-lifshits commented 11 months ago

Hello @hanife-Orthopy I was able to reproduce the issue. Looks like it's API problem, ticket created for OTC database squad: https://jira.tsi-dev.otc-service.com/browse/OTCDB-4753

artem-lifshits commented 11 months ago

As a workaround you can put parameter values directly in parameters field for opentelekomcloud_rds_instance_v3 .

artem-lifshits commented 11 months ago

@hanife-Orthopy provided datastore type value is case sensitive. Please use postgresql instead of PostgreSQL.

hanife-Orthopy commented 11 months ago

Thank you @artem-lifshits. The main issue has been solved, but the values specified in the parameter group do not match the expected configuration in the RDS instance connected to that group. In other words, the instance's parameter values are still set to their default settings. I think a ticket has already been written to address this problem.

artem-lifshits commented 10 months ago

@hanife-Orthopy looks like an OTC bug, I've updated ticket with additional information regarding parameter values not being applied. Ticket number is same for now: https://jira.tsi-dev.otc-service.com/browse/OTCDB-4753

artem-lifshits commented 6 months ago

Answer from tech support:

When you create a parameter template for RDS for PostgreSQL, the following specification parameters do not take effect:
- shared_buffers
- max_connections
- max_prepared_transactions
- effective_cache_size
- maintenance_work_mem
- max_wal_size
- work_mem
eduardOrthopy commented 6 months ago

Answer from tech support:

When you create a parameter template for RDS for PostgreSQL, the following specification parameters do not take effect:
- shared_buffers
- max_connections
- max_prepared_transactions
- effective_cache_size
- maintenance_work_mem
- max_wal_size
- work_mem

@artem-lifshits, thanks for your support. I do have a follow-up question, though.

The expectation from tech support is that we as customers just have to live/deal with that? Do you know if there is an intention to document or fix this in the future?

I know that you are not the responsible person here, so I would like to understand whom to reach out to about this, and the fact that it took them about 5 months to get back to you on this.

Quite frankly, acknowledging that stuff is broken is a good start, and I would totally be fine with things ending there on a free product. But when it comes to something we pay money for, e.g. the OTC cloud, I tend to be less lenient.

Again, I understand that this is not your responsibility, and thank you for your work on this.

artem-lifshits commented 6 months ago

@eduardOrthopy ah your point is very valid. I will contact our customer success engineer regarding this issue and try to get some definite answers from him.

eduardOrthopy commented 6 months ago

@artem-lifshits thanks a lot. I do appreciate the work you are putting into this. Let me know if there is anything I can do on my side to move this forward.

artem-lifshits commented 6 months ago

@eduardOrthopy I'm not sure if it will fit for you but there's a workaround to set parameters like max_connections directly for DB instead of using parameter groups.

You can specify parameters in your opentelekomcloud_rds_instance_v3 resource:

resource "opentelekomcloud_rds_instance_v3" "instance" {
  name              = "tf_rds_instance"
  availability_zone = ["eu-de-01"]
  db {
    password = "XXXXX"
    type     = "PostgreSQL"
    version  = "13"
    port     = "8635"
  }
  security_group_id = data.opentelekomcloud_networking_secgroup_v2.default_secgroup.id
  subnet_id         = data.opentelekomcloud_vpc_subnet_v1.shared_subnet.network_id
  vpc_id            = data.opentelekomcloud_vpc_subnet_v1.shared_subnet.vpc_id
  volume {
    type = "ULTRAHIGH"
    size = 40
  }
  flavor = "rds.pg.c2.large"
  parameters = {
    max_prepared_transactions = "200"
    max_connections           = "250"
    autovacuum_max_workers    = "20"
  }
}

Parameters that don't take effect with parameter group should work here.

eduardOrthopy commented 6 months ago

Hi @artem-lifshits.

Thanks for pointing this out. That is what we are currently doing, and at least for the parameters we are using, so max_connections and jit this works.

robert1x2 commented 6 months ago

@eduardOrthopy, @hanife-Orthopy is this solving your issues?

eduardOrthopy commented 6 months ago

@robert1x2 Generically speaking: Working around an issue is not a solution, it is a workaround.

Now this workaround will become the solution, if you decide that you will not, or cannot make the templates work as expected, or if you explain that the expectation is wrong, in which case I would appreciate it if you did so in the documentation as well.

For example, if the documentation states:

When you create a parameter template for RDS for PostgreSQL, the following specification parameters do not take effect:
- shared_buffers
- max_connections
- max_prepared_transactions
- effective_cache_size
- maintenance_work_mem
- max_wal_size
- work_mem

To set these parameters, use the parameter groups of the database

Then you, as the service provider, have just upgraded the workaround to the official solution.

I also understand that this is not a high-priority item.

As I said, if you officially tell me that is something you will not change, that is also fine.

artem-lifshits commented 6 months ago

Documentation regarding parameter groups template constraints is updated in provider documentation, available in latest release.

artem-lifshits commented 5 months ago

@eduardOrthopy I wasn't able to get any answers regarding special parameters besides what we received from tech support and what was included in official documentation. The workaround info that was added recently in docportal is also included in opentelekomcloud_rds_parametergroup_v3 doc.

That's all we can do from provider side.

robert1x2 commented 5 months ago

@eduardOrthopy would contact OTC Service Desk please to be able reaching out to you. We suggest doing a phonecall together: https://www.open-telekom-cloud.com/en/contact to fully understand your issue and maybe help you with more than a workaround. Regards Robert

eduardOrthopy commented 5 months ago

@robert1x2 thanks for the offer. I will put it in my calendar for after Easter and reach out via the support contact.

@artem-lifshits thanks for getting this well documented. This makes it easier to argue why we are doing things the way we are during (source code) audits.