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 { ...@@ -12,16 +12,16 @@ export default {
GlSprintf, GlSprintf,
}, },
computed: { computed: {
...mapState(['packageEntity', 'terraformHelpPath', 'projectPath']), ...mapState(['packageEntity', 'terraformHelpPath', 'gitlabHost', 'projectPath']),
provisionInstructions() { provisionInstructions() {
// eslint-disable-next-line @gitlab/require-i18n-strings // eslint-disable-next-line @gitlab/require-i18n-strings
return `module "${this.packageEntity.name}" { return `module "${this.packageEntity.name}" {
source = "${this.projectPath}/${this.packageEntity.name}" source = "${this.gitlabHost}/${this.projectPath}/${this.packageEntity.name}"
version = "${this.packageEntity.version}" version = "${this.packageEntity.version}"
}`; }`;
}, },
registrySetup() { registrySetup() {
return `credentials "gitlab.com" { return `credentials "${this.gitlabHost}" {
token = "<TOKEN>" token = "<TOKEN>"
}`; }`;
}, },
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
can_delete: can?(current_user, :destroy_package, @project).to_s, can_delete: can?(current_user, :destroy_package, @project).to_s,
svg_path: image_path('illustrations/no-packages.svg'), svg_path: image_path('illustrations/no-packages.svg'),
project_name: @project.name, 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'), terraform_help_path: help_page_path('user/infrastructure/index'),
project_list_url: project_infrastructure_registry_index_path(@project)} } project_list_url: project_infrastructure_registry_index_path(@project)} }
...@@ -11,7 +11,7 @@ exports[`TerraformInstallation renders all the messages 1`] = ` ...@@ -11,7 +11,7 @@ exports[`TerraformInstallation renders all the messages 1`] = `
<code-instruction-stub <code-instruction-stub
copytext="Copy Terraform Command" copytext="Copy Terraform Command"
instruction="module \\"Test/system-22\\" { instruction="module \\"Test/system-22\\" {
source = \\"foo/Test/system-22\\" source = \\"bar.dev/foo/Test/system-22\\"
version = \\"0.1\\" version = \\"0.1\\"
}" }"
label="Copy and paste into your Terraform configuration, insert the variables, and run Terraform init:" 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`] = ` ...@@ -28,7 +28,7 @@ exports[`TerraformInstallation renders all the messages 1`] = `
<code-instruction-stub <code-instruction-stub
copytext="Copy Terraform Setup Command" copytext="Copy Terraform Setup Command"
instruction="credentials \\"gitlab.com\\" { instruction="credentials \\"bar.dev\\" {
token = \\"<TOKEN>\\" token = \\"<TOKEN>\\"
}" }"
label="To authorize access to the Terraform registry:" label="To authorize access to the Terraform registry:"
......
...@@ -13,6 +13,7 @@ describe('TerraformInstallation', () => { ...@@ -13,6 +13,7 @@ describe('TerraformInstallation', () => {
const store = new Vuex.Store({ const store = new Vuex.Store({
state: { state: {
packageEntity, packageEntity,
gitlabHost: 'bar.dev',
projectPath: 'foo', projectPath: 'foo',
}, },
}); });
...@@ -42,7 +43,7 @@ describe('TerraformInstallation', () => { ...@@ -42,7 +43,7 @@ describe('TerraformInstallation', () => {
it('renders the correct command', () => { it('renders the correct command', () => {
expect(findCodeInstructions().at(0).props('instruction')).toMatchInlineSnapshot(` expect(findCodeInstructions().at(0).props('instruction')).toMatchInlineSnapshot(`
"module \\"Test/system-22\\" { "module \\"Test/system-22\\" {
source = \\"foo/Test/system-22\\" source = \\"bar.dev/foo/Test/system-22\\"
version = \\"0.1\\" version = \\"0.1\\"
}" }"
`); `);
...@@ -52,7 +53,7 @@ describe('TerraformInstallation', () => { ...@@ -52,7 +53,7 @@ describe('TerraformInstallation', () => {
describe('setup commands', () => { describe('setup commands', () => {
it('renders the correct command', () => { it('renders the correct command', () => {
expect(findCodeInstructions().at(1).props('instruction')).toMatchInlineSnapshot(` expect(findCodeInstructions().at(1).props('instruction')).toMatchInlineSnapshot(`
"credentials \\"gitlab.com\\" { "credentials \\"bar.dev\\" {
token = \\"<TOKEN>\\" 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