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

add support for tags on spot fleet requests #1366

Closed
wants to merge 4 commits into from

Conversation

taylorsmithgg
Copy link

Solves #1232

Copy link
Contributor

@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.

Hi! Thanks for your contribution here. I have some questions about the approach used and the 2 attributes. In addition this we'll need documentation written for the attribute(s) and acceptance tests. Please let me know if you'd like guidance there and we'll be happy to help!

@@ -256,6 +256,30 @@ func resourceAwsSpotFleetRequest() *schema.Resource {
Computed: true,
ForceNew: true,
},
"tag": {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm curious if you were able to examine other resource's support of EC2 tags before coming to this implementation? Most resources use our helper file aws/tags.go:

https://github.com/terraform-providers/terraform-provider-aws/blob/494221fd522c1d41c47790e1a04ce78fcd1c3ab6/aws/tags.go#L20-L25

Example usage from aws_instance:

https://github.com/terraform-providers/terraform-provider-aws/blob/494221fd522c1d41c47790e1a04ce78fcd1c3ab6/aws/resource_aws_instance.go#L262-L264

Copy link
Author

@taylorsmithgg taylorsmithgg Aug 15, 2017

Choose a reason for hiding this comment

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

I previewed aws_instance but with different specs and SpotFleetTagSpecification in the mix, opted to go with a similar model used here: https://github.com/terraform-providers/terraform-provider-aws/blob/master/aws/resource_aws_autoscaling_group.go

Set: spotFleetTagToHash,
},

"tags": {
Copy link
Contributor

Choose a reason for hiding this comment

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

How does this attribute work, and how does it differ from tag set above? For instance, in the aws_instance resource, you see this for configuration:

tags {
  Name = "HelloWorld"
}

Can you elaborate on how this tags attribute is used?

Copy link
Author

Choose a reason for hiding this comment

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

The class for aws-sdk is SpotFleetTagSpecification with uses key and value. I just attempted to follow along with the aws model without making too many modifications.

tags = [
  {
    key = "key"
    value = "${var.name}"
  }
]

Tags: tags,
},
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems by the implementation above that a user cannot specify both tags and tag. By the looks of it, tags would take predecease if both are supplied , is the the intent? If so, they should use the helper/schema ConflictsWith attribute. An example of this usage can be found in aws_instance:

https://github.com/terraform-providers/terraform-provider-aws/blob/494221fd522c1d41c47790e1a04ce78fcd1c3ab6/aws/resource_aws_instance.go#L106-L110

Copy link
Author

Choose a reason for hiding this comment

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

This was originally in the reference implementation, but caused some minor issues that I didn't have capacity to work on at the time. I intend to add it back in.

@radeksimko radeksimko added enhancement Requests to existing resources that expand the functionality or scope. waiting-response Maintainers are waiting on response from community or contributor. labels Aug 10, 2017
@moee
Copy link

moee commented Aug 18, 2017

First of all thanks for this PR, I'm looking very forward to be able to use this. If there is anything I can contribute (documentation, tests, ...) please let me know.

The PR now proposes this syntax:

tags = [
  {
    key = "key"
    value = "${var.name}"
  }
]

Is there a specific reason why it doesn't follow the SpotFleetLaunchSpecification naming from the AWS API and use the SpotFleetTagSpecification data structure? In this case, the tags would we wrapped around tag_specification

tag_specifications = [
  {
    resource_type = "instance"
    tags = [
      {
        key = "key"
        value = "${var.name}"
      }
    ]
  }
]

It adds some verbosity (considering that at the moment the only resource type that is supported is instance), but reading the API documentation, my first guess would have been to use tag_specifications in terraform. Also, if at some point more resource types are supported, you can provide this functionality without breaking compatibility.

@aaroncline
Copy link

Please revive this feature!

@nullck
Copy link

nullck commented Sep 22, 2017

Please revive this feature[2]

@taylorsmithgg
Copy link
Author

I'd be happy to, I'll make the requested changes in the next week. Sorry for the delays!

@davidfic
Copy link

davidfic commented Oct 9, 2017

Any update on this PR getting merged?

@Ninir
Copy link
Contributor

Ninir commented Oct 26, 2017

Hy @taylorsmithgg

Did you find time to continue the work? :)
We would love to this merged! 🚀

@galindro
Copy link

@taylorsmithgg any return??

@ghost
Copy link

ghost commented Nov 1, 2017

Is this the same as #2042 ?

@taylorsmithgg
Copy link
Author

Apologies, I've been traveling a ton and haven't had time. Looks like #2042 wasn't working for some folks. I'll take a look now and see if I can get it in for you guys!

@radeksimko radeksimko added the size/L Managed by automation to categorize the size of a PR. label Nov 15, 2017
@radeksimko radeksimko added the service/ec2 Issues and PRs that pertain to the ec2 service. label Jan 12, 2018
@bflad
Copy link
Contributor

bflad commented Jul 9, 2018

This pull request predates my maintainership by quite a bit so I'm really not sure the history here, but it appears this support has already been handled by #2042 and the related issue #1232 is closed. I'm going to close this pull request based on that to clean up the open PRs in the repository, but if I'm missing something, please let me know.

@bflad bflad closed this Jul 9, 2018
@ghost
Copy link

ghost commented Apr 4, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 4, 2020
@breathingdust breathingdust removed the waiting-response Maintainers are waiting on response from community or contributor. label Sep 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/ec2 Issues and PRs that pertain to the ec2 service. size/L Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.