Commit 90369e05 authored by Nicolò Maria Mezzopera's avatar Nicolò Maria Mezzopera

Merge branch '334327-terraform-module-usage-instructions-are-incorrect' into 'master'

Resolve "Terraform module usage instructions are incorrect"

See merge request gitlab-org/gitlab!64660
parents d4df549d a94df59c
......@@ -12,16 +12,16 @@ export default {
GlSprintf,
},
computed: {
...mapState(['packageEntity', 'terraformHelpPath', 'projectPath']),
...mapState(['packageEntity', 'terraformHelpPath', 'gitlabHost', 'projectPath']),
provisionInstructions() {
// eslint-disable-next-line @gitlab/require-i18n-strings
return `module "${this.packageEntity.name}" {
source = "${this.projectPath}/${this.packageEntity.name}"
source = "${this.gitlabHost}/${this.projectPath}/${this.packageEntity.name}"
version = "${this.packageEntity.version}"
}`;
},
registrySetup() {
return `credentials "gitlab.com" {
return `credentials "${this.gitlabHost}" {
token = "<TOKEN>"
}`;
},
......
......@@ -10,6 +10,7 @@
can_delete: can?(current_user, :destroy_package, @project).to_s,
svg_path: image_path('illustrations/no-packages.svg'),
project_name: @project.name,
project_path: expose_url(@project.full_path),
project_path: @project.root_ancestor.full_path,
gitlab_host: Gitlab.config.gitlab.host,
terraform_help_path: help_page_path('user/infrastructure/index'),
project_list_url: project_infrastructure_registry_index_path(@project)} }
......@@ -11,7 +11,7 @@ exports[`TerraformInstallation renders all the messages 1`] = `
<code-instruction-stub
copytext="Copy Terraform Command"
instruction="module \\"Test/system-22\\" {
source = \\"foo/Test/system-22\\"
source = \\"bar.dev/foo/Test/system-22\\"
version = \\"0.1\\"
}"
label="Copy and paste into your Terraform configuration, insert the variables, and run Terraform init:"
......@@ -28,7 +28,7 @@ exports[`TerraformInstallation renders all the messages 1`] = `
<code-instruction-stub
copytext="Copy Terraform Setup Command"
instruction="credentials \\"gitlab.com\\" {
instruction="credentials \\"bar.dev\\" {
token = \\"<TOKEN>\\"
}"
label="To authorize access to the Terraform registry:"
......
......@@ -13,6 +13,7 @@ describe('TerraformInstallation', () => {
const store = new Vuex.Store({
state: {
packageEntity,
gitlabHost: 'bar.dev',
projectPath: 'foo',
},
});
......@@ -42,7 +43,7 @@ describe('TerraformInstallation', () => {
it('renders the correct command', () => {
expect(findCodeInstructions().at(0).props('instruction')).toMatchInlineSnapshot(`
"module \\"Test/system-22\\" {
source = \\"foo/Test/system-22\\"
source = \\"bar.dev/foo/Test/system-22\\"
version = \\"0.1\\"
}"
`);
......@@ -52,7 +53,7 @@ describe('TerraformInstallation', () => {
describe('setup commands', () => {
it('renders the correct command', () => {
expect(findCodeInstructions().at(1).props('instruction')).toMatchInlineSnapshot(`
"credentials \\"gitlab.com\\" {
"credentials \\"bar.dev\\" {
token = \\"<TOKEN>\\"
}"
`);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment