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

Change pre-created object tags #170

Closed
hakkurt opened this issue May 30, 2019 · 15 comments
Closed

Change pre-created object tags #170

hakkurt opened this issue May 30, 2019 · 15 comments
Labels
enhancement Enhancement

Comments

@hakkurt
Copy link

hakkurt commented May 30, 2019

Is there any way to change pre-created NSX-T object tag via TF ?

@annakhm
Copy link
Collaborator

annakhm commented May 31, 2019

Hi @hakkurt, can you please give an example of such pre-created tag?

@hakkurt
Copy link
Author

hakkurt commented Jun 1, 2019

Hi. I'm trying to automate NSX-T and vanilla K8S integration via TF. There are some steps needs to tag NSX-T objects (like existing transport zones, logical ports) with_k8s-cluster1 ncp/cluster_ tag. I can tag NSX-T objects if I create them via TF but if the object is created manually, I could not find a way to tag them.

@annakhm
Copy link
Collaborator

annakhm commented Jun 3, 2019

Hi, you can import the existing logical port into terraform and then manage the tags, but this will not work with TZs since these are not offered as provider resource at this point.

@hakkurt
Copy link
Author

hakkurt commented Jun 4, 2019

The problem is : I must know object id to use import function. Logical ports are created after VMs are connected to to logical ports. This operation is also done in my TF file. My TF files are located at https://github.com/hakkurt/Terraform/tree/master/NSXT-K8S .Could you please give me an advice on how to do that ?

@tvigneron
Copy link
Collaborator

Hello Hakkurt,
A solution I see would be to tag your VMs and use Apply To (by Logical Switch for instance) on the Distributed Firewall.
This way you'll be able to achieve the same result but will not have wait to know port object id.

@tvigneron
Copy link
Collaborator

Would that work for you ?

@hakkurt
Copy link
Author

hakkurt commented Jun 4, 2019

Hi Thomas,
Actually I'm trying to tag logical ports for K8S NCP integration. To be honest, I could not get how tagging VMs will help to achieve this :)

@annakhm
Copy link
Collaborator

annakhm commented Jun 5, 2019

Hi @hakkurt, sounds like you need a resource similar to nsxt_vm_tags, only for port tags, to be used to tag auto-created ports. We'll look into this, thanks for reporting the need!

@annakhm annakhm added the enhancement Enhancement label Jun 5, 2019
@annakhm
Copy link
Collaborator

annakhm commented Jun 25, 2019

Hi @hakkurt, we've added an option to set port tags via nsxt_vm_tags resource here:
https://github.com/terraform-providers/terraform-provider-nsxt/pull/171
Pls let us know if this works for you! Thanks

@annakhm annakhm closed this as completed Jun 25, 2019
@hakkurt
Copy link
Author

hakkurt commented Jun 25, 2019

Thanks for the improvement. In fact, my request was about tagging NSX-T logical ports not VMs. Can I do following steps by using this TF resource ?
https://github.com/dumlutimuralp/nsx-t-k8s/blob/master/Part%203/README.md#tagging-nsx-t-objects-for-k8s

Thanks

@annakhm
Copy link
Collaborator

annakhm commented Jun 26, 2019

yes, now you can use attribute logical_port_tag of nsxt_vm_tags resource, and the provider will apply these tags to logical port that corresponds to the VM

@hakkurt
Copy link
Author

hakkurt commented Jun 28, 2019

I have just tested. Its tagging VM itself not Logical ports. Pls see screenshoots

1

2

@annakhm
Copy link
Collaborator

annakhm commented Jun 28, 2019

@hakkurt sorry just to confirm - you are setting logical_port_tag (not tag) attribute on nsxt_vm_tags, with master branch of the provider?

@hakkurt
Copy link
Author

hakkurt commented Jun 28, 2019

I used official provider. (https://www.terraform.io/docs/providers/nsxt/index.html). I believe I need to use latest code in github

@annakhm
Copy link
Collaborator

annakhm commented Jun 28, 2019

Yes, this feature is not yet released, you'll need to compile the provider from master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement
Projects
None yet
Development

No branches or pull requests

3 participants