Skip to content

Commit

Permalink
rename secret name
Browse files Browse the repository at this point in the history
  • Loading branch information
Doarakko committed Feb 23, 2023
1 parent 5714ac1 commit a8d759c
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 90 deletions.
12 changes: 6 additions & 6 deletions terraform/job.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -24,15 +24,15 @@ resource "google_cloud_run_v2_job" "default" {
mount_path = "/secrets"
}
env {
name = "PROJECT_ID"
name = "PROJECT_ID"
value = var.project_id
}
}
}
}
}

resource "google_secret_manager_secret" "secret" {
resource "google_secret_manager_secret" "name" {
secret_id = "name"

replication {
Expand All @@ -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]
}
34 changes: 17 additions & 17 deletions terraform/terraform.tfstate
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down Expand Up @@ -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"
}
Expand Down Expand Up @@ -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"
}
],
Expand All @@ -120,7 +120,7 @@
},
"generation": 0,
"labels": {
"commit-sha": "699973eecf35a8f7bb09aaf2bf49118af78dabde",
"commit-sha": "5714ac100c301f084bd2ff03a30b1fd2b443efc3",
"managed-by": "github-actions"
},
"name": "",
Expand Down Expand Up @@ -330,7 +330,7 @@
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDAsInVwZGF0ZSI6MTIwMDAwMDAwMDAwMH19",
"dependencies": [
"google_secret_manager_secret.secret"
"google_secret_manager_secret.name"
]
}
]
Expand Down Expand Up @@ -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": [
Expand Down Expand Up @@ -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",
Expand All @@ -574,7 +574,7 @@
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"google_secret_manager_secret.secret"
"google_secret_manager_secret.name"
]
}
]
Expand All @@ -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",
Expand All @@ -601,7 +601,7 @@
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDB9fQ==",
"dependencies": [
"google_secret_manager_secret.secret"
"google_secret_manager_secret.name"
]
}
]
Expand Down
77 changes: 10 additions & 67 deletions terraform/terraform.tfstate.backup
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down Expand Up @@ -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"
}
Expand Down Expand Up @@ -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"
}
],
Expand All @@ -120,7 +120,7 @@
},
"generation": 0,
"labels": {
"commit-sha": "699973eecf35a8f7bb09aaf2bf49118af78dabde",
"commit-sha": "5714ac100c301f084bd2ff03a30b1fd2b443efc3",
"managed-by": "github-actions"
},
"name": "",
Expand Down Expand Up @@ -330,7 +330,7 @@
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDAsInVwZGF0ZSI6MTIwMDAwMDAwMDAwMH19",
"dependencies": [
"google_secret_manager_secret.secret"
"google_secret_manager_secret.name"
]
}
]
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit a8d759c

Please sign in to comment.