Skip to content

Commit 62e8c23

Browse files
feat: make sed and find commands portable between Linux (GNU) and Mac OS (BSD) (#1043)
Co-authored-by: Daniel Andrade <[email protected]>
1 parent 06084be commit 62e8c23

File tree

22 files changed

+81
-78
lines changed

22 files changed

+81
-78
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,6 @@ helpers/foundation-deployer/.steps.json
7474

7575
# File to populate env vars used by Docker test runs
7676
.envrc
77+
78+
# Handle files generated on sed command by old (2013-) MacOS versions
79+
*.tf-e

0-bootstrap/README-GitHub.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,8 @@ export the GitHub fine grained access token as an environment variable:
212212
cp backend.tf.example backend.tf
213213
cd ../../../
214214

215-
for i in `find -name 'backend.tf'`; do sed -i "s/UPDATE_ME/${backend_bucket}/" $i; done
216-
for i in `find -name 'backend.tf'`; do sed -i "s/UPDATE_PROJECTS_BACKEND/${backend_bucket}/" $i; done
215+
for i in `find . -name 'backend.tf'`; do sed -i'' -e "s/UPDATE_ME/${backend_bucket}/" $i; done
216+
for i in `find . -name 'backend.tf'`; do sed -i'' -e "s/UPDATE_PROJECTS_BACKEND/${backend_bucket}/" $i; done
217217

218218
cd gcp-bootstrap/envs/shared
219219
```
@@ -307,7 +307,7 @@ See the shared folder [README.md](../1-org/envs/shared/README.md#inputs) for add
307307

308308
echo "access_context_manager_policy_id = ${ACCESS_CONTEXT_MANAGER_ID}"
309309

310-
if [ ! -z "${ACCESS_CONTEXT_MANAGER_ID}" ]; then sed -i "s=//create_access_context_manager_access_policy=create_access_context_manager_access_policy=" ./envs/shared/terraform.tfvars; fi
310+
if [ ! -z "${ACCESS_CONTEXT_MANAGER_ID}" ]; then sed -i'' -e "s=//create_access_context_manager_access_policy=create_access_context_manager_access_policy=" ./envs/shared/terraform.tfvars; fi
311311
```
312312

313313
1. Update the `remote_state_bucket` variable with the backend bucket from step Bootstrap.
@@ -317,7 +317,7 @@ See the shared folder [README.md](../1-org/envs/shared/README.md#inputs) for add
317317
318318
echo "remote_state_bucket = ${backend_bucket}"
319319
320-
sed -i "s/REMOTE_STATE_BUCKET/${backend_bucket}/" ./envs/shared/terraform.tfvars
320+
sed -i'' -e "s/REMOTE_STATE_BUCKET/${backend_bucket}/" ./envs/shared/terraform.tfvars
321321
```
322322

323323
1. Check if a Security Command Center Notification with the default name, **scc-notify**, already exists in your organization.
@@ -427,7 +427,7 @@ See any of the envs folder [README.md](../2-environments/envs/production/README.
427427
export backend_bucket=$(terraform -chdir="../gcp-bootstrap/envs/shared" output -raw gcs_bucket_tfstate)
428428
echo "remote_state_bucket = ${backend_bucket}"
429429
430-
sed -i "s/REMOTE_STATE_BUCKET/${backend_bucket}/" terraform.tfvars
430+
sed -i'' -e "s/REMOTE_STATE_BUCKET/${backend_bucket}/" terraform.tfvars
431431
```
432432

433433
1. Commit changes.
@@ -536,7 +536,7 @@ or go to [Deploying step 3-networks-hub-and-spoke](#deploying-step-3-networks-hu
536536
537537
echo "access_context_manager_policy_id = ${ACCESS_CONTEXT_MANAGER_ID}"
538538
539-
sed -i "s/ACCESS_CONTEXT_MANAGER_ID/${ACCESS_CONTEXT_MANAGER_ID}/" ./access_context.auto.tfvars
539+
sed -i'' -e "s/ACCESS_CONTEXT_MANAGER_ID/${ACCESS_CONTEXT_MANAGER_ID}/" ./access_context.auto.tfvars
540540
```
541541
542542
1. Update `common.auto.tfvars` file with values from your GCP environment.
@@ -549,7 +549,7 @@ See any of the envs folder [README.md](../3-networks-dual-svpc/envs/production/R
549549
550550
echo "remote_state_bucket = ${backend_bucket}"
551551
552-
sed -i "s/REMOTE_STATE_BUCKET/${backend_bucket}/" ./common.auto.tfvars
552+
sed -i'' -e "s/REMOTE_STATE_BUCKET/${backend_bucket}/" ./common.auto.tfvars
553553
```
554554
555555
1. Commit changes
@@ -699,7 +699,7 @@ See any of the envs folder [README.md](../3-networks-hub-and-spoke/envs/producti
699699
700700
echo "remote_state_bucket = ${backend_bucket}"
701701
702-
sed -i "s/REMOTE_STATE_BUCKET/${backend_bucket}/" ./common.auto.tfvars
702+
sed -i'' -e "s/REMOTE_STATE_BUCKET/${backend_bucket}/" ./common.auto.tfvars
703703
```
704704
705705
1. Commit changes
@@ -852,7 +852,7 @@ An environment variable `GOOGLE_IMPERSONATE_SERVICE_ACCOUNT` will be set with th
852852
export remote_state_bucket=$(terraform -chdir="../gcp-bootstrap/envs/shared/" output -raw gcs_bucket_tfstate)
853853
echo "remote_state_bucket = ${remote_state_bucket}"
854854
855-
sed -i "s/REMOTE_STATE_BUCKET/${remote_state_bucket}/" ./common.auto.tfvars
855+
sed -i'' -e "s/REMOTE_STATE_BUCKET/${remote_state_bucket}/" ./common.auto.tfvars
856856
```
857857
858858
1. Commit changes.

0-bootstrap/README-Jenkins.md

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ You arrived to these instructions because you are using the `jenkins_bootstrap`
227227

228228
```bash
229229
mv backend.tf.example backend.tf
230-
for i in `find -name 'backend.tf'`; do sed -i "s/UPDATE_ME/${backend_bucket}/" $i; done
230+
for i in `find . -name 'backend.tf'`; do sed -i'' -e "s/UPDATE_ME/${backend_bucket}/" $i; done
231231
```
232232

233233
1. Re-run `terraform init` and agree to copy state to gcs when prompted
@@ -333,15 +333,15 @@ Here you will configure a VPN Network tunnel to enable connectivity between the
333333
```bash
334334
BACKEND_STATE_BUCKET_NAME=$(terraform -chdir="../0-bootstrap/" output -raw gcs_bucket_tfstate)
335335
echo "_STATE_BUCKET_NAME = ${BACKEND_STATE_BUCKET_NAME}"
336-
sed -i "s/BACKEND_STATE_BUCKET_NAME/${BACKEND_STATE_BUCKET_NAME}/" ./Jenkinsfile
336+
sed -i'' -e "s/BACKEND_STATE_BUCKET_NAME/${BACKEND_STATE_BUCKET_NAME}/" ./Jenkinsfile
337337

338338
TERRAFORM_SA_EMAIL=$(terraform -chdir="../0-bootstrap/" output -raw organization_step_terraform_service_account_email)
339339
echo "_TF_SA_EMAIL = ${TERRAFORM_SA_EMAIL}"
340-
sed -i "s/TERRAFORM_SA_EMAIL/${TERRAFORM_SA_EMAIL}/" ./Jenkinsfile
340+
sed -i'' -e "s/TERRAFORM_SA_EMAIL/${TERRAFORM_SA_EMAIL}/" ./Jenkinsfile
341341

342342
CICD_PROJECT_ID=$(terraform -chdir="../0-bootstrap/" output -raw cicd_project_id)
343343
echo "_PROJECT_ID = ${CICD_PROJECT_ID}"
344-
sed -i "s/CICD_PROJECT_ID/${CICD_PROJECT_ID}/" ./Jenkinsfile
344+
sed -i'' -e "s/CICD_PROJECT_ID/${CICD_PROJECT_ID}/" ./Jenkinsfile
345345
```
346346

347347
1. Rename `./envs/shared/terraform.example.tfvars` to `./envs/shared/terraform.tfvars`
@@ -370,9 +370,9 @@ Here you will configure a VPN Network tunnel to enable connectivity between the
370370
export backend_bucket=$(terraform -chdir="../0-bootstrap/" output -raw gcs_bucket_tfstate)
371371
echo "remote_state_bucket = ${backend_bucket}"
372372

373-
sed -i "s/REMOTE_STATE_BUCKET/${backend_bucket}/" ./envs/shared/terraform.tfvars
373+
sed -i'' -e "s/REMOTE_STATE_BUCKET/${backend_bucket}/" ./envs/shared/terraform.tfvars
374374

375-
if [ ! -z "${ACCESS_CONTEXT_MANAGER_ID}" ]; then sed -i "s=//create_access_context_manager_access_policy=create_access_context_manager_access_policy=" ./envs/shared/terraform.tfvars; fi
375+
if [ ! -z "${ACCESS_CONTEXT_MANAGER_ID}" ]; then sed -i'' -e "s=//create_access_context_manager_access_policy=create_access_context_manager_access_policy=" ./envs/shared/terraform.tfvars; fi
376376
```
377377

378378
1. Commit changes.
@@ -439,15 +439,15 @@ Here you will configure a VPN Network tunnel to enable connectivity between the
439439
```bash
440440
BACKEND_STATE_BUCKET_NAME=$(terraform -chdir="../0-bootstrap/" output -raw gcs_bucket_tfstate)
441441
echo "_STATE_BUCKET_NAME = ${BACKEND_STATE_BUCKET_NAME}"
442-
sed -i "s/BACKEND_STATE_BUCKET_NAME/${BACKEND_STATE_BUCKET_NAME}/" ./Jenkinsfile
442+
sed -i'' -e "s/BACKEND_STATE_BUCKET_NAME/${BACKEND_STATE_BUCKET_NAME}/" ./Jenkinsfile
443443

444444
TERRAFORM_SA_EMAIL=$(terraform -chdir="../0-bootstrap/" output -raw environment_step_terraform_service_account_email)
445445
echo "_TF_SA_EMAIL = ${TERRAFORM_SA_EMAIL}"
446-
sed -i "s/TERRAFORM_SA_EMAIL/${TERRAFORM_SA_EMAIL}/" ./Jenkinsfile
446+
sed -i'' -e "s/TERRAFORM_SA_EMAIL/${TERRAFORM_SA_EMAIL}/" ./Jenkinsfile
447447

448448
CICD_PROJECT_ID=$(terraform -chdir="../0-bootstrap/" output -raw cicd_project_id)
449449
echo "_PROJECT_ID = ${CICD_PROJECT_ID}"
450-
sed -i "s/CICD_PROJECT_ID/${CICD_PROJECT_ID}/" ./Jenkinsfile
450+
sed -i'' -e "s/CICD_PROJECT_ID/${CICD_PROJECT_ID}/" ./Jenkinsfile
451451
```
452452

453453
1. Rename `terraform.example.tfvars` to `terraform.tfvars` and update the file with values from your environment and 0-bootstrap.
@@ -461,7 +461,7 @@ Here you will configure a VPN Network tunnel to enable connectivity between the
461461
```bash
462462
export backend_bucket=$(terraform -chdir="../0-bootstrap/" output -raw gcs_bucket_tfstate)
463463
echo "remote_state_bucket = ${backend_bucket}"
464-
sed -i "s/REMOTE_STATE_BUCKET/${backend_bucket}/" ./terraform.tfvars
464+
sed -i'' -e "s/REMOTE_STATE_BUCKET/${backend_bucket}/" ./terraform.tfvars
465465
```
466466

467467
1. Commit changes.
@@ -545,15 +545,15 @@ Here you will configure a VPN Network tunnel to enable connectivity between the
545545
```bash
546546
BACKEND_STATE_BUCKET_NAME=$(terraform -chdir="../0-bootstrap/" output -raw gcs_bucket_tfstate)
547547
echo "_STATE_BUCKET_NAME = ${BACKEND_STATE_BUCKET_NAME}"
548-
sed -i "s/BACKEND_STATE_BUCKET_NAME/${BACKEND_STATE_BUCKET_NAME}/" ./Jenkinsfile
548+
sed -i'' -e "s/BACKEND_STATE_BUCKET_NAME/${BACKEND_STATE_BUCKET_NAME}/" ./Jenkinsfile
549549

550550
TERRAFORM_SA_EMAIL=$(terraform -chdir="../0-bootstrap/" output -raw networks_step_terraform_service_account_email)
551551
echo "_TF_SA_EMAIL = ${TERRAFORM_SA_EMAIL}"
552-
sed -i "s/TERRAFORM_SA_EMAIL/${TERRAFORM_SA_EMAIL}/" ./Jenkinsfile
552+
sed -i'' -e "s/TERRAFORM_SA_EMAIL/${TERRAFORM_SA_EMAIL}/" ./Jenkinsfile
553553

554554
CICD_PROJECT_ID=$(terraform -chdir="../0-bootstrap/" output -raw cicd_project_id)
555555
echo "_PROJECT_ID = ${CICD_PROJECT_ID}"
556-
sed -i "s/CICD_PROJECT_ID/${CICD_PROJECT_ID}/" ./Jenkinsfile
556+
sed -i'' -e "s/CICD_PROJECT_ID/${CICD_PROJECT_ID}/" ./Jenkinsfile
557557
```
558558

559559
1. Rename `common.auto.example.tfvars` to `common.auto.tfvars`, rename `shared.auto.example.tfvars` to `shared.auto.tfvars` and rename `access_context.auto.example.tfvars` to `access_context.auto.tfvars`.
@@ -573,11 +573,11 @@ Here you will configure a VPN Network tunnel to enable connectivity between the
573573
export ORGANIZATION_ID=$(terraform -chdir="../0-bootstrap/" output -json common_config | jq '.org_id' --raw-output)
574574
export ACCESS_CONTEXT_MANAGER_ID=$(gcloud access-context-manager policies list --organization ${ORGANIZATION_ID} --format="value(name)")
575575
echo "access_context_manager_policy_id = ${ACCESS_CONTEXT_MANAGER_ID}"
576-
sed -i "s/ACCESS_CONTEXT_MANAGER_ID/${ACCESS_CONTEXT_MANAGER_ID}/" ./access_context.auto.tfvars
576+
sed -i'' -e "s/ACCESS_CONTEXT_MANAGER_ID/${ACCESS_CONTEXT_MANAGER_ID}/" ./access_context.auto.tfvars
577577

578578
export backend_bucket=$(terraform -chdir="../0-bootstrap/" output -raw gcs_bucket_tfstate)
579579
echo "remote_state_bucket = ${backend_bucket}"
580-
sed -i "s/REMOTE_STATE_BUCKET/${backend_bucket}/" ./common.auto.tfvars
580+
sed -i'' -e "s/REMOTE_STATE_BUCKET/${backend_bucket}/" ./common.auto.tfvars
581581
```
582582

583583
1. Commit changes.
@@ -592,7 +592,7 @@ Here you will configure a VPN Network tunnel to enable connectivity between the
592592
1. Also update `backend.tf` with your backend bucket from 0-bootstrap output.
593593

594594
```bash
595-
for i in `find -name 'backend.tf'`; do sed -i "s/UPDATE_ME/${backend_bucket}/" $i; done
595+
for i in `find . -name 'backend.tf'`; do sed -i'' -e "s/UPDATE_ME/${backend_bucket}/" $i; done
596596
```
597597

598598
1. Use `terraform output` to get the Cloud Build project ID and the networks step Terraform Service Account from 0-bootstrap output. An environment variable `GOOGLE_IMPERSONATE_SERVICE_ACCOUNT` will be set using the Terraform Service Account to enable impersonation.
@@ -698,15 +698,15 @@ Here you will configure a VPN Network tunnel to enable connectivity between the
698698
```bash
699699
BACKEND_STATE_BUCKET_NAME=$(terraform -chdir="../0-bootstrap/" output -raw gcs_bucket_tfstate)
700700
echo "_STATE_BUCKET_NAME = ${BACKEND_STATE_BUCKET_NAME}"
701-
sed -i "s/BACKEND_STATE_BUCKET_NAME/${BACKEND_STATE_BUCKET_NAME}/" ./Jenkinsfile
701+
sed -i'' -e "s/BACKEND_STATE_BUCKET_NAME/${BACKEND_STATE_BUCKET_NAME}/" ./Jenkinsfile
702702

703703
TERRAFORM_SA_EMAIL=$(terraform -chdir="../0-bootstrap/" output -raw networks_step_terraform_service_account_email)
704704
echo "_TF_SA_EMAIL = ${TERRAFORM_SA_EMAIL}"
705-
sed -i "s/TERRAFORM_SA_EMAIL/${TERRAFORM_SA_EMAIL}/" ./Jenkinsfile
705+
sed -i'' -e "s/TERRAFORM_SA_EMAIL/${TERRAFORM_SA_EMAIL}/" ./Jenkinsfile
706706

707707
CICD_PROJECT_ID=$(terraform -chdir="../0-bootstrap/" output -raw cicd_project_id)
708708
echo "_PROJECT_ID = ${CICD_PROJECT_ID}"
709-
sed -i "s/CICD_PROJECT_ID/${CICD_PROJECT_ID}/" ./Jenkinsfile
709+
sed -i'' -e "s/CICD_PROJECT_ID/${CICD_PROJECT_ID}/" ./Jenkinsfile
710710
```
711711

712712
1. Rename `common.auto.example.tfvars` to `common.auto.tfvars`, rename `shared.auto.example.tfvars` to `shared.auto.tfvars` and rename `access_context.auto.example.tfvars` to `access_context.auto.tfvars`.
@@ -726,11 +726,11 @@ Here you will configure a VPN Network tunnel to enable connectivity between the
726726
export ORGANIZATION_ID=$(terraform -chdir="../0-bootstrap/" output -json common_config | jq '.org_id' --raw-output)
727727
export ACCESS_CONTEXT_MANAGER_ID=$(gcloud access-context-manager policies list --organization ${ORGANIZATION_ID} --format="value(name)")
728728
echo "access_context_manager_policy_id = ${ACCESS_CONTEXT_MANAGER_ID}"
729-
sed -i "s/ACCESS_CONTEXT_MANAGER_ID/${ACCESS_CONTEXT_MANAGER_ID}/" ./access_context.auto.tfvars
729+
sed -i'' -e "s/ACCESS_CONTEXT_MANAGER_ID/${ACCESS_CONTEXT_MANAGER_ID}/" ./access_context.auto.tfvars
730730

731731
export backend_bucket=$(terraform -chdir="../0-bootstrap/" output -raw gcs_bucket_tfstate)
732732
echo "remote_state_bucket = ${backend_bucket}"
733-
sed -i "s/REMOTE_STATE_BUCKET/${backend_bucket}/" ./common.auto.tfvars
733+
sed -i'' -e "s/REMOTE_STATE_BUCKET/${backend_bucket}/" ./common.auto.tfvars
734734
```
735735

736736
1. Commit changes.
@@ -745,7 +745,7 @@ Here you will configure a VPN Network tunnel to enable connectivity between the
745745
1. Also update `backend.tf` with your backend bucket from 0-bootstrap output.
746746

747747
```bash
748-
for i in `find -name 'backend.tf'`; do sed -i "s/UPDATE_ME/${backend_bucket}/" $i; done
748+
for i in `find . -name 'backend.tf'`; do sed -i'' -e "s/UPDATE_ME/${backend_bucket}/" $i; done
749749
```
750750

751751
1. Use `terraform output` to get the Cloud Build project ID and the networks step Terraform Service Account from 0-bootstrap output. An environment variable `GOOGLE_IMPERSONATE_SERVICE_ACCOUNT` will be set using the Terraform Service Account to enable impersonation.
@@ -851,15 +851,15 @@ Here you will configure a VPN Network tunnel to enable connectivity between the
851851
```bash
852852
BACKEND_STATE_BUCKET_NAME=$(terraform -chdir="../0-bootstrap/" output -raw gcs_bucket_tfstate)
853853
echo "_STATE_BUCKET_NAME = ${BACKEND_STATE_BUCKET_NAME}"
854-
sed -i "s/BACKEND_STATE_BUCKET_NAME/${BACKEND_STATE_BUCKET_NAME}/" ./Jenkinsfile
854+
sed -i'' -e "s/BACKEND_STATE_BUCKET_NAME/${BACKEND_STATE_BUCKET_NAME}/" ./Jenkinsfile
855855

856856
TERRAFORM_SA_EMAIL=$(terraform -chdir="../0-bootstrap/" output -raw projects_step_terraform_service_account_email)
857857
echo "_TF_SA_EMAIL = ${TERRAFORM_SA_EMAIL}"
858-
sed -i "s/TERRAFORM_SA_EMAIL/${TERRAFORM_SA_EMAIL}/" ./Jenkinsfile
858+
sed -i'' -e "s/TERRAFORM_SA_EMAIL/${TERRAFORM_SA_EMAIL}/" ./Jenkinsfile
859859

860860
CICD_PROJECT_ID=$(terraform -chdir="../0-bootstrap/" output -raw cicd_project_id)
861861
echo "_PROJECT_ID = ${CICD_PROJECT_ID}"
862-
sed -i "s/CICD_PROJECT_ID/${CICD_PROJECT_ID}/" ./Jenkinsfile
862+
sed -i'' -e "s/CICD_PROJECT_ID/${CICD_PROJECT_ID}/" ./Jenkinsfile
863863
```
864864

865865
1. Rename `auto.example.tfvars` files to `auto.tfvars`.
@@ -879,7 +879,7 @@ Here you will configure a VPN Network tunnel to enable connectivity between the
879879
```bash
880880
export backend_bucket=$(terraform -chdir="../0-bootstrap/" output -raw gcs_bucket_tfstate)
881881
echo "remote_state_bucket = ${backend_bucket}"
882-
sed -i "s/REMOTE_STATE_BUCKET/${backend_bucket}/" ./common.auto.tfvars
882+
sed -i'' -e "s/REMOTE_STATE_BUCKET/${backend_bucket}/" ./common.auto.tfvars
883883
```
884884

885885
1. Commit changes.
@@ -892,7 +892,7 @@ Here you will configure a VPN Network tunnel to enable connectivity between the
892892
1. Also update `backend.tf` with your backend bucket from 0-bootstrap output.
893893

894894
```bash
895-
for i in `find -name 'backend.tf'`; do sed -r -i "s/UPDATE_ME|UPDATE_PROJECTS_BACKEND/${backend_bucket}/" $i; done
895+
for i in `find . -name 'backend.tf'`; do sed -r -i "s/UPDATE_ME|UPDATE_PROJECTS_BACKEND/${backend_bucket}/" $i; done
896896
```
897897

898898
1. You need to manually plan and apply only once the `shared` environments since `development`, `non-production`, and `production` depend on it.

0-bootstrap/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,8 @@ Using GitHub Actions requires manual creation of the GitHub repositories used in
208208
cp backend.tf.example backend.tf
209209
cd ..
210210

211-
for i in `find -name 'backend.tf'`; do sed -i "s/UPDATE_ME/${backend_bucket}/" $i; done
212-
for i in `find -name 'backend.tf'`; do sed -i "s/UPDATE_PROJECTS_BACKEND/${backend_bucket_projects}/" $i; done
211+
for i in `find . -name 'backend.tf'`; do sed -i'' -e "s/UPDATE_ME/${backend_bucket}/" $i; done
212+
for i in `find . -name 'backend.tf'`; do sed -i'' -e "s/UPDATE_PROJECTS_BACKEND/${backend_bucket_projects}/" $i; done
213213

214214
cd 0-bootstrap
215215
```

0-bootstrap/modules/jenkins-agent/files/jenkins_gce_startup_script.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ echo "**** Startup Step 8/8: Add public SSH key to the list of authorized keys.
6262
SSHD_CONFIG_DIR="/etc/ssh"
6363

6464
# Setting up the sshd_config file
65-
sed -i $SSHD_CONFIG_DIR/sshd_config \
65+
sed -i'' -e $SSHD_CONFIG_DIR/sshd_config \
6666
-e 's/#PubkeyAuthentication.*/PubkeyAuthentication yes/' \
6767
-e 's/#AuthorizedKeysFile.*/AuthorizedKeysFile \/etc\/ssh\/authorized_keys/'
6868

1-org/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,9 @@ If required, run `terraform output cloudbuild_project_id` in the `0-bootstrap` f
166166
export backend_bucket=$(terraform -chdir="../terraform-example-foundation/0-bootstrap/" output -raw gcs_bucket_tfstate)
167167
echo "remote_state_bucket = ${backend_bucket}"
168168

169-
sed -i "s/REMOTE_STATE_BUCKET/${backend_bucket}/" ./envs/shared/terraform.tfvars
169+
sed -i'' -e "s/REMOTE_STATE_BUCKET/${backend_bucket}/" ./envs/shared/terraform.tfvars
170170

171-
if [ ! -z "${ACCESS_CONTEXT_MANAGER_ID}" ]; then sed -i "s=//create_access_context_manager_access_policy=create_access_context_manager_access_policy=" ./envs/shared/terraform.tfvars; fi
171+
if [ ! -z "${ACCESS_CONTEXT_MANAGER_ID}" ]; then sed -i'' -e "s=//create_access_context_manager_access_policy=create_access_context_manager_access_policy=" ./envs/shared/terraform.tfvars; fi
172172
```
173173

174174
1. Commit changes.
@@ -248,9 +248,9 @@ Change into the `1-org` folder, copy the Terraform wrapper script, and ensure it
248248
export backend_bucket=$(terraform -chdir="../0-bootstrap/" output -raw gcs_bucket_tfstate)
249249
echo "remote_state_bucket = ${backend_bucket}"
250250

251-
sed -i "s/REMOTE_STATE_BUCKET/${backend_bucket}/" ./envs/shared/terraform.tfvars
251+
sed -i'' -e "s/REMOTE_STATE_BUCKET/${backend_bucket}/" ./envs/shared/terraform.tfvars
252252

253-
if [ ! -z "${ACCESS_CONTEXT_MANAGER_ID}" ]; then sed -i "s=//create_access_context_manager_access_policy=create_access_context_manager_access_policy=" ./envs/shared/terraform.tfvars; fi
253+
if [ ! -z "${ACCESS_CONTEXT_MANAGER_ID}" ]; then sed -i'' -e "s=//create_access_context_manager_access_policy=create_access_context_manager_access_policy=" ./envs/shared/terraform.tfvars; fi
254254
```
255255

256256
You can now deploy your environment (production) using this script.

2-environments/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ Run `terraform output cloudbuild_project_id` in the `0-bootstrap` folder to get
126126
export backend_bucket=$(terraform -chdir="../terraform-example-foundation/0-bootstrap/" output -raw gcs_bucket_tfstate)
127127
echo "remote_state_bucket = ${backend_bucket}"
128128

129-
sed -i "s/REMOTE_STATE_BUCKET/${backend_bucket}/" terraform.tfvars
129+
sed -i'' -e "s/REMOTE_STATE_BUCKET/${backend_bucket}/" terraform.tfvars
130130
```
131131

132132
1. Commit changes.
@@ -203,7 +203,7 @@ See `0-bootstrap` [README-GitHub.md](../0-bootstrap/README-GitHub.md#deploying-s
203203
export backend_bucket=$(terraform -chdir="../0-bootstrap/" output -raw gcs_bucket_tfstate)
204204
echo "remote_state_bucket = ${backend_bucket}"
205205

206-
sed -i "s/REMOTE_STATE_BUCKET/${backend_bucket}/" ./terraform.tfvars
206+
sed -i'' -e "s/REMOTE_STATE_BUCKET/${backend_bucket}/" ./terraform.tfvars
207207
```
208208

209209
We will now deploy each of our environments(development/production/non-production) using this script.

0 commit comments

Comments
 (0)