Skip to content

Commit 4ba4e62

Browse files
committed
changed order trying to avoid ssh error
1 parent 5e1fd54 commit 4ba4e62

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

Diff for: config-repo.tf

+7-13
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ resource "null_resource" "create_config_repo" {
112112

113113
# copy ssh-config
114114
provisioner "local-exec" {
115-
command = "cp ssh_config ~/.ssh/config"
115+
command = "mv ssh_config ~/.ssh/config"
116116
on_failure = fail
117117
working_dir = "${path.module}"
118118
}
@@ -124,13 +124,7 @@ resource "null_resource" "create_config_repo" {
124124

125125
# copy private key
126126
provisioner "local-exec" {
127-
command = "cp api-private-key.pem ~/.ssh/api-private-key.pem"
128-
on_failure = fail
129-
working_dir = "${path.module}"
130-
}
131-
132-
provisioner "local-exec" {
133-
command = "less ~/.ssh/api-private-key.pem"
127+
command = "mv api-private-key.pem ~/.ssh/api-private-key.pem"
134128
on_failure = fail
135129
working_dir = "${path.module}"
136130
}
@@ -143,21 +137,21 @@ resource "null_resource" "create_config_repo" {
143137

144138
# clone new repository
145139
provisioner "local-exec" {
146-
command = "git -c core.sshCommand='ssh -o StrictHostKeyChecking=no' clone ${oci_devops_repository.config_repo[0].ssh_url}"
140+
command = "git config --global user.email \"${local.login}\""
147141
on_failure = fail
148142
working_dir = "${path.module}"
149143
}
150144

151145
# clone new repository
152146
provisioner "local-exec" {
153-
command = "git config --global user.email \"${local.login}\""
147+
command = "git config --global user.name \"${local.service-username}\""
154148
on_failure = fail
155149
working_dir = "${path.module}"
156150
}
157-
158-
# clone new repository
151+
152+
# clone new repository
159153
provisioner "local-exec" {
160-
command = "git config --global user.name \"${local.service-username}\""
154+
command = "git -c core.sshCommand='ssh -o StrictHostKeyChecking=no' clone ${oci_devops_repository.config_repo[0].ssh_url}"
161155
on_failure = fail
162156
working_dir = "${path.module}"
163157
}

0 commit comments

Comments
 (0)