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

Tagging of instances on AWS #430

Closed
ivyleavedtoadflax opened this issue Mar 5, 2021 · 7 comments · Fixed by #748 or #750
Closed

Tagging of instances on AWS #430

ivyleavedtoadflax opened this issue Mar 5, 2021 · 7 comments · Fixed by #748 or #750
Assignees
Labels
cml-runner Subcommand

Comments

@ivyleavedtoadflax
Copy link

Is it possible to apply tags to instances created on AWS? I've tried the --label option, but I can't see where this is propagated into instances in AWS.

@DavidGOrtega
Copy link
Contributor

DavidGOrtega commented Mar 5, 2021

👋 @ivyleavedtoadflax very good suggestion. Indeed Im changing the title to make it more assertive.

No right now its not doing that but I agree that should be happening like the name is actually synced.

@DavidGOrtega DavidGOrtega changed the title Tagging of instances on AWS - is this possible? Tagging of instances on AWS Mar 5, 2021
@DavidGOrtega DavidGOrtega added the cml-runner Subcommand label Mar 5, 2021
@DavidGOrtega DavidGOrtega self-assigned this Mar 16, 2021
@DavidGOrtega DavidGOrtega added the cloud-aws Amazon Web Services label Mar 23, 2021
@ivyleavedtoadflax
Copy link
Author

Is there any update on this on? My use case is the following:

I need to be able to see which resources relate to which project so that I can bill clients appropriately.

Since we use tags for other AWS resources, it would make sense if we could use tags in this case, but in the interim I can use the instance labels. This adds an extra manual step for each client, so it would be good if I could avoid it!

@dacbd
Copy link
Contributor

dacbd commented Aug 31, 2021

@DavidGOrtega @0x2b3bfa0

I am not sure of the status of this issue.

I plan to attempt to implement this functionality unless a team member is actively developing it.

In my use case, I need to add several tags 3-5 to all AWS resources for tracking/billing; If you can provide an example of how you would see this best passed to the cml-runner, I am willing to submit a PR here and upstream. I saw a previous upstream PR, but it looked like this only added specific tags and didn't allow users to add their own tags arbitrarily.

@0x2b3bfa0
Copy link
Member

0x2b3bfa0 commented Sep 5, 2021

Proposed syntax: --cloud-metadata="key=value" --cloud-metadata="key=value" ··· or --cloud-metadata "key=value" "key=value" ··· with yargs.array(); the word metadata is subject to change as per iterative/terraform-provider-iterative#185

Draft

const yargs = require("yargs");

function equalDelimitedToObject(items) {
  const keyValuePairs = items.map((item) => [...item.split(/=(.+)/), null]);
  return Object.fromEntries(keyValuePairs);
}

const options = {
  "cloud-metadata": {
    array: true,
    string: true,
    coerce: equalDelimitedToObject,
    demandOption: true,
  },
};

const { cloudMetadata } = yargs.strict().options(options).parse();

console.log(cloudMetadata);

@0x2b3bfa0 0x2b3bfa0 assigned 0x2b3bfa0 and unassigned DavidGOrtega Sep 5, 2021
@0x2b3bfa0 0x2b3bfa0 added blocked Dependent on something else and removed cloud-aws Amazon Web Services labels Sep 5, 2021
@0x2b3bfa0
Copy link
Member

0x2b3bfa0 commented Sep 5, 2021

@0x2b3bfa0
Copy link
Member

🔔 Carbon copy to @danielbarnes to avoid effort duplication.

@0x2b3bfa0 0x2b3bfa0 removed the blocked Dependent on something else label Sep 10, 2021
@dacbd dacbd mentioned this issue Sep 24, 2021
@0x2b3bfa0
Copy link
Member

Glad you found the snippet above useful. It has been hidden as a comment in the edit history of #430 (comment) for a long time, just as a note to my future self. XKCD 1421.

@0x2b3bfa0 0x2b3bfa0 linked a pull request Sep 24, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cml-runner Subcommand
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants