Skip to content

feat: enable Terraform debug mode via deployment configuration #8260

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 12 commits into from
Jun 29, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Adjust UI
  • Loading branch information
mtojek committed Jun 29, 2023
commit 58e4f7444b8f68f29aad6018b1cc3f2372c5c8e6
6 changes: 3 additions & 3 deletions site/src/components/Workspace/Workspace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export interface WorkspaceProps {
builds?: TypesGen.WorkspaceBuild[]
templateWarnings?: TypesGen.TemplateVersionWarning[]
canUpdateWorkspace: boolean
canUpdateTemplate: boolean
canRetryDebugMode: boolean
canChangeVersions: boolean
hideSSHButton?: boolean
hideVSCodeDesktopButton?: boolean
Expand Down Expand Up @@ -92,7 +92,7 @@ export const Workspace: FC<React.PropsWithChildren<WorkspaceProps>> = ({
resources,
builds,
canUpdateWorkspace,
canUpdateTemplate,
canRetryDebugMode,
canChangeVersions,
workspaceErrors,
hideSSHButton,
Expand Down Expand Up @@ -236,7 +236,7 @@ export const Workspace: FC<React.PropsWithChildren<WorkspaceProps>> = ({
<Alert
severity="error"
actions={
canUpdateTemplate && (
canRetryDebugMode && (
<Button
key={0}
onClick={handleBuildRetry}
Expand Down
3 changes: 2 additions & 1 deletion site/src/pages/WorkspacePage/WorkspaceReadyPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export const WorkspaceReadyPage = ({
const deadline = getDeadline(workspace)
const canUpdateWorkspace = Boolean(permissions?.updateWorkspace)
const canUpdateTemplate = Boolean(permissions?.updateTemplate)
const canViewDeploymentValues = Boolean(permissions?.viewDeploymentValues)
const { t } = useTranslation("workspacePage")
const favicon = getFaviconByStatus(workspace.latest_build)
const navigate = useNavigate()
Expand Down Expand Up @@ -166,7 +167,7 @@ export const WorkspaceReadyPage = ({
resources={workspace.latest_build.resources}
builds={builds}
canUpdateWorkspace={canUpdateWorkspace}
canUpdateTemplate={canUpdateTemplate}
canRetryDebugMode={canViewDeploymentValues}
canChangeVersions={canUpdateTemplate}
hideSSHButton={featureVisibility["browser_only"]}
hideVSCodeDesktopButton={featureVisibility["browser_only"]}
Expand Down
7 changes: 7 additions & 0 deletions site/src/xServices/workspace/workspaceXService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export const checks = {
readWorkspace: "readWorkspace",
updateWorkspace: "updateWorkspace",
updateTemplate: "updateTemplate",
viewDeploymentValues: "viewDeploymentValues",
} as const

const permissionsToCheck = (
Expand Down Expand Up @@ -130,6 +131,12 @@ const permissionsToCheck = (
},
action: "update",
},
[checks.viewDeploymentValues]: {
object: {
resource_type: "deployment_config",
},
action: "read",
},
} as const)

export const workspaceMachine = createMachine(
Expand Down