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

Fixed issue where name was used instead of namespace in instructions #208

Merged
merged 2 commits into from
Sep 10, 2024
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
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { ReactNode } from "react";
import { Code } from "@/components/Code";
import { Paragraph } from "@/components/Paragraph";
import { SidebarBlock } from "@/components/SidebarBlock";
import { useSuspenseQuery } from "@tanstack/react-query";
import { getProviderDataQuery } from "../query";
import { ReactNode } from "react";
import { useProviderParams } from "../hooks/useProviderParams";
import { getProviderDataQuery } from "../query";

function Block({ children }: { children: ReactNode }) {
return (
Expand All @@ -26,11 +26,15 @@ export function ProviderInstructionSidebarBlock() {

const { data } = useSuspenseQuery(getProviderDataQuery(namespace, provider));

// strip the v from the version to display in the provider instructions
// e.g. v0.1.0 -> 0.1.0
const versionConstraint = version.replace(/^v/, "");

const instruction = `terraform {
required_providers {
${data.addr.namespace} = {
${data.addr.name} = {
source = "${data.addr.namespace}/${data.addr.name}"
version = "${version}"
version = "${versionConstraint}"
}
damianstasik marked this conversation as resolved.
Show resolved Hide resolved
}
}
Expand Down
Loading