본문 바로가기
개발/Terraform on NaverCloud

멘토님 피드백 반영 (3) & 회고

by 컴쏘 2023. 12. 7.
728x90

마지막 멘토님 피드백 반영 및 오픈소스 활동에 대한 회고를 해보려고 한다. 

 

[원철 멘토님 피드백]

 

1) 폴더 및 파일명 cloudmssql → mssql 로 변경

변경하기

 

2) sensitive 속성 함께 추가하기 & 패스워드 validation 조건에 backtick이 빠짐

 

참고 : https://github.com/dusdjhyeon/terraform-provider-ncloud/commit/ba1a9bd694b1e6fe5b2381239c87e5bf809f4583

 

"user_password": {
	Type:      schema.TypeString,
	Required:  true,
	Sensitive: true,
	ValidateDiagFunc: validation.ToDiagFunc(validation.All(
		validation.StringLenBetween(8, 20),
		validation.StringMatch(regexp.MustCompile(`[a-zA-Z]+`), "Must have at least one alphabet"),
		validation.StringMatch(regexp.MustCompile(`\\d+`), "Must have at least one number"),
		validation.StringMatch(regexp.MustCompile(`[~!@#$%^*()\\-_=\\[\\]\\{\\};:,.<>?]+`), "Must have at least one special character"),
		validation.StringMatch(regexp.MustCompile(`^[^&+\\\\"'/\\s`+"`"+`]*$`), "Must not have ` & + \\\\ \\" ' / and white space."),
	)),
	Description: "Access password for user, which will be used for DB admin.",
	ForceNew:    true,
},

 

 

 

3) server_name attribute가 mssql datasource에 존재하지 않음

  • server_name attribute를 optional | computed로 추가 필요
"server_name": {
	Type:     schema.TypeString,
	Optional: true,
	Computed: true,
},

 

 

4) mssql data source에 존재하지 않는 attribute 추가하기

  • zone_code, vpc_no, subnet_no
"zone_code": {
	Type:     schema.TypeString,
	Optional: true,
	Computed: true,
	},
	"vpc_no": {
	Type:     schema.TypeString,
	Optional: true,
	Computed: true,
	},
	"subnet_no": {
		Type:     schema.TypeString,
		Optional: true,
		Computed: true,
	},

 

 

5) is_ha는 computed 특성만 가진 attribute

  • 사용자가 입력할 수 없는 argument로 config에서 제외하기
data "ncloud_mssql" "test" {
		service_name = ncloud_mssql.mssql.service_name
	}

 

 

6) cloud_mssql_data_source에서 Optional behavior 가 제외되어야 하는 attribute 필요없는 것들 Optional 제외하기 

 

is_hais_multi_zoneis_backupbackup_file_retention_periodbackup_timeportimage_product_codeinstance_noserver_instance_list attribute는 모두 사용자가 입력한 값을 사용하지 않고, GetCloudMssqlInstanceList()의 결과로 가져오는 값이다. 

 

7) engine_version 제외하기 

  • 이제 존재하지 않는 항목이라고 한다. 

 

8) Computed로 수정 필요한 것 → Attributes reference 항목에 추가

  • is_ha, is_multi_zone, is_backup (이것들은 Computed 속성만 가짐)
  • 위의 것들 중에서 Optional로 표시되어 있는 것은 Computed로 수정하기
## Argument Reference

The following arguments are supported:

* `id` - (Optional) The ID of the specific MSSQL to retrieve.
* `service_name` - (Optional) The name of the specific MSSQL to retrieve.
* `filter` - (Optional) Custom filter block as described below.
  * `name` - (Required) The name of the field to filter by.
  * `values` - (Required) Set of values that are accepted for the given field.
  * `regex` - (Optional) is `values` treated as a regular expression.
## Attributes Reference

* `vpc_no` - The ID of the VPC.
* `subnet_no` - The ID of the Subnet.
* `is_ha` - (Computed) Whether using high availability of the specific MSSQL to retrieve.
* `is_multi_zone` - (Computed) Whether using multi zone of the specific MSSQL to retrieve.
* `is_backup` - (Computed) Whether using backup of the specific MSSQL to retrieve.
* `backup_file_retention_period` - The backup period of the MSSQL database.
* `backup_time` - The backup time of the MSSQL database.
* `image_product_code` - The image product code of the MSSQL instance.
* `cloud_mssql_server_instance_list` The list of MSSQL server instances.

 

 

9) is_ha required로 바꾸기

* `is_ha` - (Required) Whether using high availability of the specific MSSQL to retrieve.

 

 

10) resources docs 부분에 engine_version 지우기

 

11) mssql.go 부분에서 삭제 판단할 때 로직 변경하기 

이 부분은 원철 멘토님께 문의를 한 결과 API 개선 사항이었기 때문에, API가 개선되고 난 후에, 원철 멘토님께서 직접 수정하셨다. 

 

원철 멘토님 문의 및 답변

 

[pr 반영 및 comment 남기기]

pr 반영 및 comment 남기기

 

pr 반영 및 comment 남기기

 

 

 

MSSQL 리소스를 직접 개발해보면서, test 코드가 중요하다는 것을 많이 느꼈다. test 코드를 통해서 검증을 할 수 있고 PR 리뷰어에게 검증할 수 있는 환경을 제공해주기 때문이다. 

 

멘토님들이 피드백을 주시고, 그것을 반영하는 과정에서 많이 성장한 것 같다. 처음에는 MSSQL 리소스 개발을 잘 할 수 있을까?에 대한 생각을 많이 했지만, 다른 리소스 개발 코드 참고, 가이드 문서 참고, 멘토님 피드백, 다른 DB 리소스를 개발하는 멘티들과의 소통을 통해서 잘 해결해 나갈 수 있었던 것 같다. 

 

오픈 소스 Challengers 부터 Masters까지 무사히 수료하였고, 그 과정 속에서 많이 성장한 것 같아 정말 뿌듯하다 !! 

728x90