Skip to content

fix: Remove reliance of relative_path on subdomains #4390

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

Merged
merged 1 commit into from
Oct 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 7 additions & 15 deletions provisioner/terraform/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,13 @@ type agentAttributes struct {

// A mapping of attributes on the "coder_app" resource.
type agentAppAttributes struct {
AgentID string `mapstructure:"agent_id"`
Name string `mapstructure:"name"`
Icon string `mapstructure:"icon"`
URL string `mapstructure:"url"`
Command string `mapstructure:"command"`
Subdomain bool `mapstructure:"subdomain"`
// RelativePath is deprecated in favor of Subdomain. This value is a pointer
// because we prefer it over Subdomain it was explicitly set.
RelativePath *bool `mapstructure:"relative_path"`
Healthcheck []appHealthcheckAttributes `mapstructure:"healthcheck"`
AgentID string `mapstructure:"agent_id"`
Name string `mapstructure:"name"`
Icon string `mapstructure:"icon"`
URL string `mapstructure:"url"`
Command string `mapstructure:"command"`
Subdomain bool `mapstructure:"subdomain"`
Healthcheck []appHealthcheckAttributes `mapstructure:"healthcheck"`
}

// A mapping of attributes on the "healthcheck" resource.
Expand Down Expand Up @@ -238,12 +235,7 @@ func ConvertResources(module *tfjson.StateModule, rawGraph string) ([]*proto.Res
}
}

// Default attrs.RelativePath to true if unspecified in Terraform.
subdomain := attrs.Subdomain
if attrs.RelativePath != nil {
subdomain = !*attrs.RelativePath
}

for _, agents := range resourceAgents {
for _, agent := range agents {
// Find agents with the matching ID and associate them!
Expand Down