Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

r/kubernetes_service: Switch targetPort to string #154

Merged
merged 1 commit into from
Apr 17, 2018
Merged

r/kubernetes_service: Switch targetPort to string #154

merged 1 commit into from
Apr 17, 2018

Conversation

appilon
Copy link
Contributor

@appilon appilon commented Apr 13, 2018

Fix #134
switch targetPort to string in schema
new acceptance test
update docs to reflect targetPort is optional

TF_ACC=1 go test ./kubernetes -v -run=TestAccKubernetesService -timeout 120m
=== RUN   TestAccKubernetesServiceAccount_basic
--- PASS: TestAccKubernetesServiceAccount_basic (1.98s)
=== RUN   TestAccKubernetesServiceAccount_update
--- PASS: TestAccKubernetesServiceAccount_update (3.04s)
=== RUN   TestAccKubernetesServiceAccount_generatedName
--- PASS: TestAccKubernetesServiceAccount_generatedName (0.96s)
=== RUN   TestAccKubernetesService_basic
--- PASS: TestAccKubernetesService_basic (1.60s)
=== RUN   TestAccKubernetesService_loadBalancer
--- PASS: TestAccKubernetesService_loadBalancer (58.68s)
=== RUN   TestAccKubernetesService_nodePort
--- PASS: TestAccKubernetesService_nodePort (0.89s)
=== RUN   TestAccKubernetesService_noTargetPort
--- PASS: TestAccKubernetesService_noTargetPort (97.85s)
=== RUN   TestAccKubernetesService_stringTargetPort
--- PASS: TestAccKubernetesService_stringTargetPort (118.08s)
=== RUN   TestAccKubernetesService_externalName
--- PASS: TestAccKubernetesService_externalName (0.85s)
=== RUN   TestAccKubernetesService_importBasic
--- PASS: TestAccKubernetesService_importBasic (0.96s)
=== RUN   TestAccKubernetesService_generatedName
--- PASS: TestAccKubernetesService_generatedName (0.85s)
=== RUN   TestAccKubernetesService_importGeneratedName
--- PASS: TestAccKubernetesService_importGeneratedName (0.94s)
PASS
ok  	github.com/terraform-providers/terraform-provider-kubernetes/kubernetes	286.771s

Fortunately HCL appears to be flexible enough that it accepts both target_port: 80 or target_port: "80". Kubernetes has its own IntOrString type that will parse the stringified integer to an int. Long story short there should be no breaking changes in anyones configs

new acceptance test
update docs to reflect targetPort is optional
@appilon appilon requested a review from a team April 17, 2018 15:02
Copy link

@catsby catsby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@appilon appilon merged commit 2160838 into hashicorp:master Apr 17, 2018
@appilon
Copy link
Contributor Author

appilon commented Apr 26, 2018

I broke the data source woops, that will teach me for not running the full suite of tests:

=== RUN   TestAccKubernetesDataSourceService_basic
--- FAIL: TestAccKubernetesDataSourceService_basic (0.89s)
	testing.go:518: Step 0 error: Error applying: 1 error(s) occurred:

		* data.kubernetes_service.test: data.kubernetes_service.test: spec.0.port.0.target_port: '' expected type 'int', got unconvertible type 'string'
	testing.go:579: Error destroying resource! WARNING: Dangling resources
		may exist. The full state and error is shown below.

		Error: Error refreshing: 1 error(s) occurred:

		* data.kubernetes_service.test: 1 error(s) occurred:

		* data.kubernetes_service.test: data.kubernetes_service.test: spec.0.port.0.target_port: '' expected type 'int', got unconvertible type 'string'

		State: <nil>

@ghost ghost locked and limited conversation to collaborators Apr 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

kubernetes_service target_port doesn't accept name
2 participants