TerraformおよびOCIリソース・マネージャを使用したOracle NoSQL表の更新
この記事では、Terraformを使用して既存のNDCS表スキーマまたはストレージ(読取りまたは書込み)ユニットを更新するステップを示します。OCI Resource Manager CLIを使用して、NDCS表を更新します。この記事に進む前に、NoSQL Cloud Serviceを認識しており、Terraformとともにその基本を理解していることを前提としています。
- スタックを更新します。
- 実行計画を生成して確認します。
- 適用ジョブを実行して、必要なNoSQLリソースを更新します。
- 必要に応じて、ログ・ファイルを確認します。
この記事には次のトピックが含まれます:
ステップ1: NoSQLデータベース表のTerraformオーバーライド・ファイルの作成
nosql_override.tf
またはoverride.tf
という名前の新しいファイルを作成し、オーバーライドするNoSQLデータベース表オブジェクトの特定の部分を指定します。たとえば、表の列を追加または削除して既存の列のデータ型を変更したり、表の制限(読取り/書込みおよび記憶域単位)を変更できます。
次の例では、demo
表を変更して、fullName
という名前の既存の列を削除し、demoKeyVal
表を変更して、最後にshortName
という名前の新しい列を追加します。
たとえば次のようにします。
nosql.tf
がある場合:variable "compartment_ocid" {
}
resource "oci_nosql_table" "nosql_demo" {
compartment_id = var.compartment_ocid
ddl_statement = "CREATE TABLE if not exists demo (ticketNo INTEGER, fullName STRING, contactPhone STRING, confNo STRING, gender STRING, bagInfo JSON, PRIMARY KEY (ticketNo))"
name = "demo"
table_limits {
max_read_units = var.table_table_limits_max_read_units
max_storage_in_gbs = var.table_table_limits_max_storage_in_gbs
max_write_units = var.table_table_limits_max_write_units
}
}
resource "oci_nosql_table" "nosql_demoKeyVal" {
compartment_id = var.compartment_ocid
ddl_statement = "CREATE TABLE if not exists demoKeyVal (key INTEGER GENERATED ALWAYS AS IDENTITY (START WITH 1 INCREMENT BY 1 NO CYCLE), value JSON, PRIMARY KEY (key))"
name = "demoKeyVal"
table_limits {
max_read_units = var.table_table_limits_max_read_units
max_storage_in_gbs = var.table_table_limits_max_storage_in_gbs
max_write_units = var.table_table_limits_max_write_units
}
}
demo
表を変更し、fullName
という名前の既存の列を削除し、demoKeyVal
表を変更して、最後にshortNameという名前の新しい列を追加します。次に、次の内容を含むファイルnosql_override.tf
またはoverride.tf
を作成します。variable "compartment_ocid" {
}
resource "oci_nosql_table" "nosql_demo" {
compartment_id = var.compartment_ocid
ddl_statement = "CREATE TABLE if not exists demo (ticketNo INTEGER, contactPhone STRING,
confNo STRING, gender STRING, bagInfo JSON, PRIMARY KEY (ticketNo))"
name = "demo"
}
resource "oci_nosql_table" "nosql_demoKeyVal" {
compartment_id = var.compartment_ocid
ddl_statement = "CREATE TABLE if not exists demoKeyVal (key INTEGER GENERATED ALWAYS AS IDENTITY
(START WITH 1 INCREMENT BY 1 NO CYCLE), value JSON, shortName STRING, PRIMARY KEY (key))"
name = "demoKeyVal"
}
ノート:
既存の表への列の追加中は、表の末尾に列のみを追加できます。既存の列の前に新しい列を挿入したり、既存の列の順序を変更することはできません。たとえば、value
列の前にshortName
列を追加したり、demoKeyVal
表のkey
列とvalue
列を交換することはできません。これにより、エラーが発生します。
Terraformがこのファイル(nosql_override.tf
)を処理する場合、内部的にDDL文(CREATE TABLE文)を解析して既存の表定義と比較し、同等のALTER TABLE文を生成して適用します。
ステップ2: 実行計画の更新
ノート:
これらの手順は、ソース・コード制御システムに格納されている構成には適用されません。GitHubやGitlabなどのソース・コード制御システムを使用してterraform構成ファイルを維持している場合は、このステップをスキップしてステップ3に直接移動できます。構成の最新バージョンは、関連付けられたスタックで実行されているすべてのジョブによって自動的に使用されます。terraform.zip
を使用して実行計画を更新します。更新された terraform.zip
ファイルには、次のファイルが含まれています。
provider.tf
nosql.tf
nosql_override.tf or override.tf
terraform.tfvars
variables.tf
oci resource-manager stack update
--stack-id ocid1.ormstack.oc1.phx.aaaaaaaa7jrci2s5iav5tdxpl6ucwo2dwazzrdkfhs6bxiohgcpkscmr57bq
--config-source terraform.zip
{
"data": {
"compartment-id": "ocid1.compartment.oc1..aaaaaaaawrmvqjzoegxbsixp5k3b5554vlv2kxukobw3drjho3f7nf5ca3ya",
"config-source": {
"config-source-type": "ZIP_UPLOAD",
"working-directory": null
},
"defined-tags": {},
"description": null,
"display-name": "ormstack20220117104810",
"freeform-tags": {},
"id": "ocid1.ormstack.oc1.phx.aaaaaaaa7jrci2s5iav5tdxpl6ucwo2dwazzrdkfhs6bxiohgcpkscmr57bq",
"lifecycle-state": "ACTIVE",
"stack-drift-status": "NOT_CHECKED",
"terraform-version": "1.0.x",
"time-created": "2022-01-17T10:48:10.878000+00:00",
"time-drift-last-checked": null,
"variables": {}
},
"etag": "068e7b962aa43c7b3e7bf5c24b2d7f937db0901a784a9dce8715d76d78ad30f3"
}
オーバーライドterraform構成ファイルを含む新しい更新されたzipファイルで既存のスタックを更新しました。
ステップ3: 実行計画の生成
oci resource-manager job create-plan-job
–-stack-id <stack_OCID>
--display-name "<friendly_name>"
oci resource-manager job create-plan-job
--stack-id ocid1.ormstack.oc1.phx.aaaaaaaa7jrci2s5iav5tdxpl6ucwo2dwazzrdkfhs6bxiohgcpkscmr57bq
{
"data": {
"apply-job-plan-resolution": null,
"cancellation-details": {
"is-forced": false
},
"compartment-id": "ocid1.compartment.oc1..aaaaaaaawrmvqjzoegxbsixp5k3b5554vlv2kxukobw3drjho3f7nf5ca3ya",
"config-source": {
"config-source-record-type": "ZIP_UPLOAD"
},
"defined-tags": {},
"display-name": "ormjob20220124122310",
"failure-details": null,
"freeform-tags": {},
"id": "ocid1.ormjob.oc1.phx.aaaaaaaagke5ajwwchvxkql2c56qoohhvc2dxu5fnqswnpw4hsombrfijnia",
"job-operation-details": {
"operation": "PLAN",
"terraform-advanced-options": {
"detailed-log-level": null,
"is-refresh-required": true,
"parallelism": 10
}
},
"lifecycle-state": "ACCEPTED",
"operation": "PLAN",
"resolved-plan-job-id": null,
"stack-id": "ocid1.ormstack.oc1.phx.aaaaaaaa7jrci2s5iav5tdxpl6ucwo2dwazzrdkfhs6bxiohgcpkscmr57bq",
"time-created": "2022-01-24T12:23:10.366000+00:00",
"time-finished": null,
"variables": {},
"working-directory": null
},
"etag": "b77d497287af3dd2d166871457d880ffee9952ee2c9a44e8f9dfa3e02b974c95"
}
"id": "ocid1.ormjob.oc1.phx.aaaaaaaagke5ajwwchvxkql2c56qoohhvc2dxu5fnqswnpw4hsombrfijnia",
"job-operation-details": {
"operation": "PLAN"
...
}
サブステップ3.1: 実行計画の確認
oci resource-manager job get-job-logs
--job-id <plan_job_OCID>
oci resource-manager job get-job-logs
--job-id ocid1.ormjob.oc1.phx.aaaaaaaagke5ajwwchvxkql2c56qoohhvc2dxu5fnqswnpw4hsombrfijnia
...
{
"level": "INFO",
"message": " # data.oci_nosql_table.nosql_demo will be read during apply",
"timestamp": "2022-01-24T12:23:36.445000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": " <= data \"oci_nosql_table\" \"nosql_demo\" {",
"timestamp": "2022-01-24T12:23:36.445000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": " ~ ddl_statement = \"CREATE TABLE IF NOT EXISTS demo(ticketNo INTEGER, contactPhone STRING, confNo STRING, gender STRING, bagInfo JSON, PRIMARY KEY(SHARD(ticketNo)))\" -> (known after apply)",
"timestamp": "2022-01-24T12:23:36.445000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": " ~ id = \"ocid1.nosqltable.oc1.phx.amaaaaaau7x7rfyasvdkoclhgryulgzox3nvlxb2bqtlxxsrvrc4zxr6lo4a\" -> (known after apply)",
"timestamp": "2022-01-24T12:23:36.445000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": " ~ is_auto_reclaimable = true -> (known after apply)",
"timestamp": "2022-01-24T12:23:36.445000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": " - \"orcl-cloud.free-tier-retained\" = \"true\"",
"timestamp": "2022-01-24T12:23:36.446000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": " # data.oci_nosql_table.nosql_demoKeyVal will be read during apply",
"timestamp": "2022-01-24T12:23:36.446000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": " <= data \"oci_nosql_table\" \"nosql_demoKeyVal\" {",
"timestamp": "2022-01-24T12:23:36.446000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": " ~ ddl_statement = \"CREATE TABLE IF NOT EXISTS demoKeyVal(key INTEGER, value JSON, shortName STRING, PRIMARY KEY(SHARD(key)))\" -> (known after apply)",
"timestamp": "2022-01-24T12:23:36.446000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": " ~ id = \"ocid1.nosqltable.oc1.phx.amaaaaaau7x7rfyaqgpbjucp3s6jjzpnar4lg5yudxhwlqrlbd54l3wdo7hq\" -> (known after apply)",
"timestamp": "2022-01-24T12:23:36.447000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": " ~ is_auto_reclaimable = true -> (known after apply)",
"timestamp": "2022-01-24T12:23:36.447000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": " # oci_nosql_table.nosql_demo will be updated in-place",
"timestamp": "2022-01-24T12:23:36.447000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": " ~ resource \"oci_nosql_table\" \"nosql_demo\" {",
"timestamp": "2022-01-24T12:23:36.447000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": " ~ ddl_statement = \"CREATE TABLE IF NOT EXISTS demo(ticketNo INTEGER, contactPhone STRING, confNo STRING, gender STRING, bagInfo JSON, fullName STRING, PRIMARY KEY(SHARD(ticketNo)))\" -> \"ALTER TABLE demo (DROP fullName)\"",
"timestamp": "2022-01-24T12:23:36.447000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": " # oci_nosql_table.nosql_demoKeyVal will be updated in-place",
"timestamp": "2022-01-24T12:23:36.447000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": " ~ resource \"oci_nosql_table\" \"nosql_demoKeyVal\" {",
"timestamp": "2022-01-24T12:23:36.447000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": " ~ ddl_statement = \"CREATE TABLE IF NOT EXISTS demoKeyVal(key INTEGER, value JSON, PRIMARY KEY(SHARD(key)))\" -> \"ALTER TABLE demoKeyVal (ADD shortName STRING)\"",
"timestamp": "2022-01-24T12:23:36.448000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": " ~ nosql_kv_table_ddl_statement = \"CREATE TABLE IF NOT EXISTS demoKeyVal(key INTEGER, value JSON, shortName STRING, PRIMARY KEY(SHARD(key)))\" -> (known after apply)",
"timestamp": "2022-01-24T12:23:36.448000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": " ~ nosql_table_ddl_statement = \"CREATE TABLE IF NOT EXISTS demo(ticketNo INTEGER, contactPhone STRING, confNo STRING, gender STRING, bagInfo JSON, PRIMARY KEY(SHARD(ticketNo)))\" -> (known after apply)",
"timestamp": "2022-01-24T12:23:36.448000+00:00",
"type": "TERRAFORM_CONSOLE"
},
...
demo
とdemoKeyVal
の2つのNoSQL表のスキーマを更新し、列を追加および削除します。{
...
"message": "Plan: 0 to add, 2 to change, 0 to destroy.",
...
}
ステップ4: 適用ジョブの実行
- 計画ジョブ(実行計画を「適用」)を指定するには、
FROM_PLAN_JOB_ID
を使用します:oci resource-manager job create-apply-job --stack-id <stack_OCID> --execution-plan-strategy FROM_PLAN_JOB_ID --execution-plan-job-id <plan_job_OCID> --display-name "Example Apply Job"
- 適用ジョブを自動的に承認する(計画ジョブは指定しない)には、
AUTO_APPROVED
を使用します:oci resource-manager job create-apply-job --stack-id <stack_OCID> --execution-plan-strategy AUTO_APPROVED --display-name "Example Apply Job"
oci resource-manager job create-apply-job
--stack-id ocid1.ormstack.oc1.phx.aaaaaaaa7jrci2s5iav5tdxpl6ucwo2dwazzrdkfhs6bxiohgcpkscmr57bq
--execution-plan-strategy AUTO_APPROVED
--display-name "Update NoSQL Tables Using Terraform"
{ "data": { "apply-job-plan-resolution": { "is-auto-approved": true, "is-use-latest-job-id": null, "plan-job-id": null }, "cancellation-details": { "is-forced": false }, "compartment-id": "ocid1.compartment.oc1..aaaaaaaawrmvqjzoegxbsixp5k3b5554vlv2kxukobw3drjho3f7nf5ca3ya", "config-source": { "config-source-record-type": "ZIP_UPLOAD" }, "defined-tags": {}, "display-name": "Update NoSQL Tables Using Terraform", "failure-details": null, "freeform-tags": {}, "id": "ocid1.ormjob.oc1.phx.aaaaaaaacmnanu2qd34x7l5uicgpdfpjbsgh5swddmtslb3qmbzg3dmuc3bq", "job-operation-details": { "execution-plan-job-id": null, "execution-plan-strategy": "AUTO_APPROVED", "operation": "APPLY", "terraform-advanced-options": { "detailed-log-level": null, "is-refresh-required": true, "parallelism": 10 } }, "lifecycle-state": "ACCEPTED", "operation": "APPLY", "resolved-plan-job-id": null, "stack-id": "ocid1.ormstack.oc1.phx.aaaaaaaa7jrci2s5iav5tdxpl6ucwo2dwazzrdkfhs6bxiohgcpkscmr57bq", "time-created": "2022-01-24T12:36:52.911000+00:00", "time-finished": null, "variables": {}, "working-directory": null }, "etag": "b2af026af48897c7839c347e06a8c40ec3ce1cac08a3da2f0c6ee74fb07078ab" }
サブステップ4.1: ジョブのステータスの確認
oci resource-manager job get
--job-id <job_OCID>
oci resource-manager job get
--job-id ocid1.ormjob.oc1.phx.aaaaaaaacmnanu2qd34x7l5uicgpdfpjbsgh5swddmtslb3qmbzg3dmuc3bq
{
"data": {
"apply-job-plan-resolution": {
"is-auto-approved": true,
"is-use-latest-job-id": null,
"plan-job-id": null
},
"cancellation-details": {
"is-forced": false
},
"compartment-id": "ocid1.compartment.oc1..aaaaaaaawrmvqjzoegxbsixp5k3b5554vlv2kxukobw3drjho3f7nf5ca3ya",
"config-source": {
"config-source-record-type": "ZIP_UPLOAD"
},
"defined-tags": {},
"display-name": "ALTER NoSQL Table Schema",
"failure-details": null,
"freeform-tags": {},
"id": "ocid1.ormjob.oc1.phx.aaaaaaaacmnanu2qd34x7l5uicgpdfpjbsgh5swddmtslb3qmbzg3dmuc3bq",
"job-operation-details": {
"execution-plan-job-id": null,
"execution-plan-strategy": "AUTO_APPROVED",
"operation": "APPLY",
"terraform-advanced-options": {
"detailed-log-level": null,
"is-refresh-required": true,
"parallelism": 10
}
},
"lifecycle-state": "SUCCEEDED",
"operation": "APPLY",
"resolved-plan-job-id": null,
"stack-id": "ocid1.ormstack.oc1.phx.aaaaaaaa7jrci2s5iav5tdxpl6ucwo2dwazzrdkfhs6bxiohgcpkscmr57bq",
"time-created": "2022-01-20T11:14:13.916000+00:00",
"time-finished": "2022-01-20T11:14:51.921000+00:00",
"variables": {},
"working-directory": null
},
"etag": "13b1253bd5e6ca78778b4cf6aad38d262b1476aae06e6f36b40b5f914016b899--gzip"
}
{
...
"lifecycle-state": "SUCCEEDED",
...
}
サブステップ4.2: ジョブのログの表示
oci resource-manager job get-job-logs-content
--job-id <job_OCID>
oci resource-manager job get-job-logs-content
--job-id ocid1.ormjob.oc1.phx.aaaaaaaacmnanu2qd34x7l5uicgpdfpjbsgh5swddmtslb3qmbzg3dmuc3bq
...
{
"level": "INFO",
"message": "oci_nosql_table.nosql_demoKeyVal: Refreshing state... [id=ocid1.nosqltable.oc1.phx.amaaaaaau7x7rfyaqgpbjucp3s6jjzpnar4lg5yudxhwlqrlbd54l3wdo7hq]",
"timestamp": "2022-01-20T11:14:26.632000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": "oci_nosql_table.nosql_demo: Refreshing state... [id=ocid1.nosqltable.oc1.phx.amaaaaaau7x7rfyasvdkoclhgryulgzox3nvlxb2bqtlxxsrvrc4zxr6lo4a]",
"timestamp": "2022-01-20T11:14:26.632000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": "plan. Resource actions are indicated with the following symbols:",
"timestamp": "2022-01-20T11:14:26.632000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": " ~ update in-place",
"timestamp": "2022-01-20T11:14:26.632000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": "Terraform will perform the following actions:",
"timestamp": "2022-01-20T11:14:26.632000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": " # data.oci_nosql_table.nosql_demo will be read during apply",
"timestamp": "2022-01-20T11:14:26.632000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": " <= data \"oci_nosql_table\" \"nosql_demo\" {",
"timestamp": "2022-01-20T11:14:26.632000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": " + compartment_id = \"ocid1.compartment.oc1..aaaaaaaawrmvqjzoegxbsixp5k3b5554vlv2kxukobw3drjho3f7nf5ca3ya\"",
"timestamp": "2022-01-20T11:14:26.632000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": " + table_name_or_id = \"ocid1.nosqltable.oc1.phx.amaaaaaau7x7rfyasvdkoclhgryulgzox3nvlxb2bqtlxxsrvrc4zxr6lo4a\"",
"timestamp": "2022-01-20T11:14:26.632000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": " <= data \"oci_nosql_table\" \"nosql_demoKeyVal\" {",
"timestamp": "2022-01-20T11:14:26.632000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": " + compartment_id = \"ocid1.compartment.oc1..aaaaaaaawrmvqjzoegxbsixp5k3b5554vlv2kxukobw3drjho3f7nf5ca3ya\"",
"timestamp": "2022-01-20T11:14:26.632000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": " + table_name_or_id = \"ocid1.nosqltable.oc1.phx.amaaaaaau7x7rfyaqgpbjucp3s6jjzpnar4lg5yudxhwlqrlbd54l3wdo7hq\"",
"timestamp": "2022-01-20T11:14:26.632000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": " # oci_nosql_table.nosql_demo will be updated in-place",
"timestamp": "2022-01-20T11:14:26.632000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": " ~ resource \"oci_nosql_table\" \"nosql_demo\" {",
"timestamp": "2022-01-20T11:14:26.632000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": " ~ ddl_statement = \"CREATE TABLE IF NOT EXISTS demo(ticketNo INTEGER, contactPhone STRING, confNo STRING, gender STRING, bagInfo JSON, fullName STRING, PRIMARY KEY(SHARD(ticketNo)))\" -> \"ALTER TABLE demo (DROP fullName)\"",
"timestamp": "2022-01-20T11:14:26.632000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": " id = \"ocid1.nosqltable.oc1.phx.amaaaaaau7x7rfyasvdkoclhgryulgzox3nvlxb2bqtlxxsrvrc4zxr6lo4a\"",
"timestamp": "2022-01-20T11:14:26.632000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": " name = \"demo\"",
"timestamp": "2022-01-20T11:14:26.632000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": " # oci_nosql_table.nosql_demoKeyVal will be updated in-place",
"timestamp": "2022-01-20T11:14:26.632000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": " ~ resource \"oci_nosql_table\" \"nosql_demoKeyVal\" {",
"timestamp": "2022-01-20T11:14:26.632000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": " ~ ddl_statement = \"CREATE TABLE if not exists demoKeyVal (key INTEGER GENERATED ALWAYS AS IDENTITY (START WITH 1 INCREMENT BY 1 NO CYCLE), value JSON, PRIMARY KEY (key))\" -> \"ALTER TABLE demoKeyVal (ADD shortName STRING)\"",
"timestamp": "2022-01-20T11:14:26.633000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": " id = \"ocid1.nosqltable.oc1.phx.amaaaaaau7x7rfyaqgpbjucp3s6jjzpnar4lg5yudxhwlqrlbd54l3wdo7hq\"",
"timestamp": "2022-01-20T11:14:26.633000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": " name = \"demoKeyVal\"",
"timestamp": "2022-01-20T11:14:26.633000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": "Plan: 0 to add, 2 to change, 0 to destroy.",
"timestamp": "2022-01-20T11:14:26.633000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": "oci_nosql_table.nosql_demoKeyVal: Modifying... [id=ocid1.nosqltable.oc1.phx.amaaaaaau7x7rfyaqgpbjucp3s6jjzpnar4lg5yudxhwlqrlbd54l3wdo7hq]",
"timestamp": "2022-01-20T11:14:27.633000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": "oci_nosql_table.nosql_demo: Modifying... [id=ocid1.nosqltable.oc1.phx.amaaaaaau7x7rfyasvdkoclhgryulgzox3nvlxb2bqtlxxsrvrc4zxr6lo4a]",
"timestamp": "2022-01-20T11:14:27.633000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": "oci_nosql_table.nosql_demo: Modifications complete after 9s [id=ocid1.nosqltable.oc1.phx.amaaaaaau7x7rfyasvdkoclhgryulgzox3nvlxb2bqtlxxsrvrc4zxr6lo4a]",
"timestamp": "2022-01-20T11:14:35.634000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": "data.oci_nosql_table.nosql_demo: Reading...",
"timestamp": "2022-01-20T11:14:35.634000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": "data.oci_nosql_table.nosql_demo: Read complete after 0s [id=ocid1.nosqltable.oc1.phx.amaaaaaau7x7rfyasvdkoclhgryulgzox3nvlxb2bqtlxxsrvrc4zxr6lo4a]",
"timestamp": "2022-01-20T11:14:35.634000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": "data.oci_nosql_table.nosql_demoKeyVal: Reading...",
"timestamp": "2022-01-20T11:14:44.636000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": "data.oci_nosql_table.nosql_demoKeyVal: Read complete after 0s [id=ocid1.nosqltable.oc1.phx.amaaaaaau7x7rfyaqgpbjucp3s6jjzpnar4lg5yudxhwlqrlbd54l3wdo7hq]",
"timestamp": "2022-01-20T11:14:44.636000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": "Apply complete! Resources: 0 added, 2 changed, 0 destroyed.",
"timestamp": "2022-01-20T11:14:44.636000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": "nosql_kv_table_ddl_statement = \"CREATE TABLE IF NOT EXISTS demoKeyVal(key INTEGER, value JSON, shortName STRING, PRIMARY KEY(SHARD(key)))\"",
"timestamp": "2022-01-20T11:14:44.636000+00:00",
"type": "TERRAFORM_CONSOLE"
},
{
"level": "INFO",
"message": "nosql_table_ddl_statement = \"CREATE TABLE IF NOT EXISTS demo(ticketNo INTEGER, contactPhone STRING, confNo STRING, gender STRING, bagInfo JSON, PRIMARY KEY(SHARD(ticketNo)))\"",
"timestamp": "2022-01-20T11:14:44.636000+00:00",
"type": "TERRAFORM_CONSOLE"
},
...
demo
およびdemoKeyVal
を正常に更新しました。{
...
"message": "Apply complete! Resources: 0 added, 2 changed, 0 destroyed.",
...
}
私たちはこのチュートリアルで多くの詳細をカバーしています。OCIクラウドでNoSQLデータベース表のスキーマを更新するために必要なオーバーライドterraform構成ファイルを作成し、OCI Resource Manager CLIを使用して既存のスタックを更新し、実行計画を生成し、実行計画で適用ジョブを実行しました。