diff --git a/terraform/job.tf b/terraform/job.tf index a20615f..8ff321d 100644 --- a/terraform/job.tf +++ b/terraform/job.tf @@ -8,7 +8,7 @@ resource "google_cloud_run_v2_job" "default" { volumes { name = "a-volume" secret { - secret = google_secret_manager_secret.secret.secret_id + secret = google_secret_manager_secret.name.secret_id default_mode = 292 items { version = "1" @@ -24,7 +24,7 @@ resource "google_cloud_run_v2_job" "default" { mount_path = "/secrets" } env { - name = "PROJECT_ID" + name = "PROJECT_ID" value = var.project_id } } @@ -32,7 +32,7 @@ resource "google_cloud_run_v2_job" "default" { } } -resource "google_secret_manager_secret" "secret" { +resource "google_secret_manager_secret" "name" { secret_id = "name" replication { @@ -41,13 +41,13 @@ resource "google_secret_manager_secret" "secret" { } resource "google_secret_manager_secret_version" "secret-version-data" { - secret = google_secret_manager_secret.secret.name + secret = google_secret_manager_secret.name.name secret_data = "please enter in console" } resource "google_secret_manager_secret_iam_member" "secret-access" { - secret_id = google_secret_manager_secret.secret.id + secret_id = google_secret_manager_secret.name.id role = "roles/secretmanager.secretAccessor" member = "serviceAccount:${var.project_number}-compute@developer.gserviceaccount.com" - depends_on = [google_secret_manager_secret.secret] + depends_on = [google_secret_manager_secret.name] } \ No newline at end of file diff --git a/terraform/terraform.tfstate b/terraform/terraform.tfstate index 1534f9e..5fb6304 100644 --- a/terraform/terraform.tfstate +++ b/terraform/terraform.tfstate @@ -1,7 +1,7 @@ { "version": 4, "terraform_version": "1.2.1", - "serial": 24, + "serial": 35, "lineage": "6438fdd8-2a30-b6e3-ac1c-bf8ab0cf5f7e", "outputs": { "google_service_account": { @@ -62,18 +62,18 @@ "run.googleapis.com/client-version": "419.0.0", "run.googleapis.com/ingress": "all", "run.googleapis.com/ingress-status": "all", - "run.googleapis.com/operation-id": "670786a7-aba5-4a35-9934-61c106552dee", + "run.googleapis.com/operation-id": "82a814e6-b5f4-4fbb-b4b7-52862c9148b8", "serving.knative.dev/creator": "2WuA4nLyi@gmail.com", "serving.knative.dev/lastModifier": "2WuA4nLyi@gmail.com" }, - "generation": 15, + "generation": 17, "labels": { "cloud.googleapis.com/location": "asia-northeast1", - "commit-sha": "699973eecf35a8f7bb09aaf2bf49118af78dabde", + "commit-sha": "5714ac100c301f084bd2ff03a30b1fd2b443efc3", "managed-by": "github-actions" }, "namespace": "cloud-run-playground-373814", - "resource_version": "AAX1YkB3Ewo", + "resource_version": "AAX1YmTnF+M", "self_link": "/apis/serving.knative.dev/v1/namespaces/823327601896/services/cloudrun-srv", "uid": "2732d948-7578-4543-9ec6-c86a2f5433cb" } @@ -102,9 +102,9 @@ "type": "RoutesReady" } ], - "latest_created_revision_name": "cloudrun-srv-d89sk", - "latest_ready_revision_name": "cloudrun-srv-d89sk", - "observed_generation": 15, + "latest_created_revision_name": "cloudrun-srv-w6qpj", + "latest_ready_revision_name": "cloudrun-srv-w6qpj", + "observed_generation": 17, "url": "https://cloudrun-srv-s662dsgmqa-an.a.run.app" } ], @@ -120,7 +120,7 @@ }, "generation": 0, "labels": { - "commit-sha": "699973eecf35a8f7bb09aaf2bf49118af78dabde", + "commit-sha": "5714ac100c301f084bd2ff03a30b1fd2b443efc3", "managed-by": "github-actions" }, "name": "", @@ -330,7 +330,7 @@ "sensitive_attributes": [], "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDAsInVwZGF0ZSI6MTIwMDAwMDAwMDAwMH19", "dependencies": [ - "google_secret_manager_secret.secret" + "google_secret_manager_secret.name" ] } ] @@ -525,16 +525,16 @@ { "mode": "managed", "type": "google_secret_manager_secret", - "name": "secret", + "name": "name", "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", "instances": [ { "schema_version": 0, "attributes": { - "create_time": "2023-02-23T18:33:33.083012Z", + "create_time": "2023-02-23T18:46:12.009347Z", "expire_time": "", "id": "projects/cloud-run-playground-373814/secrets/name", - "labels": {}, + "labels": null, "name": "projects/823327601896/secrets/name", "project": "cloud-run-playground-373814", "replication": [ @@ -564,7 +564,7 @@ "schema_version": 0, "attributes": { "condition": [], - "etag": "BwX1YkATUrU=", + "etag": "BwX1Ym1SPHM=", "id": "projects/cloud-run-playground-373814/secrets/name/roles/secretmanager.secretAccessor/serviceAccount:823327601896-compute@developer.gserviceaccount.com", "member": "serviceAccount:823327601896-compute@developer.gserviceaccount.com", "project": "cloud-run-playground-373814", @@ -574,7 +574,7 @@ "sensitive_attributes": [], "private": "bnVsbA==", "dependencies": [ - "google_secret_manager_secret.secret" + "google_secret_manager_secret.name" ] } ] @@ -588,7 +588,7 @@ { "schema_version": 0, "attributes": { - "create_time": "2023-02-23T18:35:28.108410Z", + "create_time": "2023-02-23T18:46:14.204321Z", "destroy_time": "", "enabled": true, "id": "projects/823327601896/secrets/name/versions/1", @@ -601,7 +601,7 @@ "sensitive_attributes": [], "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDB9fQ==", "dependencies": [ - "google_secret_manager_secret.secret" + "google_secret_manager_secret.name" ] } ] diff --git a/terraform/terraform.tfstate.backup b/terraform/terraform.tfstate.backup index aa7c241..57d984a 100644 --- a/terraform/terraform.tfstate.backup +++ b/terraform/terraform.tfstate.backup @@ -1,7 +1,7 @@ { "version": 4, "terraform_version": "1.2.1", - "serial": 21, + "serial": 30, "lineage": "6438fdd8-2a30-b6e3-ac1c-bf8ab0cf5f7e", "outputs": { "google_service_account": { @@ -62,18 +62,18 @@ "run.googleapis.com/client-version": "419.0.0", "run.googleapis.com/ingress": "all", "run.googleapis.com/ingress-status": "all", - "run.googleapis.com/operation-id": "670786a7-aba5-4a35-9934-61c106552dee", + "run.googleapis.com/operation-id": "82a814e6-b5f4-4fbb-b4b7-52862c9148b8", "serving.knative.dev/creator": "2WuA4nLyi@gmail.com", "serving.knative.dev/lastModifier": "2WuA4nLyi@gmail.com" }, - "generation": 15, + "generation": 17, "labels": { "cloud.googleapis.com/location": "asia-northeast1", - "commit-sha": "699973eecf35a8f7bb09aaf2bf49118af78dabde", + "commit-sha": "5714ac100c301f084bd2ff03a30b1fd2b443efc3", "managed-by": "github-actions" }, "namespace": "cloud-run-playground-373814", - "resource_version": "AAX1YkB3Ewo", + "resource_version": "AAX1YmTnF+M", "self_link": "/apis/serving.knative.dev/v1/namespaces/823327601896/services/cloudrun-srv", "uid": "2732d948-7578-4543-9ec6-c86a2f5433cb" } @@ -102,9 +102,9 @@ "type": "RoutesReady" } ], - "latest_created_revision_name": "cloudrun-srv-d89sk", - "latest_ready_revision_name": "cloudrun-srv-d89sk", - "observed_generation": 15, + "latest_created_revision_name": "cloudrun-srv-w6qpj", + "latest_ready_revision_name": "cloudrun-srv-w6qpj", + "observed_generation": 17, "url": "https://cloudrun-srv-s662dsgmqa-an.a.run.app" } ], @@ -120,7 +120,7 @@ }, "generation": 0, "labels": { - "commit-sha": "699973eecf35a8f7bb09aaf2bf49118af78dabde", + "commit-sha": "5714ac100c301f084bd2ff03a30b1fd2b443efc3", "managed-by": "github-actions" }, "name": "", @@ -330,7 +330,7 @@ "sensitive_attributes": [], "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDAsInVwZGF0ZSI6MTIwMDAwMDAwMDAwMH19", "dependencies": [ - "google_secret_manager_secret.secret" + "google_secret_manager_secret.name" ] } ] @@ -522,63 +522,6 @@ } ] }, - { - "mode": "managed", - "type": "google_secret_manager_secret", - "name": "secret", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "create_time": "2023-02-23T18:33:33.083012Z", - "expire_time": "", - "id": "projects/cloud-run-playground-373814/secrets/name", - "labels": {}, - "name": "projects/823327601896/secrets/name", - "project": "cloud-run-playground-373814", - "replication": [ - { - "automatic": true, - "user_managed": [] - } - ], - "rotation": [], - "secret_id": "name", - "timeouts": null, - "topics": [], - "ttl": null - }, - "sensitive_attributes": [], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDAsInVwZGF0ZSI6MTIwMDAwMDAwMDAwMH19" - } - ] - }, - { - "mode": "managed", - "type": "google_secret_manager_secret_iam_member", - "name": "secret-access", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "condition": [], - "etag": "BwX1YkATUrU=", - "id": "projects/cloud-run-playground-373814/secrets/name/roles/secretmanager.secretAccessor/serviceAccount:823327601896-compute@developer.gserviceaccount.com", - "member": "serviceAccount:823327601896-compute@developer.gserviceaccount.com", - "project": "cloud-run-playground-373814", - "role": "roles/secretmanager.secretAccessor", - "secret_id": "projects/cloud-run-playground-373814/secrets/name" - }, - "sensitive_attributes": [], - "private": "bnVsbA==", - "dependencies": [ - "google_secret_manager_secret.secret" - ] - } - ] - }, { "mode": "managed", "type": "google_service_account",