oracle / terraform-provider-oci

Terraform Oracle Cloud Infrastructure provider
https://www.terraform.io/docs/providers/oci/
Mozilla Public License 2.0
759 stars 676 forks source link

invalid or unknown key: is_free_tier for ATP #924

Closed sidhlipu closed 4 years ago

sidhlipu commented 4 years ago

Always free ATP is not working and throwing the below error.

oci_database_autonomous_database.test_autonomous_database: : invalid or unknown key: is_free_tier

parrneet commented 4 years ago

Hi @sidhlipu - What is the provider version that you are using? Free tier was released in v3.44.0

sidhlipu commented 4 years ago

I am using the latest terraform version as well as the provider version.

[opc@daas-devops-docker-slave-node1 autonomous-db]$ terraform plan var.autonomous_database_is_free_tier Enter a value: yes

var.db_name Enter a value: testdb

Refreshing Terraform state in-memory prior to plan... The refreshed state will be used to calculate this plan, but will not be persisted to local or remote state storage.

data.oci_database_autonomous_databases.test_autonomous_databases: Refreshing state...

Error: Error refreshing state: 1 error(s) occurred:

[opc@daas-devops-docker-slave-node1 autonomous-db]$ terraform -version Terraform v0.11.11

Your version of Terraform is out of date! The latest version is 0.12.13. You can update by downloading from www.terraform.io/downloads.html [opc@daas-devops-docker-slave-node1 autonomous-db]$ cat provider.tf |grep version version = ">= 3.51.0" [opc@daas-devops-docker-slave-node1 autonomous-db]$ cat atp.tf

data "oci_database_autonomous_database" "test_autonomous_database" {

Required

admin_password = "${var.admin_password}"

compartment_id = "${var.compartment_ocid}"

cpu_core_count = "${var.cpu_core_count}"

data_storage_size_in_tbs = "0"

db_name = "${var.db_name}"

Optional

db_workload = "OLTP"

display_name = "${var.db_name}"

is_free_tier = "${var.autonomous_database_is_free_tier}"

}

data "oci_database_autonomous_databases" "test_autonomous_databases" {

Required

compartment_id = "${var.compartment_ocid}"

Optional

db_workload = "OLTP" is_free_tier = "True" }

resource "oci_database_autonomous_database" "test_autonomous_database" {

Required

admin_password = "Testalwaysfree1" compartment_id = "${var.compartment_ocid}" cpu_core_count = "1" data_storage_size_in_tbs = "0" db_name = "testadb"

Optional

db_workload = "OLTP" display_name = "test_autonomous_database"

is_auto_scaling_enabled = "false"

license_model = "LICENSE_INCLUDED" is_free_tier = "True" } [opc@daas-devops-docker-slave-node1 autonomous-db]$

abhilash-av commented 4 years ago

@sidhlipu The resource is created on the initial apply. The field time_reclamation_of_free_autonomous_database is populated by the service when the database is inactive(https://docs.cloud.oracle.com/iaas/api/#/en/database/20160918/AutonomousDatabase/) at what point you see this error. We are making a fix that will be released in the next provider version.

For now, as a workaround could you please remove the data "oci_database_autonomous_databases" "test_autonomous_databases" from your config. Perform a terraform destroy and then terraform apply to create the resource again. Also to ensure not to his the same error please make sure to keep the database active.

We will update you once the new provider version is released so you can upgrade to that version which has the fix.

sidhlipu commented 4 years ago

The other challenge I have is, the free tier takes storage space of 20GB and storage_in_tbs parameter is mandatory for ATP service. Am not able to assign a decimal(0.02) to the variable.

May be not sure if that can also be fixed.

abhilash-av commented 4 years ago

@sidhlipu storage_in_tbs accepts only an integer(https://docs.cloud.oracle.com/iaas/api/#/en/database/20160918/datatypes/CreateAutonomousDatabaseDetails). Also, this value is ignored for Always Free resources as mentioned on the (https://github.com/terraform-providers/terraform-provider-oci/blob/master/website/docs/r/database_autonomous_database.html.markdown). For more details you can refer https://www.oracle.com/cloud/free/

parrneet commented 4 years ago

Hi @sidhlipu The error expected type 'string', got unconvertible type 'common.SDKTime' has been fixed in v3.52.0 For the size, free tier dbs are by default created with size 20GB and any value given by user is ignored.

I'm closing the issue. Feel free to reopen if you have any more questions.