Skip to content

Instantly share code, notes, and snippets.

@bernadinm
Last active February 5, 2019 15:59
Show Gist options
  • Save bernadinm/e96516f8b1b104e8b860e4c05c0c6de2 to your computer and use it in GitHub Desktop.
Save bernadinm/e96516f8b1b104e8b860e4c05c0c6de2 to your computer and use it in GitHub Desktop.
How to make a site-wide dcos-terraform change

github changes

User Dan finds the changes to make

[mb@miguel-nixos:~/Sites/jieyu/dcos-terraform]$ grep -A1 -r . -e "aws_ami" | grep "AMI that will be used" | sed 's/tf-/tf:/g'
./modules/aws/infrastructure/variables.tf:  description = "AMI that will be used for the instances instead of Mesosphere provided AMIs"
./modules/aws/infrastructure/README.md:| aws_ami | AMI that will be used for the instances instead of Mesosphere provided AMIs | string | `` | no |
./modules/aws/public-agents/variables.tf:  description = "AMI that will be used for the instances instead of Mesosphere provided AMIs"
./modules/aws/public-agents/README.md:| aws_ami | AMI that will be used for the instances instead of Mesosphere provided AMIs | string | `` | no |
./modules/aws/tested-oses/variables.tf:  description = "AMI that will be used for the instances instead of Mesosphere provided AMIs"
./modules/aws/tested-oses/README.md:| aws_ami | AMI that will be used for the instances instead of Mesosphere provided AMIs | map | `<map>` | no |
./modules/aws/tested-oses/README.md:| aws_ami | AMI that will be used for the instances instead of Mesosphere provided AMIs |
./modules/aws/tested-oses/outputs.tf:  description = "AMI that will be used for the instances instead of Mesosphere provided AMIs"
./modules/aws/masters/variables.tf:  description = "AMI that will be used for the instances instead of Mesosphere provided AMIs"
./modules/aws/masters/README.md:| aws_ami | AMI that will be used for the instances instead of Mesosphere provided AMIs | string | `` | no |
./modules/aws/private-agents/variables.tf:  description = "AMI that will be used for the instances instead of Mesosphere provided AMIs"
./modules/aws/private-agents/README.md:| aws_ami | AMI that will be used for the instances instead of Mesosphere provided AMIs | string | `` | no |
./modules/aws/remote-region/variables.tf:  description = "AMI that will be used for the instances instead of Mesosphere provided AMIs"
./modules/aws/remote-region/README.md:| aws_ami | AMI that will be used for the instances instead of Mesosphere provided AMIs | string | `` | no |
./modules/aws/bootstrap/variables.tf:  description = "AMI that will be used for the instances instead of Mesosphere provided AMIs"
./modules/aws/bootstrap/README.md:| aws_ami | AMI that will be used for the instances instead of Mesosphere provided AMIs | string | `` | no |
./modules/aws/dcos/variables.tf:  description = "AMI that will be used for the instances instead of Mesosphere provided AMIs"
./modules/aws/dcos/README.md:| aws_ami | AMI that will be used for the instances instead of Mesosphere provided AMIs | string | `` | no |

User Dan makes a global changes against all the modules

[mb@miguel-nixos:~/Sites/jieyu/dcos-terraform]$ for i in $(grep -A1 -r . -e "aws_ami" | grep "AMI that will be used" | sed 's/tf-/tf:/g' | cut -d: -f1); do sed -i.bak 's/AMI that will be used for the instances instead of Mesosphere provided AMIs/AMI that will be used for the instances instead of the Mesosphere chosen default images. Custom AMIs must fulfill the Mesosphere DC\/OS system-requirements: See https:\/\/docs.mesosphere.com\/1.12\/installing\/production\/system-requirements\//g' $i; done

User Dan makes views the changes

[mb@miguel-nixos:~/Sites/jieyu/dcos-terraform]$ grep -A1 -r . -e "aws_ami" | grep "AMI that will be used" | sed 's/tf-/tf:/g'
./modules/aws/infrastructure/variables.tf:  description = "AMI that will be used for the instances instead of the Mesosphere chosen default images. Custom AMIs must fulfill the Mesosphere DC/OS system-requirements: See https://docs.mesosphere.com/1.12/installing/production/system-requirements/"
./modules/aws/infrastructure/README.md:| aws_ami | AMI that will be used for the instances instead of the Mesosphere chosen default images. Custom AMIs must fulfill the Mesosphere DC/OS system-requirements: See https://docs.mesosphere.com/1.12/installing/production/system-requirements/ | string | `` | no |
./modules/aws/infrastructure/variables.tf.bak-  description = "AMI that will be used for the instances instead of Mesosphere provided AMIs"
./modules/aws/infrastructure/README.md.bak:| aws_ami | AMI that will be used for the instances instead of Mesosphere provided AMIs | string | `` | no |
./modules/aws/public-agents/variables.tf:  description = "AMI that will be used for the instances instead of the Mesosphere chosen default images. Custom AMIs must fulfill the Mesosphere DC/OS system-requirements: See https://docs.mesosphere.com/1.12/installing/production/system-requirements/"
./modules/aws/public-agents/README.md:| aws_ami | AMI that will be used for the instances instead of the Mesosphere chosen default images. Custom AMIs must fulfill the Mesosphere DC/OS system-requirements: See https://docs.mesosphere.com/1.12/installing/production/system-requirements/ | string | `` | no |
./modules/aws/public-agents/variables.tf.bak-  description = "AMI that will be used for the instances instead of Mesosphere provided AMIs"
./modules/aws/public-agents/README.md.bak:| aws_ami | AMI that will be used for the instances instead of Mesosphere provided AMIs | string | `` | no |
./modules/aws/tested-oses/variables.tf:  description = "AMI that will be used for the instances instead of the Mesosphere chosen default images. Custom AMIs must fulfill the Mesosphere DC/OS system-requirements: See https://docs.mesosphere.com/1.12/installing/production/system-requirements/"
./modules/aws/tested-oses/outputs.tf.bak-  description = "AMI that will be used for the instances instead of Mesosphere provided AMIs"
./modules/aws/tested-oses/README.md:| aws_ami | AMI that will be used for the instances instead of the Mesosphere chosen default images. Custom AMIs must fulfill the Mesosphere DC/OS system-requirements: See https://docs.mesosphere.com/1.12/installing/production/system-requirements/ | map | `<map>` | no |
./modules/aws/tested-oses/README.md:| aws_ami | AMI that will be used for the instances instead of the Mesosphere chosen default images. Custom AMIs must fulfill the Mesosphere DC/OS system-requirements: See https://docs.mesosphere.com/1.12/installing/production/system-requirements/ |
./modules/aws/tested-oses/variables.tf.bak-  description = "AMI that will be used for the instances instead of Mesosphere provided AMIs"
./modules/aws/tested-oses/README.md.bak:| aws_ami | AMI that will be used for the instances instead of the Mesosphere chosen default images. Custom AMIs must fulfill the Mesosphere DC/OS system-requirements: See https://docs.mesosphere.com/1.12/installing/production/system-requirements/ | map | `<map>` | no |
./modules/aws/tested-oses/README.md.bak:| aws_ami | AMI that will be used for the instances instead of the Mesosphere chosen default images. Custom AMIs must fulfill the Mesosphere DC/OS system-requirements: See https://docs.mesosphere.com/1.12/installing/production/system-requirements/ |
./modules/aws/tested-oses/outputs.tf:  description = "AMI that will be used for the instances instead of the Mesosphere chosen default images. Custom AMIs must fulfill the Mesosphere DC/OS system-requirements: See https://docs.mesosphere.com/1.12/installing/production/system-requirements/"
./modules/aws/masters/variables.tf:  description = "AMI that will be used for the instances instead of the Mesosphere chosen default images. Custom AMIs must fulfill the Mesosphere DC/OS system-requirements: See https://docs.mesosphere.com/1.12/installing/production/system-requirements/"
./modules/aws/masters/README.md:| aws_ami | AMI that will be used for the instances instead of the Mesosphere chosen default images. Custom AMIs must fulfill the Mesosphere DC/OS system-requirements: See https://docs.mesosphere.com/1.12/installing/production/system-requirements/ | string | `` | no |
./modules/aws/masters/variables.tf.bak-  description = "AMI that will be used for the instances instead of Mesosphere provided AMIs"
./modules/aws/masters/README.md.bak:| aws_ami | AMI that will be used for the instances instead of Mesosphere provided AMIs | string | `` | no |
./modules/aws/private-agents/variables.tf:  description = "AMI that will be used for the instances instead of the Mesosphere chosen default images. Custom AMIs must fulfill the Mesosphere DC/OS system-requirements: See https://docs.mesosphere.com/1.12/installing/production/system-requirements/"
./modules/aws/private-agents/README.md:| aws_ami | AMI that will be used for the instances instead of the Mesosphere chosen default images. Custom AMIs must fulfill the Mesosphere DC/OS system-requirements: See https://docs.mesosphere.com/1.12/installing/production/system-requirements/ | string | `` | no |
./modules/aws/private-agents/variables.tf.bak-  description = "AMI that will be used for the instances instead of Mesosphere provided AMIs"
./modules/aws/private-agents/README.md.bak:| aws_ami | AMI that will be used for the instances instead of Mesosphere provided AMIs | string | `` | no |
./modules/aws/remote-region/variables.tf:  description = "AMI that will be used for the instances instead of the Mesosphere chosen default images. Custom AMIs must fulfill the Mesosphere DC/OS system-requirements: See https://docs.mesosphere.com/1.12/installing/production/system-requirements/"
./modules/aws/remote-region/README.md:| aws_ami | AMI that will be used for the instances instead of the Mesosphere chosen default images. Custom AMIs must fulfill the Mesosphere DC/OS system-requirements: See https://docs.mesosphere.com/1.12/installing/production/system-requirements/ | string | `` | no |
./modules/aws/remote-region/variables.tf.bak-  description = "AMI that will be used for the instances instead of Mesosphere provided AMIs"
./modules/aws/remote-region/README.md.bak:| aws_ami | AMI that will be used for the instances instead of Mesosphere provided AMIs | string | `` | no |
./modules/aws/bootstrap/variables.tf:  description = "AMI that will be used for the instances instead of the Mesosphere chosen default images. Custom AMIs must fulfill the Mesosphere DC/OS system-requirements: See https://docs.mesosphere.com/1.12/installing/production/system-requirements/"
./modules/aws/bootstrap/README.md:| aws_ami | AMI that will be used for the instances instead of the Mesosphere chosen default images. Custom AMIs must fulfill the Mesosphere DC/OS system-requirements: See https://docs.mesosphere.com/1.12/installing/production/system-requirements/ | string | `` | no |
./modules/aws/bootstrap/variables.tf.bak-  description = "AMI that will be used for the instances instead of Mesosphere provided AMIs"
./modules/aws/bootstrap/README.md.bak:| aws_ami | AMI that will be used for the instances instead of Mesosphere provided AMIs | string | `` | no |
./modules/aws/dcos/variables.tf:  description = "AMI that will be used for the instances instead of the Mesosphere chosen default images. Custom AMIs must fulfill the Mesosphere DC/OS system-requirements: See https://docs.mesosphere.com/1.12/installing/production/system-requirements/"
./modules/aws/dcos/README.md:| aws_ami | AMI that will be used for the instances instead of the Mesosphere chosen default images. Custom AMIs must fulfill the Mesosphere DC/OS system-requirements: See https://docs.mesosphere.com/1.12/installing/production/system-requirements/ | string | `` | no |
./modules/aws/dcos/variables.tf.bak-  description = "AMI that will be used for the instances instead of Mesosphere provided AMIs"
./modules/aws/dcos/README.md.bak:| aws_ami | AMI that will be used for the instances instead of Mesosphere provided AMIs | string | `` | no |

User Dan's terraform changes

[mb@miguel-nixos:~/Sites/dcos-terraform/dcos-terraform]$ git status On branch master Your branch is up to date with 'origin/master'.

Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git checkout -- ..." to discard changes in working directory) (commit or discard the untracked or modified content in submodules)

modified:   modules/aws/bootstrap (modified content, untracked content)
modified:   modules/aws/dcos (modified content, untracked content)
modified:   modules/aws/infrastructure (modified content)
modified:   modules/aws/masters (modified content, untracked content)
modified:   modules/aws/private-agents (modified content, untracked content)
modified:   modules/aws/public-agents (modified content, untracked content)
modified:   modules/aws/remote-region (modified content, untracked content)
modified:   modules/aws/tested-oses (modified content, untracked content)

no changes added to commit (use "git add" and/or "git commit -a")

User Dan's views all changes

[mb@miguel-nixos:~/Sites/jieyu/dcos-terraform]$ git diff --submodule=diff
Submodule modules/aws/bootstrap contains untracked content
Submodule modules/aws/bootstrap contains modified content
diff --git a/modules/aws/bootstrap/README.md b/modules/aws/bootstrap/README.md
index 6610be7..de689f7 100644
--- a/modules/aws/bootstrap/README.md
+++ b/modules/aws/bootstrap/README.md
@@ -23,7 +23,7 @@ module "dcos-bootstrap-instance" {

 | Name | Description | Type | Default | Required |
 |------|-------------|:----:|:-----:|:-----:|
-| aws_ami | AMI that will be used for the instances instead of Mesosphere provided AMIs | string | `` | no |
+| aws_ami | AMI that will be used for the instances instead of the Mesosphere chosen default images. Custom AMIs must fulfill the Mesosphere DC/OS system-requirements: See https://docs.mesosphere.com/1.12/installing/production/system-requirements/ | string | `` | no |
 | aws_associate_public_ip_address | Associate a public IP address with the instances | string | `true` | no |
 | aws_iam_instance_profile | Instance profile to be used for these instances | string | `` | no |
 | aws_instance_type | Instance type | string | `t2.medium` | no |
diff --git a/modules/aws/bootstrap/variables.tf b/modules/aws/bootstrap/variables.tf
index 2b35d86..0cad7b0 100644
--- a/modules/aws/bootstrap/variables.tf
+++ b/modules/aws/bootstrap/variables.tf
@@ -9,7 +9,7 @@ variable "tags" {
 }

 variable "aws_ami" {
-  description = "AMI that will be used for the instances instead of Mesosphere provided AMIs"
+  description = "AMI that will be used for the instances instead of the Mesosphere chosen default images. Custom AMIs must fulfill the Mesosphere DC/OS system-requirements: See https://docs.mesosphere.com/1.12/installing/production/system-requirements/"
   default     = ""
 }

Submodule modules/aws/dcos contains untracked content
Submodule modules/aws/dcos contains modified content
diff --git a/modules/aws/dcos/README.md b/modules/aws/dcos/README.md
index 035caca..8da9099 100644
--- a/modules/aws/dcos/README.md
+++ b/modules/aws/dcos/README.md
@@ -82,7 +82,7 @@ module "dcos" {
 |------|-------------|:----:|:-----:|:-----:|
 | admin_ips | List of CIDR admin IPs | list | - | yes |
 | availability_zones | Availability zones to be used | list | `<list>` | no |
-| aws_ami | AMI that will be used for the instances instead of Mesosphere provided AMIs | string | `` | no |
+| aws_ami | AMI that will be used for the instances instead of the Mesosphere chosen default images. Custom AMIs must fulfill the Mesosphere DC/OS system-requirements: See https://docs.mesosphere.com/1.12/installing/production/system-requirements/ | string | `` | no |
 | aws_key_name | Specify the aws ssh key to use. We assume its already loaded in your SSH agent. Set ssh_public_key_file to empty string | string | `` | no |
 | bootstrap_associate_public_ip_address | [BOOTSTRAP] Associate a public ip address with there instances | string | `true` | no |
 | bootstrap_aws_ami | [BOOTSTRAP] AMI to be used | string | `` | no |
diff --git a/modules/aws/dcos/variables.tf b/modules/aws/dcos/variables.tf
index b59522f..36621ab 100644
--- a/modules/aws/dcos/variables.tf
+++ b/modules/aws/dcos/variables.tf
@@ -51,7 +51,7 @@ variable "availability_zones" {
 }

 variable "aws_ami" {
-  description = "AMI that will be used for the instances instead of Mesosphere provided AMIs"
+  description = "AMI that will be used for the instances instead of the Mesosphere chosen default images. Custom AMIs must fulfill the Mesosphere DC/OS system-requirements: See https://docs.mesosphere.com/1.12/installing/production/system-requirements/"
   default     = ""
 }

Dan Commits his changes:

[mb@miguel-nixos:~/Sites/jieyu/dcos-terraform]$ BRANCH="testing_branch" make commit | tee -a commits

Dan views his changes:

[mb@miguel-nixos:~/Sites/jieyu/dcos-terraform]$ git status
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)
  
	modified:   modules/aws/bootstrap (new commits)
	modified:   modules/aws/dcos (new commits)
	modified:   modules/aws/infrastructure (new commits)
	modified:   modules/aws/masters (new commits)
	modified:   modules/aws/private-agents (new commits)
	modified:   modules/aws/public-agents (new commits)
	modified:   modules/aws/remote-region (new commits)
	modified:   modules/aws/tested-oses (new commits)

Untracked files:
  (use "git add <file>..." to include in what will be committed)

	commits

no changes added to commit (use "git add" and/or "git commit -a")

Dan adds his changes to dcos-terraform

[mb@miguel-nixos:~/Sites/jieyu/dcos-terraform]$ hub pull-request
https://github.com/bernadinm/dcos-terraform/pull/1
[mb@miguel-nixos:~/Sites/jieyu/dcos-terraform]$ hub pull-request
https://github.com/jieyu/dcos-terraform/pull/1

tfbot Task and Responsibilities

tfbot commit and PR generation

$ BRANCH="aws_ami_description_update" make release | tee -a commits

Result PRs

[mb@miguel-nixos:~/Sites/jieyu/dcos-terraform]$ grep ^https://github.com commits
https://github.com/dcos-terraform/terraform-aws-dcos/pull/44
https://github.com/dcos-terraform/terraform-aws-infrastructure/pull/19
https://github.com/dcos-terraform/terraform-aws-masters/pull/7
https://github.com/dcos-terraform/terraform-aws-private-agents/pull/7
https://github.com/dcos-terraform/terraform-aws-public-agents/pull/7
https://github.com/dcos-terraform/terraform-aws-remote-region/pull/4
https://github.com/dcos-terraform/terraform-aws-tested-oses/pull/8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment