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 (proposed): set the default tfenv to linux for EC2 instances, local dev, etc. #882

Closed
wants to merge 2 commits into from

Conversation

kuannie1
Copy link
Contributor

@kuannie1 kuannie1 commented Jun 13, 2023

I'm not sure if this is the smartest change, but I think it could be a first step. For a lot of us with M1 macs, we run into incompatibilities where our tfenv architecuture is set to darwin_arm64 instead of the linux one. Most of our EC2 Instances run in amd though--we don't want to change the default to the newest Macbook default.

For example, I'd get this error a lot when I run terraform locally:

╷
│ Error: Incompatible provider version
│ 
│ Provider registry.terraform.io/hashicorp/template v2.2.0 does not have a
│ package available for your current platform, darwin_arm64.
│ 
│ Provider releases are separate from Terraform CLI releases, so not all
│ providers are available for all platforms. Other versions of this provider
│ may have different platforms supported.
╵

I couldn't get rid of it until I modified the conditions of the tf_env install--I didn't care about getting the M1 Macbook version so I looked into ways to convince tf_env I'm using linux_amd64 architecture.

This change exports and sets a TFENV architecture to Linux by default--I have not tested whether we can override it back to arm64 or not.

@kuannie1 kuannie1 requested a review from a team as a code owner June 13, 2023 23:15
@kuannie1 kuannie1 requested a review from jakeyheath June 13, 2023 23:15
@kuannie1 kuannie1 marked this pull request as draft June 13, 2023 23:18
@jakeyheath
Copy link
Contributor

jakeyheath commented Jun 14, 2023

I think the real problem here is that some of our old modules utilized registry.terraform.io/hashicorp/template. I actually fixed it so that the module is updated, but some workspaces still reference the old one. Their state's need to be refreshed with the latest module before that disappears entirely. Here's the PR that I used to fix it:

https://github.com/chanzuckerberg/shared-infra/pull/7716

This PR removes the deprecated provider that doesn't support M1 macs. If we are using providers that old, we should rotate them out.

@jakeyheath
Copy link
Contributor

I'm confused about the comment about EC2 instances. Why would that matter in this case?

@kuannie1
Copy link
Contributor Author

kuannie1 commented Jun 14, 2023

Hi @jakeyheath! Now I think about it, I'll close the PR because you're right about how we shouldn't be using old providers. I thought we'd use old providers for a while.
I made this change because linux is still the default and the error has been driving me crazy.

@kuannie1 kuannie1 closed this Jun 14, 2023
@kuannie1
Copy link
Contributor Author

kuannie1 commented Jun 14, 2023

I did notice that pulling the latest version of that module (even with the main branch) still returned the same error--I'm not sure if swapping out the underlying template provider with the newest one is enough.
I'll be setting TFENV_ARCH manually for now until there's time to look into the root cause of the error.

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.

None yet

2 participants