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 tests and don't offer a specific remote backend #48

Merged
merged 9 commits into from
Jan 8, 2021

Conversation

displague
Copy link
Member

@displague displague commented Dec 18, 2020

Fixes #45
Fixes #47

The main.tf file was converted to backends.hcl format (https://www.terraform.io/docs/backends/types/remote.html#using-cli-input) and moved into a BACKEND_FILE secret in GH Actions

Signed-off-by: Marques Johansson <mjohansson@equinix.com>
Signed-off-by: Marques Johansson <mjohansson@equinix.com>
Signed-off-by: Marques Johansson <mjohansson@equinix.com>
@displague
Copy link
Member Author

displague commented Dec 18, 2020

@jmarhee What is the null_resource.controller-openstack dependencies that plan is missing here? Was this renamed or is it perhaps in a file that is not in the repository? I can't find references to that resource in the old tagged revisions either.

I do see a few other null_resource.controller* resources, perhaps this reference should be using one of those?

Signed-off-by: Marques Johansson <mjohansson@equinix.com>
@displague
Copy link
Member Author

displague commented Dec 18, 2020

The terraform plan on this PR is not finishing

We also seem to be missing ExternalNetwork.sh (#37).
Is ExternalNetwork.tf necessary (it still had packet_device in it, maybe it was locally deleted in your last test instead of removed from git)?

I got a little further locally by deleting that file and removing the NovaConsole depends_on = [null_resource.controller-openstack] line. I don't know what I might be missing by doing so.

My provision eventually failed because I didn't create the metal-key file with the expected params. I've created #49 as a way to prevent that in the future.

@jmarhee
Copy link
Contributor

jmarhee commented Dec 18, 2020

The ExternalNetworks.tf was one of the files suffixed with .off, so I didn't catch that a resource it named wasn't present. We can remove this, and reimplement later if necessary.

The resource in NovaConsole should read controller-nova rather than openstack-- this file was also suffixed .off-- updating that resource name should suffice.

Signed-off-by: Marques Johansson <mjohansson@equinix.com>
Signed-off-by: Marques Johansson <mjohansson@equinix.com>
https://www.terraform.io/docs/configuration/dependency-lock.html#lock-file-location

> You should include this file in your version control repository so that you
> can discuss potential changes to your external dependencies via code review,
> just as you would discuss potential changes to your configuration itself.

Signed-off-by: Marques Johansson <mjohansson@equinix.com>
Signed-off-by: Marques Johansson <mjohansson@equinix.com>
@displague
Copy link
Member Author

displague commented Dec 19, 2020

@jmarhee I've included changes to remove those files.

The plan tests are currently failing because this project is not configured with an EM API token for testing. I thought it might pull this from state using the TF_API token, but that is not the case (perhaps because I renamed the variable, or perhaps because variables are not pulled from backends).

We'll need a service token of sorts, a user token from a user account dedicated to this work that we can configure here. This will need to be defined as METAL_AUTH_TOKEN in the secrets.

I do think we'll need to address #49 too, but we can address that in a separate issue once we see that the plan and apply is working (which it does from my local testing of this branch).

Signed-off-by: Marques Johansson <mjohansson@equinix.com>
@displague displague changed the title Remove test files Fix tests and don't offer a specific remote backend Dec 19, 2020
@displague
Copy link
Member Author

If this project can get by with a project token, we could try this: https://github.com/displague/metal-actions-example

It would generate a project id/name/token/ssh key for our testing and destroy it when done.
https://github.com/displague/metal-project-action#output

We could use the same projectName on each build so we don't get excessive build failure devices. Instead we will end up with tests getting stuck until the known projectName is manually deleted. The sweeper could run first (if it is taught how to delete projects by name rather than id alone).

@displague
Copy link
Member Author

displague commented Dec 19, 2020

I've opened another ticket to track the need for adding secrets: #50.

If you are comfortable with this PR, @jmarhee, maybe we merge this now (it gets TF planning and applying again) and we'll address the test secrets next.

@jmarhee
Copy link
Contributor

jmarhee commented Dec 21, 2020

Looks good. I think we can proceed.

@displague displague merged commit 0727906 into master Jan 8, 2021
@displague displague deleted the remove-test-files branch May 15, 2023 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove testing files from the project Rename the project (terraform-packet-openstack)
2 participants