Skip to content
This repository has been archived by the owner on Jun 29, 2022. It is now read-only.

lokoctl cluster apply fails using S3 backend #1016

Closed
surajssd opened this issue Sep 25, 2020 · 1 comment · Fixed by #1021
Closed

lokoctl cluster apply fails using S3 backend #1016

surajssd opened this issue Sep 25, 2020 · 1 comment · Fixed by #1021
Assignees
Labels
bug Something isn't working

Comments

@surajssd
Copy link
Member

Other person created a cluster and shared lokocfg file with me. When I run lokoctl cluster apply -v it fails with following error:

...
module.dns.aws_route53_record.apiserver_public: Refreshing state... [id=XXXXXXXXXXXXXX_foobar-demo-foobar.net._A]

Error: Invalid index

  on ../terraform-modules/bootkube/outputs.tf line 95, in output "bootstrap-secrets_values":
  95:   value = var.enable_tls_bootstrap ? local_file.bootstrap-secrets[0].content : ""
    |----------------
    | local_file.bootstrap-secrets is empty tuple

The given key does not identify an element in this collection value.

Releasing state lock. This may take a few moments...
FATA[0042] Failed to reconcile cluster state: failed checking execution status: exit status 1  args="[]" command="lokoctl cluster apply"

The cluster is created with lokoctl version v0.4.1. And I can reproduce the error with 0.4.1 and current master.

@surajssd surajssd added the bug Something isn't working label Sep 25, 2020
@invidian
Copy link
Member

The solution for it is to use locals to save value of local_file.bootstrap-secrets[0].content and to use local in value = instead of local_file reference.

This happens because if you remove assets directory, len(local_file.bootstrap-secrets) will be 0 after Terraform refreshes the state.

@invidian invidian self-assigned this Sep 28, 2020
invidian added a commit that referenced this issue Sep 28, 2020
Currently, if one has TLS bootstrap enabled and remove it's assets
directory, assuming that they use remote Terraform backend, Terraform
won't be able to evalue this output, as after refreshing,
local_file.bootstrap-secrets will be gone, as the file has been removed.

This commit moves content rendering to local variable, so module output
does not depend on local file.

Closes #1016

Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
invidian added a commit that referenced this issue Sep 28, 2020
Currently, if one has TLS bootstrap enabled and remove it's assets
directory, assuming that they use remote Terraform backend, Terraform
won't be able to evalue this output, as after refreshing,
local_file.bootstrap-secrets will be gone, as the file has been removed.

This commit moves content rendering to local variable, so module output
does not depend on local file.

Closes #1016

Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants