All files / app/assets/javascripts/packages_and_registries/infrastructure_registry/details/components terraform_installation.vue

100% Statements 3/3
100% Branches 0/0
100% Functions 2/2
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67    2x                             3x           3x                                                                                      
<script>
import { GlLink, GlSprintf } from '@gitlab/ui';
// eslint-disable-next-line no-restricted-imports
import { mapState } from 'vuex';
import { s__ } from '~/locale';
import CodeInstruction from '~/vue_shared/components/registry/code_instruction.vue';
 
export default {
  name: 'ConanInstallation',
  components: {
    CodeInstruction,
    GlLink,
    GlSprintf,
  },
  computed: {
    ...mapState(['packageEntity', 'terraformHelpPath', 'gitlabHost', 'projectPath']),
    provisionInstructions() {
      return `module "my_module_name" {
  source = "${this.gitlabHost}/${this.projectPath}/${this.packageEntity.name}"
  version = "${this.packageEntity.version}"
}`;
    },
    registrySetup() {
      return `credentials "${this.gitlabHost}" {
  token = "<TOKEN>"
}`;
    },
  },
  i18n: {
    helpText: s__(
      'InfrastructureRegistry|For more information on the Terraform registry, %{linkStart}see our documentation%{linkEnd}.',
    ),
  },
};
</script>
 
<template>
  <div>
    <h3 class="gl-font-lg">{{ __('Provision instructions') }}</h3>
 
    <code-instruction
      :label="
        s__(
          'InfrastructureRegistry|Copy and paste into your Terraform configuration, insert the variables, and run Terraform init:',
        )
      "
      :instruction="provisionInstructions"
      :copy-text="s__('InfrastructureRegistry|Copy Terraform Command')"
      multiline
    />
 
    <h3 class="gl-font-lg">{{ __('Registry setup') }}</h3>
 
    <code-instruction
      :label="s__('InfrastructureRegistry|To authorize access to the Terraform registry:')"
      :instruction="registrySetup"
      :copy-text="s__('InfrastructureRegistry|Copy Terraform Setup Command')"
      multiline
    />
    <gl-sprintf :message="$options.i18n.helpText">
      <template #link="{ content }">
        <gl-link :href="terraformHelpPath">{{ content }}</gl-link>
      </template>
    </gl-sprintf>
  </div>
</template>