Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Redis Instance (google_redis_instance, Memorystore) is always destroyed and re-created #1750

Closed
tsadoklevi opened this issue Jul 10, 2018 · 4 comments
Assignees
Labels
bug forward/review In review; remove label to forward service/redis-instance

Comments

@tsadoklevi
Copy link

Terraform Version

Terraform v0.11.7

  • provider.google v1.15.0
  • provider.random v1.3.1

Affected Resource(s)

  • google_redis_instance

Terraform Configuration Files

resource "google_redis_instance" "redis" {
    depends_on          = ["google_compute_network.network"]

    name                = "${var.env_name}-redis"
    display_name        = "${var.env_name}-redis: created by Terraform"

    tier                = "STANDARD_HA"
    memory_size_gb      = 1

    authorized_network  = "${google_compute_network.network.name}"
    # authorized_network  = "${var.network_name}"

    region              = "${var.region}"
    location_id             = "europe-west1-b"
    alternative_location_id = "europe-west1-c"

    redis_version       = "REDIS_3_2"
}

Debug Output

google_redis_instance.redis (new resource required)
      id:                      "XXXXXXX/europe-west1/staging-redis" => <computed> (forces new resource)
      alternative_location_id: "europe-west1-c" => "europe-west1-c"
      authorized_network:      "projects/[PROJECT_NAME]/global/networks/staging" => "staging" (forces new resource)

      create_time:             "2018-07-10T06:53:49.730848Z" => <computed>
      current_location_id:     "europe-west1-b" => <computed>
      display_name:            "staging-redis: created by Terraform" => "staging-redis: created by Terraform"

      host:                    "10.0.0.4" => <computed>
      location_id:             "europe-west1-b" => "europe-west1-b"
      memory_size_gb:          "1" => "1"
      name:                    "staging-redis" => "staging-redis"
      port:                    "6379" => <computed>
      project:                 "XXXXXXXXXX" => <computed>
      redis_version:           "REDIS_3_2" => "REDIS_3_2"
      region:                  "europe-west1" => "europe-west1"
      reserved_ip_range:       "10.0.0.0/29" => <computed>
      tier:                    "STANDARD_HA" => "STANDARD_HA"

Expected Behavior

If redis resource configuration has not been changed, Terraform should not destroy the existing redis instance on GCP (Google Memorystore) and re-create it .

Actual Behavior

Terraform always destroys and re-createe redis instance on GCP.

@Chupaka
Copy link
Contributor

Chupaka commented Jul 10, 2018

Use authorized_network = "${google_compute_network.network.self_link}" instead of authorized_network = "${google_compute_network.network.name}"

@tsadoklevi
Copy link
Author

@Chupaka thank you very much. It works. Would you please explain why? Is it the "recommended" way to refer to resources?

@Chupaka
Copy link
Contributor

Chupaka commented Jul 10, 2018

@tsadoklevi well, at least it will be added to the docs on the next release: https://github.com/terraform-providers/terraform-provider-google/blob/master/website/docs/r/redis_instance.html.markdown :)

Probably your case should be fixed, too. Let's wait for maintainers' comments.

@danawillow danawillow self-assigned this Jul 16, 2018
modular-magician pushed a commit to modular-magician/terraform-provider-google that referenced this issue Jul 16, 2018
@ghost
Copy link

ghost commented Nov 17, 2018

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Nov 17, 2018
@github-actions github-actions bot added forward/review In review; remove label to forward service/redis-instance labels Jan 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug forward/review In review; remove label to forward service/redis-instance
Projects
None yet
Development

No branches or pull requests

4 participants