Skip to content

Commit b94b7ea

Browse files
authored
fix(provider): coalesce arch to armv7 if on 32-bit arm (#210)
This PR modifies the `coder_provisioner` datasource to return `arch` as `armv7` if `GOARCH=arm`. This fixes an issue where users on 32-bit arm platforms would be unable to create a template with ``` resource "coder_agent" "main" { arch = data.coder_provisioner.me.arch ... } ``` and would instead need to manually specify ``` resource "coder_agent" "main" { arch = "armv7" ... } ```
1 parent f3a205c commit b94b7ea

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

docs/resources/agent_instance.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
page_title: "coder_agent_instance Resource - terraform-provider-coder"
44
subcategory: ""
55
description: |-
6-
Use this resource to associate an instance ID with an agent for zero-trust authentication. This association is done automatically for "googlecomputeinstance", "awsinstance", "azurermlinuxvirtualmachine", and "azurermwindowsvirtual_machine" resources.
6+
Use this resource to associate an instance ID with an agent for zero-trust authentication. This association is done automatically for "google_compute_instance", "aws_instance", "azurerm_linux_virtual_machine", and "azurerm_windows_virtual_machine" resources.
77
---
88

99
# coder_agent_instance (Resource)

provider/provisioner.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ func provisionerDataSource() *schema.Resource {
1616
rd.SetId(uuid.NewString())
1717
rd.Set("os", runtime.GOOS)
1818
rd.Set("arch", runtime.GOARCH)
19+
// Fix for #11782: if we're on 32-bit ARM, set arch to armv7.
20+
if runtime.GOARCH == "arm" {
21+
rd.Set("arch", "armv7")
22+
}
1923

2024
return nil
2125
},

provider/provisioner_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,14 @@ func TestProvisioner(t *testing.T) {
3131

3232
attribs := resource.Primary.Attributes
3333
require.Equal(t, runtime.GOOS, attribs["os"])
34-
require.Equal(t, runtime.GOARCH, attribs["arch"])
34+
if runtime.GOARCH == "arm" {
35+
require.Equal(t, "armv7", attribs["arch"])
36+
} else {
37+
require.Equal(t, runtime.GOARCH, attribs["arch"])
38+
}
3539
return nil
3640
},
3741
}},
3842
})
3943
}
44+

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy