Slide 1

Slide 1 text

How to contribute to terraform-provider-aws Takeshi Kondo SRE at Quipper 2019/08/01 Terraform Meetup Tokyo#1

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

• Run test • Set debug • Read code • Read Issue • Read Pull Request

Slide 4

Slide 4 text

Merged 3 Pull Requests

Slide 5

Slide 5 text

Merged 3 Pull Requests See my blog for details: Google “πφϫλϦϚΠϥΠϑ” - Terraform importͷ࣮૷ - Terraform aws provider PR / lambdaͷnode engine v6.10ͷEOLରԠ

Slide 6

Slide 6 text

• Join Terraform Source Code Reading • Join #codereading at Terraform-jp slack

Slide 7

Slide 7 text

Agenda • Basic source code structure • 4 Steps of preparing • 6 Steps of contributing

Slide 8

Slide 8 text

Agenda • Basic source code structure • 4 Steps of preparing • 6 Steps of contributing

Slide 9

Slide 9 text

Basic source code structure • terraform-provider-aws • aws/ • data_source_aws_iam_policy.go • data_source_aws_iam_policy_test.go • resource_aws_iam_policy.go • resource_aws_iam_policy_test.go • website/ %FpOFE w $SFBUF w 3FBE w 6QEBUF w %FMFUF w *NQPSUFS

Slide 10

Slide 10 text

Agenda • Basic source code structure • 4 Steps of preparing • 6 Steps of contributing

Slide 11

Slide 11 text

4 Steps of preparing • Clone and build • Set debug • Run test • Push to fork

Slide 12

Slide 12 text

4 Steps of preparing • Clone and build • Set debug • Run test • Push to fork

Slide 13

Slide 13 text

Clone and build (Thanks @minamijoyo) • git clone git@github.com:hashicorp/terraform.git • cd terraform • git checkout v0.12.3 • export GO111MODULE=on • make dev -> $GOPATH/bin/terraform • git clone git@github.com:terraform-providers/ terraform-provider-aws.git • cd terraform-provider-aws • git checkout v2.21.1 • export GO111MODULE=off • make • See Hackmd for details • https://hackmd.io/HeEmX_dPQAaEANhiH1lKQQ?view

Slide 14

Slide 14 text

4 Steps of preparing • Clone and build • Set debug • Run test • Push to fork

Slide 15

Slide 15 text

Set debug (Thanks @minamijoyo) • Terraform/main.go • terraform-provider-aws/main.go func main() { + log.SetFlags(log.Llongfile) // Override global prefix set by go-dynect during init() log.SetPrefix("") os.Exit(realMain()) import ( "github.com/hashicorp/terraform/plugin" "github.com/terraform-providers/terraform-provider-aws/aws" + "log" ) func main() { + log.SetFlags(log.Llongfile) plugin.Serve(&plugin.ServeOpts{ ProviderFunc: aws.Provider}) }

Slide 16

Slide 16 text

Set debug (Thanks @minamijoyo) • Terraform/main.go • terraform-provider-aws/main.go func main() { + log.SetFlags(log.Llongfile) // Override global prefix set by go-dynect during init() log.SetPrefix("") os.Exit(realMain()) import ( "github.com/hashicorp/terraform/plugin" "github.com/terraform-providers/terraform-provider-aws/aws" + "log" ) func main() { + log.SetFlags(log.Llongfile) plugin.Serve(&plugin.ServeOpts{ ProviderFunc: aws.Provider}) } • See Hackmd for details • https://hackmd.io/HeEmX_dPQAaEANhiH1lKQQ?view • Terraform৬ਓೖ໳: ೔ʑͷӡ༻ͰֶΜͩ஌ݟΛ ୶ʑͱ·ͱΊΔ / @minamijoyo • TerraformΛσόοά͢Δٕज़ • https://qiita.com/minamijoyo/items/1f57c62bed781ab8f4d7

Slide 17

Slide 17 text

4 Steps of preparing • Clone and build • Set debug • Run test • Push to fork

Slide 18

Slide 18 text

Run test cat .envrc \ export AWS_PROFILE=“chaspy” make testacc \ TESTARGS=‘-run=TestAccAWSEcsCluster_basic’ Note that resources are actually created and charged for your account

Slide 19

Slide 19 text

4 Steps of preparing • Clone and build • Set debug • Run test • Push to fork

Slide 20

Slide 20 text

Push to fork • # fork the repository • # terraform-providers/terraform-provider-aws • # -> chaspy/terraform-provider-aws • git remote add fork https://github.com/chaspy/ terraform-provider-aws.git • git push fork

Slide 21

Slide 21 text

Agenda • Basic source code structure • 4 Steps of preparing • 6 Steps of contributing

Slide 22

Slide 22 text

6 Steps of contributing • Determine the issue you solve • Make a sandbox • Apply the sample code • Reproduce the issue with debug log • Read the reference PR • Read a code and commit and push

Slide 23

Slide 23 text

6 Steps of contributing • Determine the issue you solve • Make a sandbox • Apply the sample code • Reproduce the issue with debug log • Read the reference PR • Read a code and commit and push • Ask contributor (Thanks @kterada0509) • See “good first issue” label • Recommend: Support import issue

Slide 24

Slide 24 text

6 Steps of contributing • Determine the issue you solve • Make a sandbox • Apply the sample code • Reproduce the issue with debug log • Read the reference PR • Read a code and commit and push

Slide 25

Slide 25 text

6 Steps of contributing • Determine the issue you solve • Make a sandbox • Apply the sample code • Reproduce the issue with debug log • Read the reference PR • Read a code and commit and push

Slide 26

Slide 26 text

6 Steps of contributing • Determine the issue you solve • Make a sandbox • Apply the sample code • Reproduce the issue with debug log • Read the reference PR • Read a code and commit and push

Slide 27

Slide 27 text

6 Steps of contributing • Determine the issue you solve • Make a sandbox • Apply the sample code • Reproduce the issue with debug log • Read the reference PR • Read a code and commit and push

Slide 28

Slide 28 text

6 Steps of contributing • Determine the issue you solve • Make a sandbox • Apply the sample code • Reproduce the issue with debug log • Read the reference PR • Read a code and commit and push • Reviewed in a few days • They review kindly

Slide 29

Slide 29 text

Conclusion • Anyone can send a pull request • Not afraid of Terraform by contributing • Motivated to use the latest version

Slide 30

Slide 30 text

• Join Terraform Source Code Reading • Next: #2 2nd Sep. (Mon) • Join #codereading at Terraform-jp slack

Slide 31

Slide 31 text

• @officel / @raki • Organizer of Terraform-jp Special Thanks • @morihaya • Co-organizer meetup • @minamijoyo • Lead code-reading • @kterada0509 / teraken0509 • Lead code-reading

Slide 32

Slide 32 text

Thank You! chaspy chaspy_ / chaspy_en Site Reliability Engineer at Quipper Takeshi Kondo SRE Lounge Terraform-jp