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

Fix: inconsistent plan on the first apply when trying to create ssh_keys #774

Merged
merged 1 commit into from
Dec 25, 2023

Conversation

TomerHeber
Copy link
Collaborator

Issue & Steps to Reproduce / Feature Request

fixes #772

Solution

Added computed to both fields to avoid race condition.

@@ -18,12 +18,14 @@ func dataSshKey() *schema.Resource {
Type: schema.TypeString,
Description: "the name of the ssh key",
Optional: true,
Computed: true,
Copy link
Collaborator Author

@TomerHeber TomerHeber Dec 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding computed fixes a plan issue.

With computed:

      + path                  = "misc/null-resource"
      + repository            = "https://github.com/tomer-landesman/templates"
      + ssh_keys              = [
          + (known after apply),
        ]
      + terraform_version     = "0.15.1"
      + type                  = "terraform"
    }

Without computed it's missing the id in the first apply

   + repository            = "https://github.com/tomer-landesman/templates"
      + ssh_keys              = [
          + {
              + "name" = "sshkey"
            },
        ]
      + terraform_version     = "0.15.1"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For context data is something like this (with name):

data "env0_ssh_key" "data_ssh_key" {
  count = 1
  name  = "sshkey"

  depends_on = [env0_ssh_key.ssh_key]
}

@github-actions github-actions bot added ready to merge PR approved - can be merged once the PR owner is ready and removed pending final review labels Dec 25, 2023
@TomerHeber TomerHeber merged commit 7ad25a2 into main Dec 25, 2023
9 checks passed
@TomerHeber TomerHeber deleted the fix-inconsistent-pan-#772 branch December 25, 2023 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix provider ready to merge PR approved - can be merged once the PR owner is ready
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsistent plan on the first apply when trying to create ssh_keys
2 participants